:root {
    --text-color : #303030; 
    --text-color-01 : #17431f;
    --text-color-02 : #4B6352;
    --text-color-03: #98B88D;
    --background-color: #faf9f6;
    --primary-color: #D2E2CD;
    --secondary-color: #15371A;
    --hover-color: #668862;
    --gray: #fcfbf9;
    --font-size-text: clamp(0.805vw, 13.5px, 0.87vw);
    --font-size-headings: clamp(0.85vw, 15px, 0.95vw);
    --font-size-btn : clamp(0.7vw, 12px, 0.9vw);
    --section-spacing: clamp(130px, 5vh, 140px) 0 clamp(98px, 5vh, 100px) ;
    --header-menus: clamp(0.81vw, 15px, 0.93vw);
} 


.sales-agents-page {
    min-height: 100vh;
    background-color: var(--background-color, #ffffff);
}

.sales-agents-section {
    padding: clamp(150px, 15vw, 150px) 0 clamp(120px, 13vw, 120px);
}

.sales-agents-heading {
    width: 100%;
    margin-bottom: clamp(25px, 3vw, 27px);
    text-align: right;
}

.sales-agents-heading h1 {
    margin: 0 0 10px;
    color: var(--text-color);
    font-size: clamp(20px, 3vw, 20px);
    font-weight: 700;
    line-height: 1.5;
}

.sales-agents-heading p {
    max-width: 900px;
    margin: 0;
    color: var(--text-color-02, #4b6352);
    font-size: clamp(0.79vw, 13px, 0.8vw);
    line-height: 2.1;
}

.sales-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(23, 67, 31, 0.12);
    background-color: #ffffff;
    box-shadow: 0 2px 20px rgba(61, 61, 61, 0.041);
    border-radius: 5px;
}

.sales-agents-table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    table-layout: fixed;
    direction: rtl;
}

.sales-agents-table th,
.sales-agents-table td {
    border-left: 1px solid rgba(23, 67, 31, 0.1);
    border-bottom: 1px solid rgba(23, 67, 31, 0.1);
    vertical-align: middle;
}

.sales-agents-table th:last-child,
.sales-agents-table td:last-child {
    border-left: 0;
}

.sales-agents-table th {
    height: 55px;
    padding: 5px 20px;
    background-color: var(--primary-color);
    color: #444444;
    font-size: var(--font-size-headings);
    font-weight: 700;
    text-align: center;
}

.sales-agents-table td {
    min-height: 50px;
    padding: 6px;
    color: #444444;
    font-size: clamp(0.78vw, 13px, 0.803vw);
    line-height: 1.9;
    text-align: center;
    transition:
        background-color 180ms ease,
        color 180ms ease;
}

.sales-agents-table tbody tr {
    transition: background-color 180ms ease;
}

.sales-agents-table tbody tr:hover {
    background-color: rgba(203, 211, 195, 0.22);
}

.sales-agents-table tbody tr:last-child td {
    border-bottom: 0;
}

/* رنگی شدن ستون فروشگاه */
.sales-agents-table tbody td:nth-child(1) {
    background-color: #faf8f5;
    color: var(--text-color-01);
    font-weight: 500;
}

.sales-agents-table tbody tr:hover td:nth-child(1) {
    background-color: rgba(231, 241, 224, 0.411);
}

.sales-agents-table th:nth-child(1),
.sales-agents-table td:nth-child(1) {
    width: 20%;
}

.sales-agents-table th:nth-child(2),
.sales-agents-table td:nth-child(2) {
    width: 40%;
}

.sales-agents-table th:nth-child(3),
.sales-agents-table td:nth-child(3) {
    width: 22%;
    direction: ltr;
}

.sales-agents-table th:nth-child(4),
.sales-agents-table td:nth-child(4) {
    width: 18%;
}

.sales-agent-address {
    display: block;
    text-align: center;
}

.sales-agent-phone {
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: plaintext;
}

.sales-agent-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

.sales-agent-link img {
    display: block;
    width: 25px;
    height: 25px;
    object-fit: contain;
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}


.sales-agent-link:focus-visible {
    outline: 2px solid var(--secondary-color, #15371a);
    outline-offset: 5px;
}

.sales-agent-empty {
    color: rgba(48, 48, 48, 0.46);
}

.sales-agents-table td:nth-child(3) {
    direction: ltr; /* برای اینکه شماره‌ها مثل 021-40000000 برعکس نشن */
    text-align: center; /* شماره رو قشنگ وسط سلول قرار میده */
    /* اگر دوست داری کاملاً بیاد سمت راست (زیر تیترش)، به جای center بنویس: right */
}

/* همینطور برای تیتر ستون تلفن که یکپارچه بشه */
.sales-agents-table th:nth-child(3) {
    text-align: center; 
}

/* =========================================
   ریسپانسیو - تبلت
   ========================================= */
@media (max-width: 1024px) {
    /* تنظیم کانتینر روی ۸۰ درصد و وسط‌چین کردن مطمئن */
    .sales-agents-page .container {
        width: 80%;
        max-width: 100%;
        margin: 0 auto;
    }

    .sales-agents-section {
        padding: 12vh 0 5vh;
    }

    /* --- تنظیم سایز فونت‌های تبلت --- */
    .sales-agents-heading {
        margin-bottom: 34px;
    }

    .sales-agents-heading h1 {
        font-size: 19px; /* سایز استاندارد برای تیتر تبلت */
    }

    .sales-agents-heading p {
        font-size: 14px !important; 
    }

    /* --- فیکس کردن جدول و حذف کامل اسکرول افقی --- */
    .sales-table-wrapper {
        width: 100%;
        overflow-x: hidden; /* جلوگیری قاطع از اسکرول خوردن رپر */
    }

    .sales-agents-table {
        width: 100%; /* پر کردن کامل عرض ۸۰ درصدی کانتینر */
        min-width: 100%; /* خنثی کردن حداقل عرض دسکتاپ و کدهای قبلی */
    }

    .sales-agents-table th {
        font-size: 13px;
        padding: 10px 10px; /* کاهش جزئی پدینگ برای جا شدن بهتر ستون‌ها */
    }

    .sales-agents-table td {
       font-size: 13px;
       padding: 12px 10px;
       word-break: break-word; /* بسیار مهم: شکستن آدرس‌های طولانی تا جدول را کش نیاورند */
    }
}

/* =========================================
   ریسپانسیو - موبایل (کارت‌های مدرن و حرفه‌ای)
   ========================================= */
@media (max-width: 767px) {
    .sales-agents-page {
        width: 100%;
        overflow-x: hidden;
    }

    .sales-agents-page .container {
        width: 86%;
        max-width: 100%;
        margin: 0 auto; /* وسط‌چین کردن مطمئن */
        padding: 0;
    }

    .sales-agents-section {
        padding: 12vh 0 6vh;
    }

    .sales-agents-heading {
        margin-bottom: 20px;
        text-align: right;
    }

    .sales-agents-heading h1 {
        font-size: 16px;
    }

    .sales-agents-heading p {
        font-size: 12px !important;
        line-height: 2;
        text-align: right;
    }



    /* پاک کردن محدودیت‌های رپر جدول */
    .sales-table-wrapper {
        width: 100%;
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .sales-agents-table thead {
        display: none; 
    }

    /* تغییر اساسی برای جدول: اطمینان از عرض ۱۰۰ درصد و بلاک شدن */
    .sales-agents-table {
        display: block; 
        width: 100% !important;
        min-width: 100% !important; 
    }
    
    .sales-agents-table tbody {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 20px;
    }

    .sales-agents-table tr {
        display: flex;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        padding: 14px;
        border: 1px solid rgba(23, 67, 31, 0.1);
        background-color: #ffffff;
        box-shadow: 0 4px 15px rgba(23, 67, 31, 0.05);
        border-radius: 12px;
        gap: 14px;
    }

    /* تنظیمات عمومی سلول‌ها */
    .sales-agents-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        width: 100% !important;
        box-sizing: border-box;
        min-height: auto;
        padding: 0;
        border: 0;
        text-align: right;
        font-size: 13px;
        line-height: 1.8;
    }

    /* استایل هدر کارت (نام فروشگاه) */
    .sales-agents-table tbody td:nth-child(1) {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        background-color: var(--primary-color, #D2E2CD);
        color: var(--secondary-color, #15371A);
        padding: 12px 15px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 700;
        text-align: center;
        margin-bottom: 5px;
    }
    
    .sales-agents-table td:nth-child(1)::before {
        content: none;
    }

    /* تنظیمات لیبل‌ها */
    .sales-agents-table td::before {
        color: var(--text-color-02, #4b6352);
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        margin-left: 15px;
        flex-shrink: 0;
    }

    .sales-agents-table td:nth-child(3) {
        justify-content: flex-start; /* از هم دورشون نمی‌کنه */
        gap: 5px; /* یک فاصله شیک بین کلمه "تلفن:" و خود شماره */
        direction: rtl; /* کانتینر رو راست‌چین نگه میداره */
    }
    
    /* برای اینکه خود شماره LTR بمونه */
    .sales-agents-table td:nth-child(3)::after {
        content: attr(data-phone); /* اگر از دیتا-اتریبیوت استفاده کرده بودیم */
    }

    .sales-agents-table td:nth-child(2)::before { content: "آدرس:"; margin-top: 2px; margin-left: 2px;}
    
    /* آپدیت: تنظیم تراز سلول تلفن برای چسبیدن لیبل و شماره */
    .sales-agents-table td:nth-child(3) { 
        justify-content: flex-start; 
        align-items: center; 
    }
    .sales-agents-table td:nth-child(3)::before { content: "تلفن:"; margin-top: 0; margin-left: 0;}
    
    /* آپدیت: تراز عمودی سلول لینک */
    .sales-agents-table td:nth-child(4) {
        align-items: center;
    }
    .sales-agents-table td:nth-child(4)::before { content: "لینک:"; align-self: center;}

    /* محتوای سلول‌ها */
    .sales-agent-address {
        text-align: right;
        padding: 0 3px;
        flex-grow: 1;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* آپدیت: استایل جدید شماره تلفن */
    .sales-agent-phone {
        text-align: right; /* چسبیدن به سمت راست */
        flex-grow: 0; /* عدم اشغال فضای اضافی */
        direction: ltr; /* حفظ ساختار درست شماره تلفن */
        font-size: 14px;
        font-weight: 600;
    }

    /* آپدیت: وسط‌چین کردن آیکون درون کانتینر لینک */
    .sales-agent-link {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(210, 226, 205, 0.3);
        border-radius: 8px;
        width: 40px;
        height: 40px;
    }
    
    /* آپدیت: تنظیم سایز دقیق آیکون لینک در صورت نیاز */
    .sales-agent-link img {
        width: 20px; /* سایز رو میتونی بسته به نیازت تغییر بدی */
        height: auto;
    }
    
    .sales-agents-table td:not(:first-child):not(:last-child) {
        border-bottom: 1px dashed rgba(23, 67, 31, 0.08);
        padding-bottom: 12px;
    }

}
