/**
 * Qzio - EdTech Quiz Platform
 * Premium CSS Design System
 * Developed by Gagan
 */

/* ===== CSS Variables ===== */
:root {
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Plus Jakarta Sans', var(--font-sans);
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
}

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

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

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-center { text-align: center; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; gap: 1rem; }

/* ===== App Header ===== */
.app-header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    padding: 0.625rem 1rem;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
}
.header-nav-desktop {
    display: none;
    gap: 0.25rem;
}
@media (min-width: 768px) {
    .header-nav-desktop { display: flex; }
}
.header-nav-desktop a {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    transition: all 0.15s;
}
.header-nav-desktop a:hover,
.header-nav-desktop a.active {
    color: var(--accent);
    background: var(--accent-light);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.notif-btn { position: relative; }
.notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 9px;
    font-weight: 600;
    background: var(--danger);
    color: white;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
}
[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon { display: none; }

/* User Dropdown */
.user-dropdown { position: relative; }
.avatar-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    overflow: hidden;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.dropdown-content {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 200;
}
.user-dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-header {
    padding: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}
.dropdown-header strong { display: block; font-size: 0.875rem; }
.dropdown-header small { color: var(--text-muted); font-size: 0.75rem; }
.dropdown-links { padding: 0.5rem; }
.dropdown-links a {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-radius: 0.375rem;
}
.dropdown-links a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.dropdown-links hr { margin: 0.375rem 0; border: none; border-top: 1px solid var(--border-color); }
.dropdown-links .logout { color: var(--danger); }

/* Hamburger Button */
.hamburger-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.hamburger-btn span {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.mobile-menu-overlay.open { opacity: 1; visibility: visible; }

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-primary);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.mobile-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.mobile-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
    overflow: hidden;
    flex-shrink: 0;
}
.mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mobile-user-info strong { display: block; font-size: 0.9375rem; }
.mobile-user-info small { color: var(--text-muted); font-size: 0.75rem; }
.mobile-guest { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-nav { padding: 0.75rem; }
.mobile-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    transition: all 0.15s;
}
.mobile-nav a:hover,
.mobile-nav a.active {
    background: var(--accent-light);
    color: var(--accent);
}
.mobile-nav a svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.mobile-nav a i { width: 1.25rem; text-align: center; flex-shrink: 0; }
.mobile-nav hr { margin: 0.5rem 0; border: none; border-top: 1px solid var(--border-color); }
.mobile-nav .logout { color: var(--danger); }

/* Dropdown links with Font Awesome */
.dropdown-links a i { width: 1.25rem; margin-right: 0.5rem; }

/* Hide utilities */
.hide-mobile { display: none; }
@media (min-width: 768px) {
    .hide-mobile { display: flex; }
    .hide-desktop { display: none; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover:not(:disabled) { background: var(--border-color); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); background: var(--bg-tertiary); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
.form-control.error { border-color: var(--danger); }
.form-error { display: block; margin-top: 0.375rem; font-size: 0.75rem; color: var(--danger); }
.form-hint { display: block; margin-top: 0.375rem; font-size: 0.75rem; color: var(--text-muted); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-check { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; }
.form-check-input { width: 1.125rem; height: 1.125rem; margin-top: 0.125rem; accent-color: var(--accent); cursor: pointer; }
.form-check-label { font-size: 0.875rem; color: var(--text-secondary); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
}

.alert-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; margin-top: 0.125rem; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); }

/* Avatar */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1.25rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1.5rem; }

/* Tables */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--bg-tertiary); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-secondary); }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.tab { padding: 0.75rem 1.25rem; font-size: 0.9375rem; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Stats - 2 columns on mobile */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; } }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Dashboard Stats - 2 columns on mobile */
.dashboard-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .dashboard-stats { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }
.dashboard-stat { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; }
.dashboard-stat-icon { width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; background: var(--accent-light); color: var(--accent); border-radius: var(--radius-md); margin-bottom: 0.75rem; }
.dashboard-stat-value { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
@media (min-width: 768px) { .dashboard-stat-value { font-size: 1.5rem; } }
.dashboard-stat-label { font-size: 0.75rem; color: var(--text-muted); }

/* Scrollable containers for mobile */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { height: 4px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.table-wrapper .table { min-width: 500px; }

/* Activity list scrollable */
.activity-list { max-height: 400px; overflow-y: auto; }
.activity-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }

/* Quiz Card */
.quiz-card { transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.quiz-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quiz-card-thumb { position: relative; aspect-ratio: 16/10; background: var(--gradient-primary); overflow: hidden; }
.quiz-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.quiz-card-badge { position: absolute; top: 0.75rem; left: 0.75rem; padding: 0.25rem 0.625rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; background: var(--success); color: white; border-radius: var(--radius-full); }
.quiz-card-badge.paid { background: var(--warning); }
.quiz-card-content { padding: 1rem; }
.quiz-card-category { font-size: 0.75rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.375rem; }
.quiz-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.4; }
.quiz-card-title a:hover { color: var(--accent); }
.quiz-card-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.quiz-card-meta span { display: flex; align-items: center; gap: 0.25rem; }
.quiz-card-creator { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-color); font-size: 0.8125rem; color: var(--text-muted); }
.quiz-card-creator img { width: 1.5rem; height: 1.5rem; border-radius: 50%; object-fit: cover; }

/* Quiz Interface */
.quiz-interface { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-secondary); }
.quiz-header { position: sticky; top: 0; background: var(--bg-primary); border-bottom: 1px solid var(--border-color); padding: 0.875rem 0; z-index: 50; }
.quiz-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.quiz-title { font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-timer { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--bg-tertiary); border-radius: var(--radius-full); font-family: var(--font-mono); font-weight: 600; }
.quiz-timer.warning { background: var(--danger-light); color: var(--danger); animation: pulse 1s infinite; }

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

.quiz-body { flex: 1; padding: 1.5rem 1rem; max-width: 800px; margin: 0 auto; width: 100%; padding-bottom: 6rem; }
.quiz-footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-primary); border-top: 1px solid var(--border-color); padding: 0.875rem 1rem; padding-bottom: calc(0.875rem + env(safe-area-inset-bottom)); z-index: 50; }
.quiz-footer-inner { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; max-width: 600px; margin: 0 auto; }

/* Question Palette */
.question-palette { position: fixed; top: 0; right: 0; width: 300px; height: 100vh; background: var(--bg-card); border-left: 1px solid var(--border-color); padding: 1rem; transform: translateX(100%); transition: transform var(--transition-normal); z-index: 200; overflow-y: auto; }
.question-palette.active { transform: translateX(0); }
.palette-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.palette-title { font-size: 1rem; font-weight: 600; }
.palette-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; font-size: 0.75rem; }
.legend-item { display: flex; align-items: center; gap: 0.375rem; }
.legend-dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--bg-tertiary); border: 2px solid var(--border-color); }
.legend-dot.answered { background: var(--success); border-color: var(--success); }
.legend-dot.unanswered { background: transparent; border-color: var(--border-color); }
.legend-dot.marked { background: var(--warning); border-color: var(--warning); }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.palette-btn { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; font-weight: 600; background: var(--bg-primary); border: 2px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); }
.palette-btn:hover { border-color: var(--accent); }
.palette-btn.current { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.palette-btn.answered { background: var(--success); border-color: var(--success); color: white; }
.palette-btn.marked { background: var(--warning); border-color: var(--warning); color: white; }

/* Options */
.options-list { display: flex; flex-direction: column; gap: 0.75rem; }
.option-item { border: 2px solid var(--border-color); border-radius: var(--radius-lg); transition: all var(--transition-fast); cursor: pointer; }
.option-item:hover { border-color: var(--accent); }
.option-item.selected { border-color: var(--accent); background: var(--accent-light); }
.option-item.correct { border-color: var(--success); background: var(--success-light); }
.option-item.wrong { border-color: var(--danger); background: var(--danger-light); }
.option-label { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem; cursor: pointer; }
.option-marker { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; background: var(--bg-tertiary); border-radius: var(--radius-md); font-weight: 600; flex-shrink: 0; }
.option-item.selected .option-marker { background: var(--accent); color: white; }
.option-content { flex: 1; padding-top: 0.25rem; }

/* Result Page */
.result-hero { text-align: center; padding: 2rem; background: var(--gradient-primary); color: white; border-radius: var(--radius-xl); margin-bottom: 1.5rem; }
.result-score { font-family: var(--font-display); font-size: 4rem; font-weight: 800; line-height: 1; margin-bottom: 0.5rem; }
.result-status { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: rgba(255,255,255,0.2); border-radius: var(--radius-full); font-weight: 600; }
.result-status.passed { background: rgba(16, 185, 129, 0.3); }
.result-status.failed { background: rgba(239, 68, 68, 0.3); }

/* Leaderboard */
.leaderboard-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-secondary); border-radius: var(--radius-md); }
.leaderboard-rank { width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; background: var(--bg-tertiary); border-radius: var(--radius-md); font-weight: 700; font-size: 0.875rem; }
.leaderboard-item:nth-child(1) .leaderboard-rank { background: var(--gradient-gold); color: white; }
.leaderboard-item:nth-child(2) .leaderboard-rank { background: #94a3b8; color: white; }
.leaderboard-item:nth-child(3) .leaderboard-rank { background: #b45309; color: white; }
.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name { font-weight: 600; font-size: 0.9375rem; }
.leaderboard-meta { font-size: 0.75rem; color: var(--text-muted); }
.leaderboard-score { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }

/* Certificate */
.certificate { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border: 3px solid #d97706; border-radius: var(--radius-xl); padding: 3rem 2rem; text-align: center; position: relative; }
.certificate::before { content: ''; position: absolute; inset: 0.5rem; border: 1px solid #d97706; border-radius: var(--radius-lg); pointer-events: none; }
.certificate-badge { width: 5rem; height: 5rem; margin: 0 auto 1.5rem; }
.certificate-title { font-family: var(--font-display); font-size: 1.75rem; color: #92400e; margin-bottom: 0.5rem; }
.certificate-subtitle { color: #a16207; margin-bottom: 1rem; }
.certificate-name { font-family: var(--font-display); font-size: 2rem; color: #78350f; margin-bottom: 1rem; border-bottom: 2px solid #d97706; display: inline-block; padding-bottom: 0.5rem; }
.certificate-details { color: #92400e; line-height: 1.8; }
.certificate-number { font-family: var(--font-mono); font-size: 0.875rem; color: #a16207; }

/* Empty State */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state-icon { width: 4rem; height: 4rem; margin: 0 auto 1rem; color: var(--text-muted); }
.empty-state-title { font-size: 1.125rem; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--text-muted); margin-bottom: 1rem; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 100;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.25rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 500;
    transition: color 0.15s;
}
.bottom-nav a.active,
.bottom-nav a:hover { color: var(--accent); }
.bottom-nav svg { width: 1.25rem; height: 1.25rem; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.375rem; margin-top: 1.5rem; }
.pagination-btn { display: flex; align-items: center; justify-content: center; min-width: 2.25rem; height: 2.25rem; padding: 0 0.625rem; font-size: 0.875rem; font-weight: 500; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast); }
.pagination-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Dashboard Layout */
.dashboard-layout { display: flex; min-height: calc(100vh - 4rem); }
.sidebar { 
    width: 260px; 
    background: var(--bg-primary); 
    border-right: 1px solid var(--border-color); 
    padding: 1.5rem 1rem; 
    position: fixed;
    top: 4rem;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
@media (min-width: 1024px) { 
    .sidebar { 
        position: sticky;
        top: 4rem;
        height: calc(100vh - 4rem);
        transform: translateX(0); 
    } 
}
.sidebar-nav { list-style: none; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; font-size: 0.9375rem; font-weight: 500; color: var(--text-secondary); border-radius: var(--radius-md); margin-bottom: 0.25rem; transition: all var(--transition-fast); }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--accent-light); color: var(--accent); }
.sidebar-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.sidebar-section-title { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.75rem; padding: 0 1rem; }

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    z-index: 99;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}
.sidebar-toggle:hover { width: 32px; }
.sidebar-toggle svg { transition: transform 0.3s ease; }
.sidebar-toggle.open { left: 260px; }
.sidebar-toggle.open svg { transform: rotate(180deg); }
@media (min-width: 1024px) { .sidebar-toggle { display: none; } }

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }
@media (min-width: 1024px) { .sidebar-overlay { display: none !important; } }
.main-content { flex: 1; padding: 1.5rem; min-width: 0; }

/* Quiz Builder */
.quiz-builder-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.quiz-builder-title { display: flex; align-items: center; gap: 0.75rem; font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-color); }

/* Progress */
.progress { height: 0.5rem; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width var(--transition-normal); }
.progress-bar.success { background: var(--success); }
.progress-bar.danger { background: var(--danger); }

/* Animations */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-slideUp { animation: slideUp 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-fadeIn { animation: fadeIn 0.3s ease; }

/* Utilities */
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: initial; } .hide-desktop { display: none; } }
@media print { .no-print { display: none !important; } }

main { padding-bottom: 5rem; }
@media (min-width: 768px) { main { padding-bottom: 0; } }

/* ===== Search Box ===== */
.search-box { position: relative; }
.search-box input { padding-left: 2.5rem; }
.search-box svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--text-muted); pointer-events: none; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--bg-card); border-radius: var(--radius-xl); padding: 1.5rem; width: 90%; max-width: 400px; transform: scale(0.9); transition: transform 0.2s; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.modal-text { color: var(--text-muted); margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ===== Notification Badge Fix ===== */
.btn-icon { position: relative; }
.notification-badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; font-weight: 600; background: var(--danger); color: white; border-radius: 999px; display: flex; align-items: center; justify-content: center; }

/* ===== Dropdown Menu Fix ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: 100%; right: 0; min-width: 160px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 0.5rem; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all 0.2s; z-index: 100; }
.dropdown:hover .dropdown-menu, .dropdown.active .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(4px); }
.dropdown-item { display: block; width: 100%; padding: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--text-secondary); border: none; background: none; text-align: left; border-radius: var(--radius-md); cursor: pointer; }
.dropdown-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ===== Toast Container ===== */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: fadeIn 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); }
.toast.info { border-left: 4px solid var(--info); }
.toast svg { flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.warning svg { color: var(--warning); }
.toast.info svg { color: var(--info); }

/* ===== Spinner ===== */
.animate-spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== Streak Badge ===== */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: pulse 2s infinite;
}
.streak-badge i { font-size: 1rem; }
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===== Quick Actions ===== */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}
.quick-action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
}
.quick-action-btn i {
    font-size: 1.25rem;
    color: var(--accent);
}
.quick-action-btn span {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}
@media (max-width: 480px) {
    .quick-actions { grid-template-columns: repeat(2, 1fr) !important; }
    .quick-action-btn { padding: 0.875rem 0.5rem; }
}


/* ============================================
   PREMIUM AURA ENHANCEMENTS - ADD TO YOUR EXISTING CSS
   Add this at the end of your style.css file
   ============================================ */

/* ===== AURA BACKGROUND EFFECTS ===== */
.aura-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.aura-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    animation: float 20s infinite ease-in-out;
}

.aura-orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.aura-orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.aura-orb-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -50px) scale(1.1); }
    50% { transform: translate(-30px, 50px) scale(0.9); }
    75% { transform: translate(40px, 30px) scale(1.05); }
}

.content-wrapper {
    position: relative;
    z-index: 1;
}

/* ===== ENHANCED HERO SECTION ===== */
.hero-enhanced {
    position: relative;
    overflow: hidden;
    border-radius: 0 0 3rem 3rem;
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.3);
}

.hero-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: pulse-gradient 8s ease-in-out infinite;
}

@keyframes pulse-gradient {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.hero-enhanced h1 {
    animation: fadeInUp 0.8s ease;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero-enhanced p {
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.hero-enhanced .flex {
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

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

/* Enhanced Hero Buttons */
.btn-hero-white {
    background: white !important;
    color: var(--accent) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.btn-hero-white:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.btn-hero-outline {
    border-color: white !important;
    color: white !important;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1) !important;
}

.btn-hero-outline:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-3px);
}

/* ===== ENHANCED STATS CARDS ===== */
.stats-enhanced {
    margin-top: -3rem;
    position: relative;
    z-index: 10;
}

.stat-card-enhanced {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-card-enhanced:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .stat-card-enhanced {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card-enhanced .stat-value {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
}

/* ===== ENHANCED CATEGORY CARDS ===== */
.card-category-enhanced {
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.card-category-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-category-enhanced:hover {
    transform: translateY(-8px) scale(1.03);
    border-color: var(--accent);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

.card-category-enhanced:hover::before {
    opacity: 0.05;
}

.card-category-enhanced > div:first-child {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.card-category-enhanced:hover > div:first-child {
    transform: scale(1.2) rotate(5deg);
}

.card-category-enhanced > div:last-child {
    position: relative;
    z-index: 1;
}

/* ===== ENHANCED QUIZ CARDS ===== */
.quiz-card-enhanced {
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
    position: relative;
}

.quiz-card-enhanced::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius-2xl);
}

.quiz-card-enhanced:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border-color: var(--accent);
}

.quiz-card-enhanced:hover::after {
    opacity: 0.03;
}

.quiz-card-enhanced .quiz-card-thumb img {
    transition: transform 0.5s ease;
}

.quiz-card-enhanced:hover .quiz-card-thumb img {
    transform: scale(1.1);
}

/* ===== ENHANCED CREATOR CARDS ===== */
.creator-card-enhanced {
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.creator-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--gradient-primary);
    opacity: 0.08;
}

.creator-card-enhanced:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 20px 50px rgba(99, 102, 241, 0.2);
}

.creator-card-enhanced img,
.creator-card-enhanced .avatar {
    position: relative;
    z-index: 1;
    border: 3px solid white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .creator-card-enhanced img,
[data-theme="dark"] .creator-card-enhanced .avatar {
    border-color: var(--bg-card);
}

/* ===== ENHANCED CTA SECTION ===== */
.cta-enhanced {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(245, 87, 108, 0.3);
}

.cta-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 30px); }
}

.cta-enhanced h2 {
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.cta-enhanced p {
    color: rgba(255, 255, 255, 0.95);
    position: relative;
    z-index: 2;
}

.cta-enhanced .btn {
    position: relative;
    z-index: 2;
}

/* ===== ENHANCED HEADER ===== */
.app-header {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="dark"] .app-header {
    background: rgba(15, 23, 42, 0.85) !important;
}

/* ===== ENHANCED BOTTOM NAV ===== */
.bottom-nav {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .bottom-nav {
    background: rgba(15, 23, 42, 0.95) !important;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 640px) {
    .stats-enhanced {
        margin-top: -2rem;
        grid-template-columns: 1fr !important;
    }
    
    .hero-enhanced {
        border-radius: 0 0 2rem 2rem;
    }
    
    .stat-card-enhanced .stat-value {
        font-size: 1.75rem;
    }
}

@media (min-width: 640px) and (max-width: 768px) {
    .stats-enhanced {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ================================================================
   SECURITY & UX IMPROVEMENTS - Enhanced Responsive Design
   ================================================================ */

/* ---- Touch Target Improvements (mobile UX) ---- */
@media (max-width: 768px) {
    .btn, button, a.btn {
        min-height: 44px;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
    .icon-btn {
        width: 2.75rem;
        height: 2.75rem;
    }
    .nav-item, .mobile-nav a {
        min-height: 48px;
    }
    
    /* Better form inputs on mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important; /* prevents iOS zoom */
        min-height: 44px;
    }
    
    /* Full-width modals on small screens */
    .modal {
        margin: 0.5rem !important;
        max-width: calc(100vw - 1rem) !important;
        border-radius: 1rem !important;
    }
    
    /* Better table handling on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
    
    /* Cards in single column */
    .quiz-grid, .creator-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Better padding on mobile */
    .container {
        padding: 0 0.875rem;
    }
    
    /* Page titles */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
}

/* ---- Tablet Improvements ---- */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .quiz-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    h1 { font-size: 1.75rem; }
}

/* ---- Desktop Improvements ---- */
@media (min-width: 1024px) {
    .quiz-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1280px) {
    .quiz-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ---- Better Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: calc(100vw - 2rem);
}

@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 5rem; /* above bottom nav */
        left: 1rem;
        right: 1rem;
    }
    .toast {
        border-radius: 12px !important;
    }
}

/* ---- Improved Form Layouts ---- */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.form-error {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* ---- Security Badge ---- */
.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--success);
    background: var(--success-light);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-weight: 600;
}

/* ---- Loading Skeleton ---- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 1rem; margin-bottom: 0.5rem; }
.skeleton-title { height: 1.5rem; width: 60%; margin-bottom: 0.75rem; }
.skeleton-card { height: 200px; }

/* ---- Image Lazy Loading Placeholder ---- */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}
img[loading="lazy"].loaded {
    opacity: 1;
}

/* ---- Improved Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Focus Visible (accessibility) ---- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ---- Print Styles ---- */
@media print {
    .app-header, .bottom-nav, .mobile-menu, .toast-container { display: none !important; }
    body { background: white; color: black; }
    a { color: black; text-decoration: underline; }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- Better Bottom Nav on large phones ---- */
@media (max-width: 768px) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .page-content {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0));
    }
}

/* ---- Admin/Creator Panel Responsive ---- */
@media (max-width: 768px) {
    .admin-layout, .creator-layout {
        flex-direction: column;
    }
    
    .admin-sidebar, .creator-sidebar {
        width: 100% !important;
        position: static !important;
        max-height: none !important;
    }
    
    .admin-main, .creator-main {
        padding: 1rem !important;
    }
    
    /* Stats grid responsive */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Action buttons full-width on mobile */
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

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

/* ---- Quiz Attempt Page Responsive ---- */
@media (max-width: 768px) {
    .quiz-question-wrap {
        padding: 1rem !important;
    }
    
    .quiz-options {
        gap: 0.625rem !important;
    }
    
    .quiz-option {
        padding: 0.875rem 1rem !important;
        font-size: 0.9375rem !important;
    }
    
    .quiz-timer {
        font-size: 1.25rem !important;
    }
    
    .quiz-nav-btns {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .quiz-nav-btns .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* ---- Dark Mode Input Fix ---- */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
}

/* ---- Password Strength Indicator ---- */
.pw-strength {
    margin-top: 0.375rem;
    height: 4px;
    border-radius: 99px;
    background: var(--border-color);
    overflow: hidden;
}
.pw-strength-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s, background 0.3s;
}
.pw-strength-bar.weak   { width: 33%; background: var(--danger); }
.pw-strength-bar.medium { width: 66%; background: var(--warning); }
.pw-strength-bar.strong { width: 100%; background: var(--success); }
.pw-strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

/* ================================================================
   SEO PANEL STYLES
   ================================================================ */

.seo-breadcrumb {
    padding: 0.75rem 0;
    font-size: 0.8125rem;
}
.seo-breadcrumb ol {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}
.seo-breadcrumb li {
    display: flex;
    align-items: center;
}
.seo-breadcrumb a {
    color: var(--accent);
    font-weight: 500;
}
.seo-breadcrumb a:hover { text-decoration: underline; }
.seo-bc-sep {
    color: var(--text-muted);
    font-size: 0.625rem;
    margin: 0 0.375rem;
}
.seo-breadcrumb [aria-current="page"] {
    color: var(--text-muted);
}

/* SEO Panel in creator studio */
.seo-panel .form-group {
    margin-bottom: 1rem;
}

/* Difficulty selector */
.diff-btn {
    cursor: pointer;
    user-select: none;
}
.diff-btn:hover {
    border-color: var(--accent) !important;
}

/* SEO score badge transitions */
#seoScoreBadge {
    transition: background 0.3s, color 0.3s;
}

/* Sitemap link in admin */
.sitemap-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--accent);
    text-decoration: none;
}
.sitemap-link:hover { text-decoration: underline; }

/* ================================================================
   ADMIN PANEL — Mobile consistency fixes
   ================================================================ */

/* Hide mobile toggle on desktop */
#adminMobHdr { display: flex; }
@media (min-width: 1024px) { #adminMobHdr { display: none !important; } }

/* Admin sidebar same as creator on mobile */
@media (max-width: 1023px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 300;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.open {
        transform: translateX(0);
    }
}

/* SEO breadcrumb — mobile fix */
.seo-breadcrumb {
    font-size: 0.75rem;
    padding: 0.5rem 0;
    overflow: hidden;
}
.seo-breadcrumb ol {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.seo-breadcrumb ol::-webkit-scrollbar { display: none; }
.seo-breadcrumb li,
.seo-breadcrumb a,
.seo-breadcrumb [aria-current="page"] {
    white-space: nowrap;
    font-size: 0.75rem;
}

/* SEO Panel on create/edit quiz — mobile */
@media (max-width: 639px) {
    .seo-panel {
        padding: 1rem !important;
        border-radius: .75rem !important;
    }
    /* Google preview readable on small screen */
    #previewTitle { font-size: .95rem !important; }
    #previewDesc  { font-size: .8rem !important; }
    /* Difficulty buttons wrap properly */
    .seo-panel [style*="display:flex;gap:.75rem"] {
        gap: .5rem !important;
    }
    /* SEO score badge smaller on mobile */
    #seoScoreBadge { font-size: .68rem !important; padding: .22rem .55rem !important; }
}

/* Quiz detail page breadcrumb hero */
.qd-breadcrumb {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.qd-breadcrumb::-webkit-scrollbar { display: none; }
.qd-breadcrumb a,
.qd-breadcrumb span { white-space: nowrap; }

/* Admin stat cards responsive */
@media (max-width: 479px) {
    .ad-stats { grid-template-columns: repeat(2, 1fr) !important; }
    .ad-hero-stats { gap: 1rem !important; }
    .ad-hs-val { font-size: 1rem !important; }
}

/* SEO manager actions — stack on very small screens */
@media (max-width: 399px) {
    .seo-actions { grid-template-columns: 1fr 1fr !important; }
    .seo-stats   { grid-template-columns: 1fr 1fr !important; }
}
