/* ============================================================
   استایل جدول میلگرد بستر (msrt) – ابعاد ۱۳۹۰ در ۶۵
   نسخه بروزرسانی‌شده با تضمین وسط‌چین کامل
   ============================================================ */

/* ---------- فونت و تنظیمات پایه ---------- */
.msrt-container {
    font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', sans-serif;
    direction: rtl;
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    margin: 20px auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9edf4;
    max-width: 1390px;
    text-align: center;
}

/* ---------- کنترل‌های بالا ---------- */
.msrt-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.tab-content-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    justify-content: center;
    text-align: center;
}

.tab-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.tab-date {
    font-size: 0.9rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.msrt-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #334155;
    background: #ffffff;
    padding: 6px 16px 6px 12px;
    border-radius: 30px;
    border: 1px solid #dce2ec;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    justify-content: center;
}

.msrt-control-group label {
    cursor: pointer;
    user-select: none;
}

.msrt-vat-toggle {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
    margin-right: 4px;
}

/* ---------- جدول ---------- */
.msrt-table {
    width: 1390px;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.95rem;
    margin: 0 auto;
}

/* تنظیم ارتفاع هر ردیف (بدنه) به ۶۵px */
.msrt-table tbody tr {
    height: 65px;
    transition: background 0.15s;
    border-bottom: 1px solid #edf2f7;
}

.msrt-table tbody tr:last-child {
    border-bottom: none;
}

.msrt-table thead tr {
    height: 50px;
}

/* ---------- هدر جدول ---------- */
.msrt-table thead {
    background: #f1f5f9;
    border-bottom: 2px solid #dce2ec;
}

.msrt-table thead th {
    padding: 10px 20px !important;
    text-align: center !important;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 1px solid #e2e8f0;
    white-space: normal;
    word-break: break-word;
    height: 50px;
}

.msrt-table thead th:last-child {
    border-left: none;
}

.msrt-table thead th:hover {
    background: #e9edf4;
}

/* ---------- بدنه جدول ---------- */
.msrt-table tbody tr:hover {
    background: #f8fafc;
}

.msrt-table tbody td {
    padding: 12px 12px;
    vertical-align: middle;
    color: #1e293b;
    border-left: 1px solid #edf2f7;
    text-align: center !important;
}

.msrt-table tbody td:last-child {
    border-left: none;
}

/* ---------- اعداد قیمت ---------- */
.msrt-table tbody td .base-price,
.msrt-table tbody td .vat-price {
    font-weight: 500;
    font-feature-settings: "tnum";
    direction: ltr;
    display: inline;
}

/* ===== کلاس‌های کنترل VAT ===== */
.price-hidden {
    display: none !important;
}

.price-visible {
    display: inline !important;
}

/* ---------- ستون تغییرات ---------- */
.msrt-table tbody td:last-child span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: #f1f5f9;
    min-width: 70px;
    white-space: nowrap;
    margin: 0 auto;
    text-align: center !important;
}

.msrt-table tbody td:last-child span[style*="color: #28a745"] {
    background: #e6f9ed;
}
.msrt-table tbody td:last-child span[style*="color: #dc3545"] {
    background: #ffe9ec;
}
.msrt-table tbody td:last-child span[style*="color: #6c757d"] {
    background: #f1f3f5;
}

/* ---------- پیام خالی بودن جدول ---------- */
.msrt-table tbody td[colspan] {
    text-align: center !important;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 0.95rem;
    height: 65px;
}

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1440px) {
    .msrt-table {
        width: 100%;
        min-width: 780px;
    }
    .msrt-table tbody tr {
        height: 55px;
    }
    .msrt-table tbody td {
        height: 55px;
        padding: 6px 10px;
    }
    .msrt-table thead tr {
        height: 45px;
    }
    .msrt-table thead th {
        height: 45px;
        padding: 10px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 820px) {
    .msrt-table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    .msrt-table tbody tr {
        height: 50px;
    }
    .msrt-table tbody td {
        height: 50px;
        padding: 5px 8px;
    }
    .msrt-table thead tr {
        height: 40px;
    }
    .msrt-table thead th {
        height: 40px;
        padding: 8px 8px;
        font-size: 0.75rem;
    }
    .msrt-table tbody td:last-child span {
        font-size: 0.8rem;
        min-width: 60px;
        padding: 1px 6px;
    }
    .msrt-container {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .msrt-table {
        min-width: 500px;
        font-size: 0.75rem;
    }
    .msrt-table tbody tr {
        height: 44px;
    }
    .msrt-table tbody td {
        height: 44px;
        padding: 4px 6px;
    }
    .msrt-table thead tr {
        height: 36px;
    }
    .msrt-table thead th {
        height: 36px;
        padding: 6px 6px;
        font-size: 0.65rem;
    }
    .msrt-table tbody td:last-child span {
        font-size: 0.7rem;
        min-width: 50px;
        padding: 1px 4px;
    }
    .msrt-container {
        padding: 8px;
    }
    .msrt-controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .msrt-control-group {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- حالت چاپ ---------- */
@media print {
    .msrt-container {
        max-width: 100% !important;
        box-shadow: none;
        border: 1px solid #ccc;
        padding: 10px;
    }
    .msrt-table {
        width: 100% !important;
        min-width: unset !important;
    }
    .msrt-control-group {
        display: none !important;
    }
    .msrt-table thead th {
        background: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .msrt-table tbody tr:hover {
        background: inherit !important;
    }
    .msrt-table tbody td:last-child span {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

