/* =============================================
   CPU College LMS - Main Stylesheet
   ============================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #7c3aed;
    --secondary-light: #ede9fe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg: #f0f4ff;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --sidebar-width: 260px;
    --navbar-height: 64px;

    --transition: all .2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --bg-card: #1a1d2e;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #2d3748;
    --gray-100: #1e2230;
    --gray-200: #2d3748;
    --primary-light: #1e3a8a;
    --secondary-light: #2e1065;
    --success-light: #14532d;
    --warning-light: #78350f;
    --danger-light: #7f1d1d;
    --info-light: #164e63;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.3);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    transition: background .3s, color .3s;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }
h6 { font-size: .875rem; font-weight: 600; }
p { color: var(--text-secondary); }

/* =============================================
   PUBLIC NAVBAR
   ============================================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    min-height: var(--navbar-height);
    display: flex;
    align-items: center;
}

[data-theme="dark"] .navbar {
    background: rgba(26,29,46,.95);
}

.navbar-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.navbar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.navbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.navbar-subtitle { font-size: .7rem; color: var(--text-secondary); }

.navbar-nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: .9rem;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background: var(--gray-100);
    color: var(--primary);
}

.navbar-actions { display: flex; align-items: center; gap: 8px; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #6d28d9; color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; color: white; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }

.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

.btn-light { background: var(--gray-100); color: var(--text-primary); }
.btn-light:hover { background: var(--gray-200); }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-xl { padding: 16px 36px; font-size: 1.1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .875rem; color: var(--text-primary); }
.form-label span { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: .78rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }

.input-group { position: relative; }
.input-group .form-control { padding-left: 40px; }
.input-group .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.input-group .input-icon svg { width: 18px; height: 18px; }

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

.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.form-check input[type="checkbox"], .form-check input[type="radio"] {
    width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary);
}
.form-check label { cursor: pointer; font-size: .9rem; }

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

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

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

.card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--gray-50); }

/* =============================================
   STAT CARDS
   ============================================= */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 26px; height: 26px; }

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.purple { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.teal { background: var(--info-light); color: var(--info); }

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-change { font-size: .78rem; color: var(--text-secondary); }

/* =============================================
   TABLES
   ============================================= */
.table-responsive { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table th, .table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--gray-50);
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

[data-theme="dark"] .table th { background: var(--gray-100); }

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table td { font-size: .875rem; color: var(--text-primary); }

/* =============================================
   BADGES
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.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-gray { background: var(--gray-100); color: var(--gray-600); }

/* =============================================
   ALERTS
   ============================================= */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert svg { width: 20px; height: 20px; flex-shrink: 0; }
.alert-success { background: var(--success-light); color: var(--success); border-color: var(--success); }
.alert-error { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); border-color: var(--info); }

/* =============================================
   MODALS
   ============================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.95) translateY(20px);
    transition: var(--transition);
}

.modal-backdrop.active .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

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

.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--gray-100); color: var(--text-primary); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--navbar-height);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.sidebar-brand-title { font-size: .95rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand-sub { font-size: .7rem; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    padding: 8px 12px 4px;
    margin-top: 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: .875rem;
    margin-bottom: 2px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.sidebar-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav-item .badge { margin-left: auto; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role { font-size: .72rem; color: var(--text-secondary); text-transform: capitalize; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    min-height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }
.page-title-bar { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-secondary); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--gray-300); }

.top-bar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover { background: var(--gray-100); color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }

.page-content { flex: 1; padding: 24px; }

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.page-header-sub { color: var(--text-secondary); font-size: .875rem; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* =============================================
   GRID SYSTEM
   ============================================= */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* =============================================
   HERO SECTION
   ============================================= */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 40%, #7c3aed 100%);
    color: white;
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radius-full);
    padding: 6px 16px;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    color: white;
}

.hero-desc { font-size: 1.1rem; color: rgba(255,255,255,.85); margin-bottom: 40px; max-width: 560px; }

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.btn-white { background: white; color: var(--primary); }
.btn-white:hover { background: var(--gray-50); color: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.btn-glass {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255,255,255,.3);
}
.btn-glass:hover { background: rgba(255,255,255,.25); color: white; }

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(255,255,255,.15);
    flex-wrap: wrap;
}

.hero-stat-value { font-size: 2rem; font-weight: 800; color: white; }
.hero-stat-label { font-size: .8rem; color: rgba(255,255,255,.7); margin-top: 4px; }

/* =============================================
   FEATURES SECTION
   ============================================= */
.section { padding: 80px 0; }
.section-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-header { text-align: center; margin-bottom: 60px; }
.section-tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 16px;
}

.section-title { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 800; color: var(--text-primary); margin-bottom: 16px; }
.section-desc { color: var(--text-secondary); font-size: 1.05rem; max-width: 560px; margin: 0 auto; }

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

.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); border-color: var(--primary); }

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 28px;
}

.feature-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.feature-desc { color: var(--text-secondary); font-size: .9rem; line-height: 1.7; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3Ccircle cx='50' cy='50' r='30' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3C/svg%3E") center/300px;
}

.login-left-content { position: relative; z-index: 1; text-align: center; max-width: 400px; }

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    background: var(--bg-card);
}

.login-form-wrap { width: 100%; }

.login-header { margin-bottom: 32px; }
.login-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { color: var(--text-secondary); }

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress { background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; height: 8px; }
.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width .5s ease;
}

/* =============================================
   AVATAR
   ============================================= */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 30px; }

/* =============================================
   EXAM SPECIFIC
   ============================================= */
.exam-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    transition: var(--transition);
}

.exam-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }

.exam-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-secondary); font-size: .8rem; margin: 12px 0; }
.exam-meta-item { display: flex; align-items: center; gap: 5px; }
.exam-meta-item svg { width: 14px; height: 14px; }

.timer-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.timer-display.warning { color: var(--warning); }
.timer-display.danger { color: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.q-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.q-nav-btn.answered { background: var(--success-light); border-color: var(--success); color: var(--success); }
.q-nav-btn.current { background: var(--primary); border-color: var(--primary); color: white; }
.q-nav-btn:hover:not(.current) { border-color: var(--primary); color: var(--primary); }

.option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 10px;
    font-size: .9rem;
}

.option-label:hover { border-color: var(--primary); background: var(--primary-light); }
.option-label input:checked + span { color: var(--primary); font-weight: 600; }
.option-label:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }

/* =============================================
   COURSE CARD
   ============================================= */
.course-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

.course-thumb {
    height: 160px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.course-body { padding: 20px; flex: 1; }
.course-category {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--primary);
    margin-bottom: 8px;
}

.course-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; line-height: 1.4; }
.course-desc { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.course-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
    font-size: .8rem;
    color: var(--text-secondary);
}

/* =============================================
   DROPDOWN
   ============================================= */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
}

.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: .875rem;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover { background: var(--gray-100); color: var(--primary); }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* =============================================
   MOBILE SIDEBAR TOGGLE
   ============================================= */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border-radius: var(--radius-sm);
    position: relative;
}
.mobile-menu-btn:active { background: var(--gray-100); }
.mobile-menu-btn svg { width: 24px; height: 24px; }
/* Fallback hamburger when icon fails to load */
.mobile-menu-btn:empty::before,
.mobile-menu-btn i:empty::before {
    content: '\2630';
    font-size: 22px;
    font-style: normal;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 55;
    opacity: 0;
    transition: opacity .3s ease;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 60px 0 30px;
}

.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.footer-logo {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 14px;
}

.footer-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: white; margin-bottom: 16px; }
.footer-link { display: block; color: var(--gray-400); font-size: .875rem; margin-bottom: 8px; }
.footer-link:hover { color: white; }
.footer-bottom { border-top: 1px solid var(--gray-800); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: .8rem; }

/* =============================================
   UTILITIES
   ============================================= */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.fw-bold { font-weight: 700; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

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

.empty-state svg { width: 60px; height: 60px; color: var(--gray-300); margin-bottom: 20px; }
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { max-width: 380px; margin: 0 auto 24px; }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   SEARCH & FILTER BAR
   ============================================= */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.search-input {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input input { padding-left: 40px; }
.search-input .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.search-input .search-icon svg { width: 16px; height: 16px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* --- Typography --- */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
    h4 { font-size: .95rem; }
    .page-header-title { font-size: 1.15rem; }
    .page-header-sub { font-size: .8rem; }

    /* --- Public Navbar (wrap on mobile) --- */
    .navbar { padding: 8px 0; }
    .navbar-inner { padding: 0 12px; gap: 8px; flex-wrap: wrap; }
    .navbar-brand { gap: 8px; flex-shrink: 0; }
    .navbar-logo { width: 34px; height: 34px; font-size: 14px; border-radius: 8px; }
    .navbar-title { font-size: .9rem; }
    .navbar-subtitle { display: none; }
    .navbar-nav { order: 3; width: 100%; justify-content: center; gap: 0; padding-top: 6px; border-top: 1px solid var(--border); }
    .nav-link { padding: 6px 12px; font-size: .8rem; }
    .navbar-actions { gap: 6px; margin-left: auto; }
    .navbar-actions .btn { padding: 7px 12px; font-size: .78rem; }
    .navbar-actions .btn svg { width: 14px; height: 14px; }
    .icon-btn { width: 34px; height: 34px; }
    .icon-btn svg { width: 16px; height: 16px; }

    /* --- Sidebar --- */
    .sidebar {
        transform: translateX(-100%) !important;
        z-index: 60;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,.2);
    }
    .sidebar-overlay.active { display: block; opacity: 1; }
    .mobile-menu-btn { display: flex !important; }
    .main-content { margin-left: 0 !important; }
    body.sidebar-open { overflow: hidden !important; }

    /* --- Grid --- */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    /* --- Login --- */
    .login-left { display: none; }
    .login-right { width: 100%; padding: 32px 20px; }
    .login-title { font-size: 1.4rem; }

    /* --- Hero --- */
    .hero { padding: 48px 0 40px; }
    .hero-content { padding: 0 16px; }
    .hero-badge { font-size: .72rem; padding: 5px 12px; }
    .hero-desc { font-size: .92rem; margin-bottom: 24px; }
    .hero-actions { gap: 10px; }
    .hero-actions .btn-xl { padding: 12px 24px; font-size: .92rem; }
    .hero-stats { gap: 20px; margin-top: 32px; padding-top: 24px; }
    .hero-stat-value { font-size: 1.5rem; }
    .hero-stat-label { font-size: .72rem; }

    /* --- Sections --- */
    .section { padding: 48px 0; }
    .section-inner { padding: 0 16px; }
    .section-header { margin-bottom: 32px; }
    .section-desc { font-size: .88rem; }
    .feature-card { padding: 20px; }
    .feature-icon { width: 44px; height: 44px; margin-bottom: 14px; }
    .feature-title { font-size: .95rem; }
    .feature-desc { font-size: .82rem; }

    /* --- Page Layout --- */
    .page-header { flex-direction: column; gap: 10px; }
    .table-responsive { font-size: .8rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .footer { padding: 40px 0 24px; }
    .footer-title { font-size: .78rem; margin-bottom: 10px; }
    .footer-link { font-size: .8rem; }
    .footer-bottom { font-size: .72rem; flex-direction: column; text-align: center; }
    .top-bar { padding: 0 10px; gap: 6px; min-height: 52px; }
    .top-bar-left { gap: 6px; }
    .top-bar-right { gap: 4px; }
    .page-content { padding: 14px; }
    .page-title-bar { font-size: .95rem; }
    .breadcrumb { font-size: .72rem; }

    /* --- Modals --- */
    .modal { max-width: 95vw; max-height: 85vh; border-radius: var(--radius); }
    .modal-lg, .modal-xl { max-width: 95vw; }
    .modal-header { padding: 14px 16px; }
    .modal-title { font-size: .95rem; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 12px 16px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; min-width: 0; justify-content: center; }

    /* --- Cards & Stats --- */
    .stat-card { padding: 16px; gap: 12px; }
    .stat-value { font-size: 1.5rem; }
    .stat-icon { width: 42px; height: 42px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }

    /* --- Buttons --- */
    .btn { padding: 8px 14px; font-size: .8rem; }
    .btn-sm { padding: 5px 10px; font-size: .75rem; }
    .btn-lg { padding: 10px 20px; font-size: .88rem; }
    .btn-xl { padding: 12px 24px; font-size: .92rem; }

    /* --- Tables --- */
    .table th, .table td { padding: 10px 10px; font-size: .78rem; }

    /* --- Exam Layout (Mobile) --- */
    .exam-header { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
    .exam-header .timer-display { font-size: 1.2rem; letter-spacing: 1px; }
    .exam-body { grid-template-columns: 1fr !important; height: auto; }
    .exam-sidebar {
        position: static !important; height: auto !important;
        max-height: none; padding: 12px;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .exam-main { padding: 14px; overflow-y: visible; }
    .question-nav { gap: 6px; margin-bottom: 12px; }
    .q-nav-btn { width: 30px; height: 30px; font-size: .72rem; }

    /* --- Exam Question Styling --- */
    .question-block .card-body { padding: 14px; }
    .question-block p { font-size: .875rem !important; line-height: 1.5 !important; }
    .option-label { padding: 10px 12px; font-size: .82rem; gap: 8px; }
    .option-label span[style*="width:26px"] { width: 22px !important; height: 22px !important; font-size: .72rem !important; }
    .matching-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
    .true-false-options { flex-direction: column !important; }

    /* --- Course Cards --- */
    .course-thumb { height: 120px; }
    .course-body { padding: 14px; }
    .course-title { font-size: .92rem; }
    .course-desc { font-size: .8rem; }
    .course-footer { padding: 10px 14px; font-size: .75rem; }

    /* --- Filter Bar --- */
    .filter-bar { padding: 10px; gap: 8px; }
    .search-input { min-width: 0; flex: 1; }
    .form-control { font-size: .85rem; padding: 9px 12px; }

    /* --- Alerts --- */
    .alert { font-size: .82rem; padding: 10px 14px; gap: 8px; }
}

@media (max-width: 480px) {
    /* --- Typography --- */
    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: .95rem; }
    h4 { font-size: .88rem; }
    body { font-size: 13px; }

    .stat-card { flex-direction: column; }
    .btn-group { flex-direction: column; }

    /* Navbar tighter */
    .navbar-inner { padding: 6px 10px; gap: 6px; }
    .navbar-brand { gap: 6px; }
    .navbar-logo { width: 30px; height: 30px; font-size: 12px; }
    .navbar-title { font-size: .82rem; }
    .nav-link { padding: 5px 8px; font-size: .72rem; }
    .navbar-actions .btn { padding: 6px 10px; font-size: .72rem; gap: 4px; }

    /* Hero tighter */
    .hero { padding: 32px 0; }
    .hero-badge { font-size: .68rem; padding: 4px 10px; margin-bottom: 16px; }
    .hero-desc { font-size: .85rem; margin-bottom: 20px; }
    .hero-actions .btn-xl { padding: 10px 18px; font-size: .85rem; }
    .hero-stats { gap: 16px; margin-top: 24px; padding-top: 20px; }
    .hero-stat-value { font-size: 1.3rem; }
    .hero-stat-label { font-size: .68rem; }

    /* Sections tighter */
    .section { padding: 32px 0; }
    .section-inner { padding: 0 12px; }
    .section-header { margin-bottom: 24px; }
    .section-desc { font-size: .82rem; }
    .feature-card { padding: 16px; }
    .feature-title { font-size: .88rem; }
    .feature-desc { font-size: .78rem; }

    /* Exam further compact */
    .exam-header { padding: 6px 10px; }
    .exam-header .timer-display { font-size: 1rem; }
    .exam-header > div[style*="min-width:160px"] { min-width: 100px !important; }
    .exam-sidebar { padding: 10px; }
    .exam-main { padding: 10px; }
    .q-nav-btn { width: 26px; height: 26px; font-size: .65rem; border-width: 1.5px; }
    .option-label { padding: 8px 10px; font-size: .78rem; }

    /* Page layout tighter */
    .page-content { padding: 10px; }
    .top-bar { padding: 0 8px; min-height: 48px; }
    .page-title-bar { font-size: .85rem; }

    /* Modal full-width */
    .modal-backdrop { padding: 8px; }
    .modal { max-width: 100%; border-radius: var(--radius-sm); }
    .modal-header { padding: 12px 14px; }
    .modal-title { font-size: .88rem; }
    .modal-body { padding: 14px; }

    /* Table scroll hint */
    .table th, .table td { padding: 8px 6px; font-size: .72rem; white-space: nowrap; }

    /* Cards compact */
    .card-header { padding: 12px 14px; }
    .card-body { padding: 12px; }
    .stat-value { font-size: 1.25rem; }
    .stat-label { font-size: .7rem; }

    /* Footer tighter */
    .footer { padding: 32px 0 20px; }
    .footer-inner { padding: 0 12px; }
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* =============================================
   EXAM-SPECIFIC MOBILE OVERRIDES
   Forces scrollability when taking exam on mobile
   ============================================= */
@media (max-width: 768px) {
    html.exam-active,
    body.exam-active {
        height: auto !important;
        min-height: 0 !important;
        overflow: auto !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch;
    }
    body.exam-active .exam-layout {
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    body.exam-active .exam-body {
        height: auto !important;
        overflow: visible !important;
        display: block !important;
        flex: none !important;
    }
    body.exam-active .exam-main {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    body.exam-active .exam-sidebar {
        position: static !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* =============================================
   DARK MODE TOGGLE
   ============================================= */
.theme-toggle {
    background: var(--gray-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
    display: flex;
    gap: 2px;
    cursor: pointer;
}

.theme-option {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: .75rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.theme-option.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow); }
.theme-option svg { width: 13px; height: 13px; }

/* =============================================
   ANIMATION
   ============================================= */
.fade-in {
    animation: fadeIn .4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn .3s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    .sidebar, .top-bar, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
