/* ═══════════════════════════════════════════════════════════════
   NebulaIran — Professional Immigration Dashboard Theme
   Light mode: dark blue accent (#1e3a8a)
   Dark mode: golden yellow accent (#f59e0b)
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary: #1e3a8a;
    --primary-light: #2563eb;
    --primary-glow: rgba(30, 58, 138, 0.18);
    --primary-hover: #1e40af;
    --accent: #1e3a8a;
    --success: #059669;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --info-bg: #dbeafe;
    --info-text: #1e40af;
    --bg: #f0f4f8;
    --bg-gradient: linear-gradient(160deg, #e8eef6 0%, #f0f4f8 40%, #e2e8f0 100%);
    --card: rgba(255, 255, 255, 0.78);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-hover: rgba(255, 255, 255, 0.92);
    --text: #0f172a;
    --text-muted: #64748b;
    --text-secondary: #475569;
    --sidebar-bg: rgba(255, 255, 255, 0.72);
    --sidebar-active: rgba(30, 58, 138, 0.08);
    --sidebar-active-text: #1e3a8a;
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-border: rgba(148, 163, 184, 0.35);
    --input-focus: #1e3a8a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(30, 58, 138, 0.12);
    --radius: 1rem;
    --radius-lg: 1.25rem;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
    --primary: #f59e0b;
    --primary-light: #fbbf24;
    --primary-glow: rgba(245, 158, 11, 0.15);
    --primary-hover: #d97706;
    --accent: #f59e0b;
    --success: #34d399;
    --success-bg: #064e3b;
    --success-text: #6ee7b7;
    --warning: #fbbf24;
    --warning-bg: #78350f;
    --warning-text: #fcd34d;
    --danger: #f87171;
    --danger-bg: #7f1d1d;
    --danger-text: #fca5a5;
    --info-bg: #1e3a5f;
    --info-text: #93c5fd;
    --bg: #0b1120;
    --bg-gradient: linear-gradient(160deg, #0b1120 0%, #111827 50%, #0f172a 100%);
    --card: rgba(17, 24, 39, 0.78);
    --card-border: rgba(148, 163, 184, 0.12);
    --card-hover: rgba(17, 24, 39, 0.92);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-secondary: #cbd5e1;
    --sidebar-bg: rgba(11, 17, 32, 0.88);
    --sidebar-active: rgba(245, 158, 11, 0.1);
    --sidebar-active-text: #fbbf24;
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(148, 163, 184, 0.2);
    --input-focus: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 24px rgba(245, 158, 11, 0.08);
}

/* ─── Base ─── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Auth Background ─── */
.auth-bg {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 30%, #2563eb 60%, #1e3a8a 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: authShimmer 20s ease-in-out infinite;
}

@keyframes authShimmer {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -1%) rotate(1deg); }
    66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

.dark .auth-bg {
    background: linear-gradient(135deg, #1a0f00 0%, #2d1600 30%, #451a03 60%, #1a0f00 100%);
}

.dark .auth-bg::before {
    background: radial-gradient(ellipse at 30% 20%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
}

/* ─── Glass Effects ─── */
.glass {
    background: var(--card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
}

.glass-card {
    background: var(--card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

/* ─── Dashboard Background ─── */
.dashboard-bg {
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

.glass-card {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.glass-card:nth-child(2) { animation-delay: 0.05s; }
.glass-card:nth-child(3) { animation-delay: 0.1s; }
.glass-card:nth-child(4) { animation-delay: 0.15s; }

/* ─── Input Fields ─── */
.input-field {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 0.75rem;
    border: 1.5px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.9375rem;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.dark .input-field {
    background: var(--input-bg);
    border-color: var(--input-border);
}

.input-field:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--card-hover);
}

.input-field:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: rgba(148, 163, 184, 0.08);
}

/* ─── Buttons ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    background: var(--card);
    border: 1.5px solid var(--card-border);
    color: var(--text);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    background: var(--danger);
    color: #fff;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }

.badge-gray {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.dark .badge-gray { background: rgba(148, 163, 184, 0.1); }

/* ─── Step Dots ─── */
.step-dot {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: default;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-dot:hover {
    transform: scale(1.1);
}

.step-dot.completed {
    background: var(--success);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.step-dot.completed:hover {
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.4);
}

.step-dot.current {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 0 0 4px var(--primary-glow), 0 4px 12px var(--primary-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}

.step-dot.future {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.dark .step-dot.future {
    background: rgba(148, 163, 184, 0.08);
}

/* ─── Step Lines ─── */
.step-line {
    flex: 1;
    height: 3px;
    background: rgba(148, 163, 184, 0.2);
    margin: 0 0.15rem;
    align-self: center;
    border-radius: 2px;
    transition: background 0.3s;
}

.step-line.done {
    background: var(--success);
}

/* ─── Sidebar ─── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.sidebar-link:hover {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    transform: translateX(-2px);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}

/* ─── Toast Notifications ─── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    background: var(--card);
    backdrop-filter: blur(16px);
    border: 1.5px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-weight: 500;
    animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Tables ─── */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-glass th,
.table-glass td {
    padding: 0.85rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--card-border);
    transition: background var(--transition);
}

.table-glass th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0;
    background: rgba(148, 163, 184, 0.06);
}

.table-glass tr:hover td {
    background: rgba(148, 163, 184, 0.04);
}

/* ─── Dark mode text overrides ─── */
.dark h1, .dark h2, .dark h3 {
    color: var(--text);
}

.dark .text-gray-500,
.dark .text-gray-600 {
    color: var(--text-muted) !important;
}

/* ─── Scrollbar Styling ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* ─── Notification Bell ─── */
.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── File Upload Zone ─── */
.file-upload-zone {
    border: 2px dashed var(--input-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    background: var(--input-bg);
}

.file-upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

/* ─── Responsive: Mobile Sidebar ─── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-mobile {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-left: 1px solid var(--card-border);
    z-index: 9001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
}
.sidebar-mobile.open {
    transform: translateX(0);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar-desktop { display: none !important; }
    .step-dot { width: 1.75rem; height: 1.75rem; font-size: 0.65rem; }
    .glass-card { animation-duration: 0.3s; }
    .glass-card.p-6 { padding: 1rem; }
    .glass-card.p-8 { padding: 1.25rem; }
    .glass-card.max-w-md { max-width: 100%; margin: 0.5rem; }
    .auth-bg .glass-card { margin: 0.5rem auto; max-width: calc(100vw - 1rem); }

    /* Inputs: touch-friendly */
    .input-field { padding: 0.6rem 0.75rem; font-size: 0.875rem; }

    /* File inputs: full width, touch-friendly */
    input[type="file"] {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.8125rem;
    }

    /* Buttons: full width in forms */
    .btn-primary, .btn-secondary, .btn-danger {
        font-size: 0.85rem;
        padding: 0.65rem 1rem;
        width: 100%;
    }
    /* ...except inline buttons in flex rows */
    .flex.gap-2 > .btn-primary,
    .flex.gap-2 > .btn-secondary,
    .flex.gap-2 > .btn-danger,
    .flex.gap-3 > .btn-primary,
    .flex.gap-3 > .btn-secondary,
    .flex.gap-3 > .btn-danger {
        width: auto;
        flex: 1;
    }

    /* Tables: horizontal scroll */
    .table-glass { display: block; }
    .table-glass thead { display: table; width: 100%; table-layout: fixed; }
    .table-glass tbody { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
    .table-glass tr { display: flex; }
    .table-glass th,
    .table-glass td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8125rem;
        flex: 0 0 auto;
    }
    .table-glass th:first-child { min-width: 3rem; }
    .table-glass td:first-child { min-width: 3rem; }

    /* Glass card overflow-x-auto scroll hint */
    .glass-card.overflow-x-auto { -webkit-overflow-scrolling: touch; }

    /* Badges: smaller on mobile */
    .badge { font-size: 0.6875rem; padding: 0.2rem 0.5rem; }

    /* Progress bar scroll */
    .glass-card .flex.items-center.min-w-max { padding-bottom: 0.5rem; }
}

@media (min-width: 769px) {
    .sidebar-overlay, .sidebar-mobile { display: none !important; }
}

/* ─── Selection Color ─── */
::selection {
    background: var(--primary);
    color: #fff;
}

/* ─── Focus Visible ─── */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
