﻿
body {
    font-family: 'IRANSans', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f8f9fa;
    color: #2c3e50;
    padding: 15px;
}

.card {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: none;
    margin-bottom: 20px;
}

/* فرم فیلتر */
#filterForm {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 20px;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-select {
    min-width: 180px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

    .form-select:focus {
        border-color: #4dabf7;
        box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2);
    }

/* دکمه‌ها */
.btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%);
    border: none;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(58, 123, 213, 0.3);
    }

/* حالت‌های خاص */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

    .loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        border: 2px solid #f3f3f3;
        border-top: 2px solid #3498db;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}



/* استایل‌های اضافی */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background-color: #28a745;
}

.toast-error {
    background-color: #dc3545;
}

.toast-info {
    background-color: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* استایل برای select در حالت hover */
.shift-select:hover {
    border-color: #0d6efd;
    background-color: #f8f9fa;
}

.holiday-col {
    background-color: #ffe5e5 !important;
    color: #c62828 !important;
    font-weight: 600;
}

    .holiday-col small {
        color: #c62828;
    }

.friday-col {
    background-color: #fff3cd !important;
    color: #856404 !important;
}
/* ─── جمعه — قرمز ─── */
.program-table th.friday-col,
.program-table td.friday-col,
th.friday-col,
td.friday-col {
    background-color: #ffe5e5 !important;
    color: #c62828 !important;
    font-weight: 600;
}

    .program-table th.friday-col small,
    .program-table td.friday-col small,
    th.friday-col small,
    td.friday-col small {
        color: #c62828;
    }

/* ─── تعطیلات رسمی — زرد ─── */
.program-table th.holiday-col,
.program-table td.holiday-col,
th.holiday-col,
td.holiday-col {
    background-color: #fff3cd !important;
    color: #856404 !important;
    font-weight: 600;
}

    .program-table th.holiday-col small,
    .program-table td.holiday-col small,
    th.holiday-col small,
    td.holiday-col small {
        color: #856404;
    }
/* ═══════════════════════════════════════════════════════════════
   ✅ FINAL FIX — حذف اسکرول + رفع تداخل + hide صحیح
   ═══════════════════════════════════════════════════════════════ */

/* ─── Container: قفل شده در ۱۰۰٪ ─── */
.table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ─── جدول: fixed در ۱۰۰٪ ─── */
.program-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

    /* ─── همه سلول‌ها: overflow مدیریت‌شده ─── */
    .program-table th,
    .program-table td {
        padding: 2px 1px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
    }

    /* ─── ستون‌های ثابت: عرض ثابت و دقیق ─── */
    .program-table .fixed-col {
        width: 26px !important;
        font-size: 10px !important;
    }

    .program-table .fixed-col-2 {
        width: 95px !important;
        font-size: 10.5px !important;
        padding-right: 4px !important;
        text-align: right !important;
    }

    .program-table .fixed-col-3 {
        width: 42px !important;
        font-size: 9.5px !important;
    }

    .program-table .fixed-col-4 {
        width: 42px !important;
        font-size: 9.5px !important;
    }

    .program-table .fixed-col-5 {
        width: 50px !important;
        font-size: 9.5px !important;
    }

    /* ─── ستون‌های جمع (صبح/عصر/شب/ماموریت) ─── */
    .program-table th.shift-total,
    .program-table td.shift-total {
        width: 34px !important;
        font-size: 9.5px !important;
    }

    /* ─── ستون «تعداد شیفت‌ها» — متن دو خطی ─── */
    .program-table th[rowspan="2"]:not(.fixed-col):not(.fixed-col-2) {
        width: 38px !important;
        font-size: 9px !important;
        white-space: normal !important;
        line-height: 1.1 !important;
        word-break: break-word !important;
    }

    /* ─── ستون‌های روز: توزیع خودکار باقی‌مانده ─── */
    .program-table td[data-day] {
        width: auto !important;
        font-size: 10px !important;
    }

    .program-table thead th:not(.fixed-col):not(.fixed-col-2):not(.fixed-col-3):not(.fixed-col-4):not(.fixed-col-5):not(.shift-total):not([rowspan]) {
        width: auto !important;
        font-size: 9px !important;
    }

    /* ─── select داخل سلول ─── */
    .program-table select.shift-select {
        font-size: 10px !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* ─── ردیف جمع ─── */
    .program-table .totals-row td {
        font-size: 9px !important;
        line-height: 1.3 !important;
        padding: 2px 1px !important;
    }

        .program-table .totals-row td.fixed-col-2 {
            font-size: 10px !important;
        }

    /* ═══════════════════════════════════════════════════════════════
   ✅ حالت Hide — ستون‌ها واقعاً حذف می‌شوند
   ═══════════════════════════════════════════════════════════════ */

    .program-table.hide-extra-cols .extra-col,
    table.hide-extra-cols .extra-col,
    .hide-extra-cols .extra-col {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
    }

    /* ─── در حالت hide، نام پهن‌تر ─── */
    .program-table.hide-extra-cols .fixed-col-2 {
        width: 150px !important;
        font-size: 11px !important;
    }

/* ─── اسکرول فقط روی موبایل ─── */
@media (max-width: 1100px) {
    .table-container {
        overflow-x: auto !important;
    }
}