@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* =============================================
   DESIGN SYSTEM - CBT Smansal (Premium Edition)
   ============================================= */

:root {
    --primary: #1e40af;
    /* Deep Blue from Login */
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #0f172a;
    --accent: #6366f1;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-header: rgba(255, 255, 255, 0.8);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-muted: #cbd5e1;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-focus: #3b82f6;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --sidebar-w: 280px;
    --header-h: 72px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   RESET & BASE
   ============================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =============================================
   LAYOUT
   ============================================= */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Premium LMS Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.sidebar-brand {
    padding: 35px 28px;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-brand .logo-box {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
    width: 32px;
    height: auto;
}

.sidebar-brand .brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.sidebar-brand .brand-tag {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    display: block;
    margin-top: 2px;
}

.sidebar-user-premium {
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    margin: 0 15px 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar-wrap {
    position: relative;
}

.user-avatar-main {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.status-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    position: absolute;
    bottom: -2px;
    right: -2px;
    border: 3px solid #0f172a;
}

.user-meta {
    overflow: hidden;
}

.user-name-premium {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-premium {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.sidebar-scroll {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 15px;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav-group {
    margin-bottom: 25px;
}

.nav-group-label {
    padding-left: 15px;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 1.5px;
}

.nav-link-premium {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
}

.nav-link-premium i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform 0.2s;
}

.nav-link-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link-premium:hover i {
    transform: scale(1.1);
}

.nav-link-premium.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.02) 100%);
    color: var(--primary-light);
    position: relative;
}

.nav-link-premium.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    background: var(--primary-light);
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 10px var(--primary-light);
}

.sidebar-footer-premium {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    color: #ef4444;
    font-weight: 700;
    font-size: 14px;
    background: rgba(239, 68, 68, 0.05);
    transition: all 0.3s;
}

.logout-link:hover {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

/* --- Main Content Adjustment --- */
.main-content {
    margin-left: var(--sidebar-w);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-h);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-header .page-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.content-wrap {
    padding: 28px;
    flex: 1;
}

/* --- Premium Dashboard Layout Overrides --- */

[data-page="dashboard"] .content-wrap {
    padding: 0 40px 40px 40px;
    margin-top: 0;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    [data-page="dashboard"] .content-wrap {
        padding: 0 16px 20px 16px !important;
    }
    
    [data-page="dashboard"] .glass-card,
    [data-page="dashboard"] .card,
    [data-page="dashboard"] .stat-card {
        padding: 20px !important;
    }
    
    [data-page="dashboard"] .dashboard-header-wah h1 {
        font-size: 24px !important;
    }
}

[data-page="dashboard"] .main-content {
    background: #f8fafc;
    justify-content: flex-start !important;
    padding-top: 0 !important;
}

[data-page="dashboard"] .dashboard-header-wah {
    margin-top: 0 !important;
}

/* =============================================
   COMPONENTS: Cards
   ============================================= */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.card-body {
    padding: 28px;
}

.card-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

/* =====================================================
   WAH ALERT & PREMIUM MODALS
===================================================== */
.wah-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.wah-alert-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wah-alert {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 28px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wah-alert-overlay.active .wah-alert {
    transform: scale(1);
}

.wah-alert-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 25px auto;
}

.wah-alert-icon.danger {
    background: #fee2e2;
    color: #ef4444;
}

.wah-alert-icon.warning {
    background: #fef3c7;
    color: #f59e0b;
}

.wah-alert-icon.success {
    background: #dcfce7;
    color: #10b981;
}

.wah-alert-title {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 12px;
}

.wah-alert-msg {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.wah-alert-actions {
    display: flex;
    gap: 12px;
}

.wah-alert-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.wah-alert-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.wah-alert-btn-confirm {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
}

.wah-alert-btn-confirm.danger {
    background: #ef4444;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.2);
}

.wah-alert-btn:active {
    transform: scale(0.95);
}

/* Stat Cards (Premium Gradients) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 100% 0%, var(--gradient-color, transparent) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.stat-icon.blue {
    background: #eff6ff;
    color: #1d4ed8;
    --gradient-color: #3b82f6;
}

.stat-icon.green {
    background: #f0fdf4;
    color: #059669;
    --gradient-color: #10b981;
}

.stat-icon.orange {
    background: #fff7ed;
    color: #d97706;
    --gradient-color: #f59e0b;
}

.stat-icon.purple {
    background: #f5f3ff;
    color: #7c3aed;
    --gradient-color: #8b5cf6;
}

.stat-info .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
}

.stat-info .stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* =============================================
   COMPONENTS: Buttons
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 8px 16px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--text-light);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-success:hover {
    background: #047857;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* =============================================
   COMPONENTS: Forms
   ============================================= */

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 600;
}

/* =====================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
===================================================== */

/* --- Mobile Toggle Button --- */
.menu-toggle {
    display: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.menu-toggle:active {
    transform: scale(0.9);
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 280px;
    }

    .menu-toggle {
        display: flex;
    }

    .sidebar {
        left: calc(-1 * var(--sidebar-w));
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        padding: 15px 20px;
    }

    .content-wrap {
        padding: 20px;
    }

    /* Dashboard Grid Adjustments */
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .chart-container-wah {
        height: 300px;
    }
}

/* --- Dashboard Responsive Utilities --- */
.dashboard-header-wah {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

.stat-grid-wah {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.analytics-grid-wah {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 24px;
    margin-bottom: 32px;
}

.bottom-grid-wah {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-header-wah {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .dashboard-header-wah>div:last-child {
        text-align: left;
    }

    .stat-grid-wah {
        grid-template-columns: 1fr;
    }

    .analytics-grid-wah {
        grid-template-columns: 1fr;
    }

    .bottom-grid-wah {
        grid-template-columns: 1fr;
    }

    .bottom-grid-wah>.glass-card:first-child {
        grid-column: span 1;
    }
}

@media (max-width: 640px) {
    .stat-value-big {
        font-size: 32px;
    }
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group .form-control {
    padding-left: 48px;
}

.input-group .input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-light);
    font-size: 20px;
    pointer-events: none;
}

/* Radio & Checkbox */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    border-color: var(--primary-light);
    background: #eff6ff;
}

.option-item.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.option-item label {
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
}

/* =============================================
   COMPONENTS: Tables
   ============================================= */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8fafc;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* =============================================
   COMPONENTS: Badges & Alerts
   ============================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(29, 78, 216, 0.1);
}

.badge-success {
    background: #f0fdf4;
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.1);
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.1);
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.badge-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid var(--border);
}

.badge-info {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.1);
}

.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #075985;
}

/* =============================================
   COMPONENTS: Modal
   ============================================= */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 36px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-lg {
    max-width: 820px;
}

@keyframes modalIn {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* =============================================
   EXAM SPECIFIC STYLES
   ============================================= */

.exam-layout {
    min-height: 100vh;
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
}

.exam-header {
    background: var(--bg-sidebar);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.exam-header .exam-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.exam-header .exam-info {
    color: rgba(203, 213, 225, 0.85);
    font-size: 13px;
}

.timer-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 8px 16px;
}

.timer-display {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.timer-display.warning {
    color: #fbbf24;
}

.timer-display.danger {
    color: #f87171;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0.4;
    }
}

.question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    padding: 28px 20px;
}

.question-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.progress-bar-wrap {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    flex: 1;
    margin: 0 16px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.question-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.question-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.65;
    margin-bottom: 24px;
}

.question-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    object-fit: contain;
    display: block;
    border: 1px solid var(--border);
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    user-select: none;
}

.answer-option:hover {
    border-color: var(--primary-light);
    background: #eff6ff;
}

.answer-option.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.answer-option input[type="radio"] {
    display: none;
}

.option-letter {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: var(--transition);
}

.answer-option.selected .option-letter {
    background: var(--primary);
    color: #fff;
}

.option-text {
    font-size: 15px;
    color: var(--text-primary);
}

.exam-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}

.question-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.nav-dot {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-dot.answered {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.nav-dot.flagged {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.nav-dot.current {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
}

.question-nav-grid.hidden {
    display: none;
}

/* Autosave indicator */
.save-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-page);
}

.save-indicator.saving {
    color: var(--warning);
}

.save-indicator.saved {
    color: var(--success);
}

.save-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.save-indicator.saving .save-dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.save-indicator.saved .save-dot {
    background: var(--success);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.4
    }
}

/* =============================================
   MONITORING
   ============================================= */

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.monitor-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.monitor-card:hover {
    box-shadow: var(--shadow-md);
}

.monitor-card .student-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.monitor-card .student-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active::before {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
    animation: ping 1.5s ease-in-out infinite;
}

.status-dot.finished::before {
    background: var(--primary);
}

.status-dot.disconnected::before {
    background: var(--danger);
}

@keyframes ping {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2)
    }

    50% {
        box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.05)
    }
}

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1e40af 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--radius-xl);
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.35);
    text-align: center;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.6;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-google:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--text-primary);
}

.btn-google img {
    width: 22px;
    height: 22px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-light);
    font-size: 12px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-light);
}

/* =============================================
   RESULT PAGE
   ============================================= */

.result-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.result-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 540px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--primary) var(--pct, 0%), #e2e8f0 0%);
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: #fff;
}

.score-value {
    position: relative;
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

.score-label {
    position: relative;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 28px 0;
}

.result-stat {
    background: var(--bg-page);
    border-radius: var(--radius);
    padding: 16px;
}

.result-stat .num {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.result-stat .lbl {
    font-size: 12px;
    color: var(--text-secondary);
}

.result-stat.correct .num {
    color: var(--success);
}

.result-stat.wrong .num {
    color: var(--danger);
}

.result-stat.total .num {
    color: var(--primary);
}

/* =============================================
   JOIN EXAM PAGE
   ============================================= */

.join-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.join-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.3);
    animation: fadeUp 0.4s ease;
}

.code-input {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 8px;
    text-transform: uppercase;
}

/* =============================================
   UTILITIES
   ============================================= */

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-secondary);
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 12px;
}

.font-bold {
    font-weight: 700;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 20px;
}

/* Notification Toast */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e293b;
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    animation: toastIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

@keyframes toastIn {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    :root {
        --sidebar-w: 260px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .content-wrap {
        padding: 20px 16px;
    }

    .top-header {
        padding: 0 16px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .stat-info .stat-value {
        font-size: 22px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 16px 16px 0;
    }

    .question-card {
        padding: 20px;
    }

    .question-text {
        font-size: 16px;
    }

    .answer-option {
        padding: 14px 16px;
    }

    .option-text {
        font-size: 14px;
    }

    .exam-nav {
        flex-direction: column;
    }

    .exam-nav .btn {
        width: 100%;
    }

    .result-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-card {
        padding: 32px 24px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .join-card {
        padding: 32px 24px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table {
        min-width: 600px;
    }

    .monitor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .login-title {
        font-size: 22px;
    }

    .question-text {
        font-size: 15px;
    }

    .timer-display {
        font-size: 18px;
    }

    .code-input {
        font-size: 24px;
        letter-spacing: 5px;
    }

    .result-stats {
        gap: 10px;
    }

    .result-stat .num {
        font-size: 18px;
    }
}

/* Ragu-Ragu Checkbox */
.flag-toggle-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flag-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--warning);
    transition: var(--transition);
    user-select: none;
}

.flag-checkbox:hover {
    background: #fffbeb;
}

.flag-checkbox input {
    display: none;
}

.flag-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--warning);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.flag-checkbox input:checked+.flag-box {
    background: var(--warning);
}

.flag-checkbox input:checked+.flag-box::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.flag-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--warning);
}

/* Exam Footer */
.exam-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: auto;
}

/* Utilities */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.gap-8 {
    gap: 32px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mt-8 {
    margin-top: 32px;
}

.p-8 {
    padding: 32px;
}

.pt-6 {
    padding-top: 24px;
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .exam-nav {
        flex-direction: column-reverse;
        gap: 16px;
        align-items: stretch;
    }

    .flag-toggle-wrap {
        order: 1;
    }

    .exam-nav button {
        width: 100%;
    }
}
/* =============================================
   PREMIUM VALIDATION ANIMATIONS
   ============================================= */

@keyframes scanning {
    0% { transform: translateY(-100%); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: translateY(100%); opacity: 0; }
}

@keyframes input-pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.join-form-container {
    position: relative;
    overflow: hidden;
}

.join-form-container.is-validating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(99, 102, 241, 0.2), transparent);
    animation: scanning 1.5s infinite linear;
    pointer-events: none;
    z-index: 10;
}

.join-input.is-validating {
    animation: input-pulse 1.5s infinite;
    border-color: #6366f1 !important;
    background-color: #f5f3ff !important;
}

.validation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: inherit;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.validation-overlay.active {
    opacity: 1;
    visibility: visible;
}

.val-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.val-text {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-primary);
}

.btn-join-exam.is-validating {
    pointer-events: none;
    opacity: 0.8;
}
