/* ========================================
   PnuSugHub — Design System (RTL/Persian)
   ======================================== */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #4f46e5;

    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --wave-bg: #dbf5ed;
    --wave-fill: #c7ebe2;
    --body-bg: #c7ebe2;

    --font: 'Vazirmatn', Tahoma, Arial, sans-serif;
    --transition: all .2s ease;
}

/* ======== Dark Mode ======== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-sidebar: #0a0f1e;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #4f46e5;

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #475569;
    --text-muted: #64748b;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;

    --border: #334155;
    --border-light: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.25);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.45), 0 4px 6px rgba(0,0,0,.3);

    --wave-bg: #0a1628;
    --wave-fill: #0f172a;
    --body-bg: #172030;
}

/* ---- Import Vazirmatn font (local) ---- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
    font-size: 14px;
}
body {
    font-family: var(--font);
    background: transparent;
    color: var(--text);
    direction: rtl;
    line-height: 1.7;
    min-height: 100vh;
    /* اعداد فارسی (برای فونت‌هایی که ss02 پشتیبانی می‌کنند) */
    font-feature-settings: 'ss02';
}
/* پس‌زمینه اصلی — z-index:-2 تا موج‌ها (z-index:-1) روش دیده بشن */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--body-bg);
    z-index: -2;
    transition: background .3s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---- Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
    border-left: 1px solid rgba(255,255,255,.1);
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: center;
}
.sidebar-logo-img {
    display: block;
    max-width: 120px;
    height: auto;
    margin: 0 auto 4px;
    filter: brightness(0) invert(1);
}
.sidebar-header small {
    color: var(--text-light);
    font-size: 11px;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

/* مخفی کردن اسکرول‌بار */
.sidebar-nav {
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
    display: none;
}

/* نشانگر فید + فلش پایین */
.sidebar-nav-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-nav-wrap .sidebar-nav {
    flex: 1;
    height: 100%;
}
.sidebar-nav-wrap::after {
    content: '\25BE';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: linear-gradient(to bottom, transparent, rgba(15,23,42,0.92));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 6px;
    color: rgba(255,255,255,0.55);
    font-size: 20px;
    pointer-events: none;
    transition: opacity 0.25s;
    opacity: 1;
}
.sidebar-nav-wrap.at-bottom::after {
    opacity: 0;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13.5px;
    transition: var(--transition);
    border-radius: 0;
}
.sidebar-nav a:hover {
    background: var(--bg-sidebar-hover);
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
}
.sidebar-nav a .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}
.sidebar-nav .nav-section {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    font-weight: 700;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}
.sidebar-user .info {
    flex: 1;
    min-width: 0;
}
.sidebar-user .info .name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .info .role {
    font-size: 11px;
    color: var(--text-light);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-right: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-content {
    flex: 1;
    padding: 28px;
}

/* ---- Login Page ---- */
/* ---- Waves Background ---- */
.waves-header {
    position: fixed;
    width: 100%;
    bottom: 0;
    left: 0;
    height: 100vh;
    background-color: var(--wave-bg);
    z-index: -1;
    transition: background-color .3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.waves-inner-header {
    flex: 1;
    width: 100%;
}
.waves {
    position: relative;
    width: 100%;
    height: 35vh;
    margin-bottom: -8px;
    min-height: 180px;
    max-height: 320px;
}
.parallax > use {
    animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
    transform-box: fill-box;
    transform-origin: center;
    will-change: transform;
}
.parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 4s; opacity: 0.2; }
.parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 7s; opacity: 0.4; }
.parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 10s; opacity: 0.6; }
.parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 13s; }
@keyframes move-forever {
    0% { transform: translate3d(-90px, 0, 0); }
    100% { transform: translate3d(85px, 0, 0); }
}
@media (max-width: 768px) {
    .waves { height: 40px; min-height: 40px; }
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: transparent;
    position: relative;
    z-index: 1;
}
.login-card {
    background: #fff;
    border-radius: 2rem;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: none;
    text-align: center;
    transition: all 0.3s;
    animation: loginCardIn 0.5s both;
    position: relative;
}
.login-help-btn {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s;
    line-height: 1;
    font-family: inherit;
}
.login-help-btn:hover {
    color: var(--primary, #6366f1);
}
.login-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
@keyframes loginCardIn {
    from { transform: translateY(5rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.login-card .logo {
    margin-bottom: 12px;
}
.login-card .logo img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}
.login-logo-img {
    display: block;
    max-width: 140px;
    height: auto;
    margin: 0 auto 4px;
}
.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 32px;
}
.login-card .form-group {
    margin-bottom: 18px;
    text-align: right;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
}
.card-body {
    padding: 22px;
}

/* Two-column form grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.form-grid .form-group-full {
    grid-column: 1 / -1;
}

/* Radio button groups for scoring */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
}
.radio-option:hover {
    border-color: var(--primary-light);
    background: var(--bg-card);
}
.radio-option input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(79,70,229,.15);
}
/* حالت فقط خواندنی (داوری ثبت‌شده) */
.radio-option--readonly {
    cursor: default;
    opacity: 0.7;
}
.radio-option--readonly:hover {
    border-color: var(--border);
    background: var(--bg);
}
.radio-option--readonly input[type="radio"] {
    pointer-events: none;
}
.radio-label {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}
.radio-score {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
    background: rgba(79,70,229,.08);
    padding: 3px 10px;
    border-radius: 20px;
}
.index-score-display {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--success);
    font-weight: 600;
    min-height: 20px;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    background: var(--bg-card);
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.stat-card .stat-icon.blue { background: var(--info-light); }
.stat-card .stat-icon.green { background: var(--success-light); }
.stat-card .stat-icon.yellow { background: var(--warning-light); }
.stat-card .stat-icon.red { background: var(--danger-light); }
.stat-card .stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.stat-card .stat-info p {
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-input);
    transition: var(--transition);
    direction: rtl;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.18);
    background: var(--bg-input);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: none; cursor: pointer; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 16px;
    text-align: right;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}
tr:hover td { background: var(--bg); }
tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-primary { background: rgba(79,70,229,.1); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #f1f5f9; color: var(--text-secondary); }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    transform: scale(.9);
    transition: transform .2s ease;
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--info-light); color: #075985; }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    animation: slideIn .3s ease;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Loading ---- */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h4 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.pagination button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}
.pagination button:hover { background: var(--bg); }
.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Suggestion Detail ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.detail-item label {
    font-size: 11.5px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}
.detail-item .value {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}
.detail-full { grid-column: 1 / -1; }

/* ---- Status Flow ---- */
.status-flow {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.status-step {
    display: flex;
    align-items: center;
    gap: 4px;
}
.status-step .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}
.status-step.done .dot { background: var(--success); }
.status-step.current .dot { background: var(--primary); animation: pulse 1.5s infinite; }
.status-step .line {
    width: 24px;
    height: 2px;
    background: var(--border);
}
.status-step.done .line { background: var(--success); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ---- Mobile Toggle ---- */
.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .main-content { margin-right: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .login-card { margin: 16px; padding: 32px 24px; }
    .card-body { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group label { font-size: 13px; }
}

/* ========================================
   Theme Selector (3-option)
   ======================================== */
.theme-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    transition: var(--transition);
    min-width: 90px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font);
}
.theme-option:hover {
    border-color: var(--primary-light);
    color: var(--text);
}
.theme-option.active {
    border-color: var(--primary);
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.theme-option .theme-icon {
    font-size: 24px;
}

/* ======== Dark theme overrides ======== */
[data-theme="dark"] .parallax > use:nth-child(1) { fill: rgba(30,100,180,0.12); }
[data-theme="dark"] .parallax > use:nth-child(2) { fill: rgba(30,100,180,0.15); }
[data-theme="dark"] .parallax > use:nth-child(3) { fill: rgba(30,100,180,0.18); }
[data-theme="dark"] .parallax > use:nth-child(4) { fill: var(--wave-fill); }
[data-theme="dark"] .modal-close {
    background: var(--bg-sidebar-hover);
    color: var(--text-secondary);
}
[data-theme="dark"] .badge-secondary {
    background: var(--bg-sidebar-hover);
    color: var(--text-secondary);
}
[data-theme="dark"] th {
    background: var(--bg-card);
}
[data-theme="dark"] .pagination button {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .pagination button:hover {
    background: var(--bg-sidebar-hover);
}
[data-theme="dark"] .btn-outline {
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .btn-outline:hover {
    background: var(--bg-sidebar-hover);
}
[data-theme="dark"] .login-card {
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .loading-overlay {
    background: rgba(15,23,42,.85);
}
[data-theme="dark"] .tabs {
    border-bottom-color: var(--border);
}
[data-theme="dark"] .tab {
    color: var(--text-secondary);
}
[data-theme="dark"] .tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}
[data-theme="dark"] select.form-control option {
    background: var(--bg-card);
    color: var(--text);
}

/* ---- SweetAlert2 scrollbar-shift fix ---- */
/* scrollbar-gutter: stable reserves space for the scrollbar so it never disappears */
html, body { scrollbar-gutter: stable; }
/* Prevent Swal from adding padding-right compensation (handled by scrollbarPadding:false in JS) */
body.swal2-shown { overflow: hidden !important; padding-right: 0 !important; }
/* Swal container should not shift either */
.swal2-container { padding-right: 0 !important; }

/* ---- SweetAlert2 Rounded Corners ---- */
.swal2-popup {
    border-radius: var(--radius-lg) !important;
    font-family: var(--font) !important;
    direction: rtl !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}
.swal2-popup .swal2-title {
    font-family: var(--font) !important;
    font-size: 18px !important;
}
.swal2-popup .swal2-html-container {
    font-family: var(--font) !important;
    font-size: 14px !important;
}
.swal2-popup .swal2-styled {
    border-radius: var(--radius) !important;
    font-family: var(--font) !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
}
.swal2-popup .swal2-input,
.swal2-popup .swal2-textarea,
.swal2-popup .swal2-select {
    border-radius: var(--radius-sm) !important;
    font-family: var(--font) !important;
}
.swal2-popup .swal2-validation-message {
    border-radius: var(--radius-sm) !important;
    font-family: var(--font) !important;
}

/* ---- Validation States ---- */
.form-control.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
}
.form-control.is-valid {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .15) !important;
}
/* Prevent green/red on focus override */
.form-control.is-invalid:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .25) !important;
}
.form-control.is-valid:focus {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .25) !important;
}

/* ---- SweetAlert2 Animations ---- */
@keyframes swalBounceIn {
    0% { transform: scale(0.3) translateY(40px); opacity: 0; }
    45% { transform: scale(1.06) translateY(-10px); opacity: 1; }
    70% { transform: scale(0.96) translateY(3px); }
    85% { transform: scale(1.02) translateY(-1px); }
    100% { transform: scale(1) translateY(0); }
}
@keyframes swalFadeOut {
    to { transform: scale(0.85); opacity: 0; }
}
@keyframes swalBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes swalBackdropOut { from { opacity: 1; } to { opacity: 0; } }
.swal-animate-in {
    animation: swalBounceIn .5s cubic-bezier(.34, 1.56, .64, 1) !important;
}
.swal-animate-out {
    animation: swalFadeOut .2s ease-out forwards !important;
}
.swal-backdrop-in {
    animation: swalBackdropIn .3s ease !important;
}
.swal-backdrop-out {
    animation: swalBackdropOut .2s ease !important;
}

/* ---- Numeric inputs with Vazirmatn ---- */
input[inputmode="numeric"],
input[data-numeric] {
    font-family: var(--font) !important;
    font-weight: 400;
}

/* ---- Resume modal close button ---- */
.resume-modal-close {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(0,0,0,0.6) !important;
    color: #fff !important;
    font-size: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background .2s !important;
    z-index: 10 !important;
    border: none !important;
    cursor: pointer !important;
}
.resume-modal-close:hover {
    background: rgba(220,38,38,0.85) !important;
    color: #fff !important;
}

/* ---- Drop zone hover ---- */
#resumeDropZone:hover {
    border-color: var(--primary) !important;
    background: rgba(99,102,241,0.04) !important;
}
