/* =====================================================
   تم Premium نهایی – یکپارچه و هماهنگ با تمام صفحات
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700;14..32,800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, sans-serif;
    background: radial-gradient(circle at 10% 20%, #f8fafd, #eef2f8);
    color: #1e293b;
    direction: rtl;
    text-align: right;
    line-height: 1.5;
    font-size: 0.9375rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

/* اسکرول اختصاصی */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #eef2fa; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #bac8dc; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #8f9bb3; }

/* کانتینر اصلی با فاصله از لبه‌ها */
.container, .main-content .container, .main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

@media (max-width: 768px) {
    .container, .main-content .container, .main-content {
        padding: 0 16px;
    }
}

/* ========== کارت‌های مدرن ========== */
.card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(2px);
    border-radius: 32px;
    box-shadow: 0 20px 35px -14px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.35s ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 45px -16px rgba(0, 0, 0, 0.12);
}
.card-header {
    padding: 18px 28px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
    font-weight: 700;
    font-size: 1.1rem;
    color: #0f2b3d;
}
.card-body {
    padding: 28px;
}

/* ========== هدر ویژه صفحات (تیکت و ...) ========== */
.ticket-header {
    background: linear-gradient(135deg, #16244c, #1e3268, #141e46);
    color: white;
    padding: 34px 24px;
    border-radius: 44px;
    margin-bottom: 36px;
    text-align: center;
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.ticket-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ========== کارت‌های آمار ========== */
.stats {
    display: flex;
    gap: 24px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}
.stat-card {
    flex: 1;
    min-width: 140px;
    background: white;
    padding: 24px 16px;
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    transition: all 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.03);
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.1);
}
.stat-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5b6e8c;
}
.stat-card .number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(145deg, #1e2b5c, #2d3b7c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ========== دکمه‌های عمومی ========== */
.btn, .btn-sm, .btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-info, .btn-success {
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1) !important;
    transform: translateY(0);
}
.btn:hover, .btn-primary:hover, .btn-secondary:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover, .btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}
.btn-primary {
    background: linear-gradient(105deg, #1f2b5c, #283779);
    color: white;
}
.btn-secondary {
    background: #f0f4fc;
    color: #1f2b5c;
    border: 1px solid #dee4ef;
}
.btn-success { background: #10b981; color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-info { background: #3b82f6; color: white; }
.btn-sm { padding: 6px 16px; font-size: 0.75rem; border-radius: 40px; }
.btn-group { display: flex; gap: 16px; margin-top: 32px; flex-wrap: wrap; }
.btn-pdf { background: #dc2626; color: white; border-radius: 48px; padding: 8px 22px; }
.btn-pdf:hover { background: #b91c1c; }
.btn-delete { background: none; border: none; color: #ef4444; cursor: pointer; }
.btn-delete:hover { color: #b91c1c; transform: scale(1.1); }
.btn-danger-sm { background: #ef4444; padding: 4px 14px; border-radius: 40px; font-size: 0.7rem; }

/* ========== جداول ========== */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 28px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: #ffffff;
}
.table th, .table td {
    padding: 14px 16px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #e9edf4;
}
.table th {
    background: #f7faff;
    color: #1f2b5c;
    font-weight: 700;
    border-bottom-width: 2px;
    border-bottom-color: #dce5ef;
    white-space: nowrap;
}
.table tr:hover td {
    background: #fafdff;
}

/* ========== نشانگر وضعیت ========== */
.status-badge, .badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 60px;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
}
.status-open, .badge-pending {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}
.status-answered, .badge-approved {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.status-closed, .badge-rejected {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.badge-warning { background: #ffedd5; color: #9a3412; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #334155; }

/* ========== فرم‌ها ========== */
.form-group {
    margin-bottom: 24px;
}
.form-group label {
    display: block;
    
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: 28px;
    font-size: 0.85rem;
    background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.form-row .form-group {
    flex: 1;
    min-width: 100px;
}
.time-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-direction: row-reverse;
}
.time-number { flex: 1; }
.time-number input { text-align: center; }
.time-sep { font-size: 1.2rem; font-weight: 700; color: #94a3b8; }
.time-label { font-size: 0.7rem; color: #64748b; margin-top: 6px; text-align: center; }

/* ========== جزئیات تیکت ========== */
details {
    background: #fafcff;
    border-radius: 24px;
    padding: 8px 14px;
    border: 1px solid #eef2f8;
}
details summary {
    cursor: pointer;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.8rem;
}
.ticket-detail {
    background: white;
    padding: 20px;
    margin-top: 12px;
    border-radius: 24px;
    border-right: 3px solid #3b82f6;
}
.reply-form {
    margin-top: 18px;
    background: #fff;
    border-radius: 28px;
    padding: 20px;
    border: 1px solid #eef2f8;
}
.reply-form textarea, .reply-form select { width: 100%; margin-bottom: 15px; border-radius: 24px; }
.reply-form button { background: #10b981; border-radius: 48px; }
.closed-notice {
    background: #fee2e2;
    padding: 14px;
    border-radius: 24px;
}

/* ========== هشدارها ========== */
.alert {
    padding: 14px 22px;
    border-radius: 32px;
    margin-bottom: 24px;
    font-weight: 500;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 5px solid #10b981; }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 5px solid #ef4444; }
.alert-warning { background: #ffedd5; color: #9a3412; border-left: 5px solid #f59e0b; }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 5px solid #3b82f6; }

/* ========== پیش‌نمایش فایل ========== */
.preview-box {
    background: #f8fafc;
    border-radius: 28px;
    padding: 18px;
    border: 1px solid #e2e8f0;
}
.file-info {
    background: #eef2ff;
    padding: 12px 18px;
    border-radius: 24px;
    margin-bottom: 16px;
}

/* ========== نوتیفیکیشن تیکت (نسخه جدید) ========== */
.ticket-notif-wrapper {
    position: relative;
    display: inline-block;
}
.ticket-notif-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 10;
}
@media (max-width: 768px) {
    .ticket-notif-badge {
        top: 0px;
        right: 5px;
    }
}

/* ========== لاگین ========== */
.login-container {
    max-width: 480px;
    margin: 12vh auto;
}
.login-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-radius: 56px;
    padding: 48px 42px;
    box-shadow: 0 30px 50px -20px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.7);
}
.login-card h2 { font-size: 1.8rem; font-weight: 800; }
.password-wrapper { position: relative; }
.toggle-password {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
}
[dir="rtl"] .toggle-password { left: auto; right: 20px; }

/* ========== فوتر ========== */
.site-footer {
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 50px;
    padding: 24px 20px;
    text-align: center;
    font-size: 0.8rem;
    color: #5b6e8c;
    font-weight: 500;
}
.site-footer a {
    color: #4361ee;
    text-decoration: none;
    transition: color 0.2s;
}
.site-footer a:hover {
    color: #1e2b5c;
    text-decoration: underline;
}

/* ========== صفحه‌بندی DataTable ========== */
.dataTables_paginate {
    margin-top: 20px;
    text-align: left;
}
.dataTables_paginate .paginate_button {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    margin: 0 0.2rem;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #0d6efd;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.dataTables_paginate .paginate_button:hover {
    background-color: #e9ecef;
    border-color: #c0c5ca;
    color: #0a58ca;
}
.dataTables_paginate .paginate_button.current {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
    box-shadow: 0 2px 4px rgba(13,110,253,0.2);
}
.dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
}
.dataTables_paginate .paginate_button.previous,
.dataTables_paginate .paginate_button.next {
    font-weight: bold;
}

/* ========== استایل هدر مدرن (جایگزین نهایی) ========== */
.my-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 10px 24px;
    margin-bottom: 28px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}
.my-brand {
    font-weight: 800;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #1e2b5c, #2a3d7e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
    display: inline-block;
}
.my-nav-link {
    color: #1e293b;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 40px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.my-nav-link:hover {
    background: rgba(67, 97, 238, 0.12);
    color: #4361ee;
    transform: translateY(-2px);
}
.my-dropdown-menu {
    position: absolute;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    min-width: 200px;
    z-index: 1000;
    margin-top: 5px;
}
.my-dropdown-item {
    display: block;
    padding: 8px 20px;
    color: #1e293b;
    text-decoration: none;
    border-radius: 12px;
    margin: 3px 8px;
}
.my-dropdown-item:hover {
    background: #f0f4fc;
}
.my-logout {
    background: #ef4444;
    color: white;
    border-radius: 40px;
    padding: 6px 22px;
    font-weight: 600;
    border: none;
    text-decoration: none;
    display: inline-block;
}
.my-logout:hover {
    background: #dc2626;
    transform: translateY(-2px);
    color: white;
}
.my-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.my-relative {
    position: relative;
    display: inline-block;
}
.my-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.toggler-btn {
    background: none;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 8px;
    display: none;
}
@media (max-width: 992px) {
    .toggler-btn {
        display: block;
    }
    .my-flex {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 15px;
    }
    .my-flex.show {
        display: flex;
    }
    .my-nav-link {
        width: 100%;
        text-align: center;
    }
    .my-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid #eee;
        margin-top: 5px;
    }
}

/* اعمال حاشیه به همه صفحات ادمین بدون تغییر در HTML */
.main-content > :not(.modern-navbar):not(.my-header) {
    margin-left: 24px;
    margin-right: 24px;
}
/* برای المان‌های داخل کارت‌ها که ممکن است تحت تأثیر قرار گیرند */
.card {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ========== ریسپانسیو نهایی ========== */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    .card-header, .card-body {
        padding: 18px;
    }
    .ticket-header {
        padding: 24px 16px;
        border-radius: 32px;
    }
    .ticket-header h1 {
        font-size: 1.4rem;
    }
    .stats {
        flex-direction: column;
    }
    .btn-group {
        flex-direction: column;
    }
    .btn-group .btn {
        width: 100%;
        justify-content: center;
    }
    .table th, .table td {
        padding: 10px 8px;
        font-size: 0.75rem;
    }
    .form-row {
        flex-direction: column;
    }
    .time-input-group {
        flex-direction: row-reverse;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 1200px;
    }
}

@media print {
    *, *::before, *::after {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
    }
    body {
        background: white;
    }
    .btn, .site-footer, .btn-group, .btn-pdf, .notif-wrapper, .ticket-notif-wrapper {
        display: none !important;
    }
}