/* ==========================================================================
   NOTES TO QUIZ - PREMIUM CSS ARCHITECTURE (PART 1 OF 2)
   Version: 2.0.0
   Author: Shishir Kumar
   Description: Highly optimized, production-ready stylesheet with exhaustive 
                custom properties, accessibility (a11y) standards, fluid 
                typography, responsive layouts, and premium UI elements.
   ========================================================================== */

/* ==========================================================================
   01. DESIGN SYSTEM & CSS VARIABLES (THEME ENGINE)
   ========================================================================== */
:root {
    /* --- 1.1 Brand Color Palette (Indigo Base) --- */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;
    --brand-950: #1e1b4b;

    /* Primary Semantic Aliases */
    --primary-color: var(--brand-700);
    --primary-hover: var(--brand-800);
    --primary-active: var(--brand-900);
    --primary-light: var(--brand-100);
    --primary-border: var(--brand-200);
    
    /* Premium Gradients */
    --primary-gradient: linear-gradient(135deg, var(--brand-600) 0%, #3b82f6 100%);
    --primary-gradient-hover: linear-gradient(135deg, var(--brand-700) 0%, #2563eb 100%);
    --glass-gradient: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);

    /* --- 1.2 Neutral & Grayscale Palette (Slate Base) --- */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Background & Surface Aliases */
    --bg-body: var(--slate-300); /* Darker backdrop for desktop framing */
    --bg-app: var(--slate-100);  /* Main app wrapper background */
    --bg-card: #ffffff;
    --bg-card-hover: var(--slate-50);
    --bg-overlay: rgba(15, 23, 42, 0.6);

    /* Text & Typography Aliases */
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-tertiary: var(--slate-400);
    --text-inverse: #ffffff;

    /* Border & Divider Aliases */
    --border-light: var(--slate-200);
    --border-medium: var(--slate-300);
    --border-dark: var(--slate-400);

    /* --- 1.3 Semantic System Colors (Success, Error, Warning, Info) --- */
    /* Success (Emerald) */
    --success-50:  #ecfdf5;
    --success-100: #d1fae5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;
    --success-bg: var(--success-50);
    --success-text: var(--success-700);
    --success-border: #a7f3d0;

    /* Error / Danger (Rose/Red) */
    --error-50:  #fff1f2;
    --error-100: #ffe4e6;
    --error-500: #f43f5e;
    --error-600: #e11d48;
    --error-700: #be123c;
    --error-bg: var(--error-50);
    --error-text: var(--error-700);
    --error-border: #fecdd3;

    /* Warning / Alert (Amber) */
    --warning-50:  #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --warning-bg: var(--warning-50);
    --warning-text: var(--warning-700);
    --warning-border: #fde68a;

    /* Info (Blue) */
    --info-50:  #eff6ff;
    --info-100: #dbeafe;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --info-bg: var(--info-50);
    --info-text: var(--info-700);

    /* --- 1.4 Subject Specific Tag Colors --- */
    --sub-physics-bg: #dbeafe;
    --sub-physics-text: #1d4ed8;
    --sub-chemistry-bg: #ede9fe;
    --sub-chemistry-text: #6d28d9;
    --sub-biology-bg: #dcfce7;
    --sub-biology-text: #15803d;
    --sub-math-bg: #ffedd5;
    --sub-math-text: #c2410c;
    --sub-history-bg: #fef08a;
    --sub-history-text: #a16207;

    /* --- 1.5 Typography & Fonts --- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    
    /* Font Sizes (Fluid Scale approach) */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */
    --text-5xl: 3rem;       /* 48px */

    /* Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;

    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

    /* --- 1.6 Spacing & Sizing System --- */
    --space-0: 0px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;

    /* Max Widths */
    --max-w-app: 480px;      /* Strict mobile-first constraint */
    --max-w-content: 100%;

    /* --- 1.7 Border Radii --- */
    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* --- 1.8 Elevations, Shadows & Z-Index --- */
    /* Box Shadows */
    --shadow-none: 0 0 #0000;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.4);
    --shadow-header: 0 4px 20px -5px rgba(15, 23, 42, 0.08);
    --shadow-footer: 0 -10px 25px -5px rgba(15, 23, 42, 0.08);

    /* Z-Index Architecture */
    --z-negative: -1;
    --z-base: 1;
    --z-elevated: 10;
    --z-sticky: 20;
    --z-drawer: 40;
    --z-header: 50;
    --z-modal: 100;
    --z-popover: 200;
    --z-toast: 9999;

    /* --- 1.9 Transitions & Animations --- */
    --transition-fast: 150ms;
    --transition-normal: 250ms;
    --transition-slow: 400ms;
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   02. CSS RESET & NORMALIZATION (Comprehensive)
   ========================================================================== */
/* Box sizing rules */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margin and padding */
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li,
figure,
figcaption,
blockquote,
dl,
dd {
    margin: 0;
    padding: 0;
}

/* Set core root defaults */
html {
    font-size: 100%; /* 16px base */
    -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

/* Base body typography and background */
body {
    min-height: 100vh;
    text-rendering: optimizeSpeed;
    line-height: var(--leading-normal);
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'],
ul,
ol {
    list-style: none;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
    text-decoration-skip-ink: auto;
    color: var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
    background-color: transparent;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    margin: 0;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Remove blue tap highlight on mobile WebKit */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Focus Outline Normalization for Accessibility */
:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Use :focus-visible where supported to avoid mouse-click outlines */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-color);
    border-radius: 2px;
}

/* Custom Selection Highlight */
::selection {
    background-color: var(--brand-300);
    color: var(--brand-950);
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--slate-300);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--slate-400);
}

/* ==========================================================================
   03. UTILITY CLASSES & ACCESSIBILITY (A11Y)
   ========================================================================== */
/* Screen Reader Only - Hides visually but keeps accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Text alignment utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display & Visibility utilities */
.hidden { 
    display: none !important; 
}

/* Spacing Utilities */
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mt-4 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }

/* Typography Utilities */
.text-muted { color: var(--text-tertiary); }
.text-danger { color: var(--error-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-primary { color: var(--primary-color); }
.font-bold { font-weight: var(--font-bold); }
.font-medium { font-weight: var(--font-medium); }

/* Layout Utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }

/* ==========================================================================
   04. MAIN APP SHELL & LAYOUT
   ========================================================================== */
/* App Wrapper - The central container that mimics a mobile device on desktop */
#app-wrapper {
    width: 100%;
    max-width: var(--max-w-app);
    min-height: 100vh;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--bg-app);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.2);
    overflow-x: hidden;
    overflow-y: hidden; /* Let main-content handle scrolling */
}

/* Main Content Area - Flexible scrollable region */
#main-content {
    flex-grow: 1;
    width: 100%;
    height: calc(100vh - 70px); /* Subtract header height */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background-color: var(--bg-app);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */
}

/* Global View Container */
.screen-view {
    display: none; /* Controlled via JS and inline styles for robust routing */
    width: 100%;
    min-height: 100%;
    padding-bottom: var(--space-12); /* Padding for bottom breathability */
    animation: slideUpFade var(--transition-normal) var(--ease-out) forwards;
    will-change: transform, opacity;
}

.screen-view.active-view {
    display: block !important;
}

/* Standard Section Padding */
#view-dashboard,
#view-profile,
#view-groups,
#view-history,
#view-store,
#view-policies {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-top: var(--space-4);
}

/* Section Header Typography */
.section-header {
    margin-bottom: var(--space-6);
}

.section-header h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-extrabold);
    color: var(--slate-900);
    letter-spacing: -0.03em;
    line-height: var(--leading-tight);
}

.section-header p {
    font-size: var(--text-base);
    color: var(--slate-500);
    margin-top: var(--space-1);
}

/* Header with Back Button Layout */
.header-with-back {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.header-with-back h2 {
    margin-bottom: 2px;
}

/* ==========================================================================
   05. BUTTON COMPONENTS (Exhaustive States)
   ========================================================================== */
/* Base Button Reset & Layout */
button {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-sans);
    cursor: pointer;
}

/* Generic Button Class */
.btn-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 52px; /* Touch target size optimization */
    padding-top: 0;
    padding-bottom: 0;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    border-radius: var(--radius-xl);
    text-align: center;
    text-decoration: none;
    transition-property: color, background-color, border-color, transform, box-shadow;
    transition-timing-function: var(--ease-in-out);
    transition-duration: var(--transition-fast);
    user-select: none;
    position: relative;
    overflow: hidden;
}

/* Button Sizing Variations */
.btn-sm {
    min-height: 38px;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
}

.btn-large {
    min-height: 60px;
    font-size: var(--text-lg);
    border-radius: var(--radius-2xl);
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Icon Buttons (Circular) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: var(--radius-full);
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-size: var(--text-lg);
    transition: all var(--transition-fast) var(--ease-out);
}

.btn-icon:hover {
    background-color: var(--slate-50);
    border-color: var(--border-medium);
}

.btn-icon:active {
    background-color: var(--slate-100);
    transform: scale(0.92);
}

/* Primary Button (Gradient) */
.btn-primary {
    /* Inherit base explicitly for standalone use */
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 0 24px; font-weight: 700; border-radius: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    background-image: var(--primary-gradient);
    background-size: 200% auto;
    color: var(--text-inverse);
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background-position: right center; /* Gradient animation */
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.97);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

/* Outline Button */
.btn-outline {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 0 24px; font-weight: 700; border-radius: 16px;
    transition: all 0.2s ease;
    
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--brand-50);
}

.btn-outline:active {
    background-color: var(--brand-100);
    transform: scale(0.97);
}

/* Success Button */
.btn-success {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 0 24px; font-weight: 700; border-radius: 16px;
    transition: all 0.2s ease;
    
    background-color: var(--success-600);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    background-color: var(--success-700);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.btn-success:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

/* Text Button (No border/background) */
.btn-text {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    background-color: transparent;
    color: var(--primary-color);
    font-weight: 700;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.btn-text:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

.btn-text:active {
    background-color: rgba(79, 70, 229, 0.2);
}

/* Disabled State Global */
button:disabled,
button[disabled],
.btn-primary:disabled,
.btn-outline:disabled,
.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* ==========================================================================
   06. NAVIGATION & HEADER COMPONENTS
   ========================================================================== */
/* Main Top Navigation Bar */
#top-nav {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background-color: rgba(255, 255, 255, 0.85);
    /* Premium Glassmorphism Effect */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-header);
}

/* Navigation Groupings */
.nav-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
}

.nav-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
}

/* App Logo Styling */
.app-logo {
    font-size: var(--text-xl);
    font-weight: var(--font-black);
    color: transparent;
    background-image: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    letter-spacing: -0.05em;
    margin: 0;
    padding: 0;
}

/* Hamburger Menu Icon Construction */
#menu-btn {
    padding: 0;
    width: 44px;
    height: 44px;
    background-color: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 24px;
    height: 2.5px;
    background-color: var(--slate-800);
    position: relative;
    transition-property: transform, opacity, background-color;
    transition-duration: 0.3s;
    transition-timing-function: var(--ease-in-out);
    border-radius: 4px;
}

.menu-icon::before {
    content: '';
    position: absolute;
    top: -8px;
    width: 100%;
}

.menu-icon::after {
    content: '';
    position: absolute;
    top: 8px;
    width: 75%; /* Gives a nice asymmetric look to the hamburger */
}

/* Token / Wallet Badge (Header) */
.wallet-badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
    
    background-image: linear-gradient(to right, var(--warning-50), var(--warning-100));
    color: var(--warning-700);
    border: 1px solid var(--warning-border);
    
    font-weight: var(--font-extrabold);
    font-size: var(--text-sm);
    
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
    padding-left: var(--space-3);
    padding-right: var(--space-1); /* Less right padding to accommodate button */
    
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.wallet-badge:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.wallet-badge:active {
    transform: translateY(1px) scale(0.96);
    box-shadow: var(--shadow-none);
}

.credit-value {
    margin-right: var(--space-1);
    font-variant-numeric: tabular-nums;
}

.wallet-badge button#add-credits-btn {
    background-color: var(--warning-500);
    color: var(--text-inverse);
    width: 24px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    border-radius: 50%;
    margin-left: var(--space-1);
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    line-height: 1;
}

/* Profile Avatar Mini */
.profile-menu {
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.profile-menu:active {
    transform: scale(0.90);
}

.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: var(--slate-200);
}

/* ==========================================================================
   07. SIDEBAR DRAWER (Navigation Menu)
   ========================================================================== */
#sidebar {
    position: fixed;
    top: 70px; /* Below header */
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background-color: var(--bg-card);
    z-index: var(--z-modal);
    box-shadow: var(--shadow-xl);
    
    /* Animation Properties */
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* State class added via JavaScript */
#sidebar.sidebar-open {
    transform: translateX(0);
}

/* Mobile Sidebar Header Profile Area */
.sidebar-header-mobile {
    padding: var(--space-6) var(--space-6) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border-light);
    background-color: var(--slate-50);
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.sidebar-user-name {
    font-weight: var(--font-bold);
    color: var(--slate-900);
    font-size: var(--text-base);
    line-height: 1.2;
}

.sidebar-user-email {
    font-size: var(--text-xs);
    color: var(--slate-500);
    margin-top: 2px;
}

/* Navigation Links Container */
.sidebar-nav {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Space between links */
}

/* Individual Navigation Item */
.nav-item {
    padding-top: 14px;
    padding-bottom: 14px;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    
    text-decoration: none;
    color: var(--slate-600);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    
    transition-property: background-color, color, border-color, padding-left;
    transition-duration: 0.2s;
    transition-timing-function: var(--ease-out);
    
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.nav-item span {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Hover and Active States for Nav Items */
.nav-item:hover {
    background-color: var(--slate-50);
    color: var(--slate-900);
}

.nav-item:active {
    background-color: var(--slate-100);
}

.nav-item.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background-color: var(--brand-50);
    font-weight: var(--font-bold);
}

.nav-item.active span {
    opacity: 1;
}

/* Divider inside sidebar */
.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-2) var(--space-6);
}

/* Sidebar Footer Area */
.sidebar-footer {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--border-light);
    background-color: var(--slate-50);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
}

.app-version {
    font-size: var(--text-xs);
    color: var(--slate-400);
    font-family: var(--font-mono);
}

/* ==========================================================================
   08. VIEW 1: DASHBOARD (Premium Components)
   ========================================================================== */
/* Hero Section */
.dashboard-hero {
    margin-bottom: var(--space-6);
    padding-top: var(--space-2);
}

.dashboard-hero h2 {
    font-size: var(--text-3xl);
    letter-spacing: -1px;
}

/* Top Quick Stats Row */
.dashboard-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.dash-stat-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.dash-stat-box:active {
    transform: scale(0.97);
}

.ds-icon {
    font-size: 1.8rem;
    background-color: var(--slate-50);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--slate-100);
}

.ds-info {
    display: flex;
    flex-direction: column;
}

.ds-val {
    font-size: var(--text-xl);
    font-weight: var(--font-black);
    color: var(--slate-900);
    line-height: 1.2;
}

.ds-lbl {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Primary Action Cards Grid */
.dashboard-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.action-card {
    background-color: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.03);
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:active {
    transform: translateY(2px) scale(0.98);
}

/* Specifically styling the primary "Scan Notes" card */
.primary-action {
    background-image: var(--primary-gradient);
    color: var(--text-inverse);
    border: none;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
}

/* Decorative background circle for primary card */
.primary-action::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.primary-action h3 {
    color: var(--text-inverse);
    font-size: var(--text-xl);
    margin-bottom: 4px;
}

.primary-action p {
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* Secondary Action Card (Join Group) */
.secondary-action {
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
}

.secondary-action h3 {
    color: var(--slate-900);
    font-size: var(--text-xl);
    margin-bottom: 4px;
}

.secondary-action p {
    color: var(--slate-500);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-2);
    z-index: 1;
    display: block;
}

/* How It Works Section */
.how-it-works-section {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px dashed var(--border-medium);
    margin-bottom: var(--space-8);
}

.section-subtitle {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-400);
    margin-bottom: var(--space-4);
    text-align: center;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.step-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background-color: var(--slate-50);
    padding: var(--space-3);
    border-radius: var(--radius-md);
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.step-item p {
    font-size: var(--text-sm);
    color: var(--slate-700);
    font-weight: var(--font-medium);
}

/* Dashboard Section Titles */
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-4);
}

.section-title-row h3 {
    font-size: var(--text-lg);
    color: var(--slate-800);
    margin: 0;
}

/* Recent Quizzes List */
.quiz-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.quiz-list-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-list-item:active {
    transform: scale(0.98);
    background-color: var(--slate-50);
}

.quiz-item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.quiz-item-info h4 {
    margin-bottom: 2px;
    font-size: 1.05rem;
    color: var(--slate-900);
}

/* Badge/Tag System */
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: var(--font-bold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.subject-physics { background-color: var(--sub-physics-bg); color: var(--sub-physics-text); }
.subject-chemistry { background-color: var(--sub-chemistry-bg); color: var(--sub-chemistry-text); }
.difficulty-medium { background-color: var(--warning-50); color: var(--warning-700); border: 1px solid var(--warning-border);}
.difficulty-hard { background-color: var(--error-50); color: var(--error-700); border: 1px solid var(--error-border);}

.quiz-meta {
    display: block;
    font-size: var(--text-xs);
    color: var(--slate-500);
    font-weight: var(--font-medium);
}

/* Dashboard Footer Styling */
.app-footer {
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
    border-top: 1px solid var(--border-light);
    text-align: center;
    background-color: transparent;
}

.dev-credits {
    margin-bottom: var(--space-4);
}

.dev-credits p {
    font-size: var(--text-sm);
    color: var(--slate-500);
    margin-bottom: 2px;
}

.dev-credits .copyright-text {
    font-size: var(--text-xs);
    margin-top: var(--space-2);
}

.legal-links {
    margin-top: var(--space-3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    flex-wrap: wrap;
}

.legal-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: var(--font-semibold);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: background-color 0.2s;
}

.legal-links a:hover,
.legal-links a:active {
    background-color: var(--primary-light);
}

/* ==========================================================================
   09. VIEW 2: PROFILE & SETTINGS
   ========================================================================== */
/* Profile Card Container */
.profile-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.03);
    margin-bottom: var(--space-6);
}

/* Avatar Styling */
.profile-avatar-large {
    margin-bottom: var(--space-6);
    position: relative;
    display: inline-block;
}

.profile-avatar-large img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--bg-card);
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    background-color: var(--slate-100);
}

.avatar-edit-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--bg-card);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.avatar-edit-badge:active {
    transform: scale(0.9);
}

/* Profile Text Details */
.profile-details h3 {
    font-size: var(--text-2xl);
    margin-bottom: 4px;
    color: var(--slate-900);
}

#profile-email {
    font-size: var(--text-sm);
    color: var(--slate-500);
    margin-bottom: var(--space-2);
}

/* Badge specific for verified */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: var(--success-100);
    color: var(--success-700);
    border: 1px solid var(--success-border);
}

/* Unauthenticated View Specifics */
.login-actions {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
}

.google-login-btn {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--slate-300);
    box-shadow: var(--shadow-sm);
    height: 56px;
    font-weight: var(--font-semibold);
}

.google-login-btn .icon {
    font-weight: var(--font-black);
    color: #DB4437; /* Google Red */
    font-size: 1.4rem;
    margin-right: 4px;
}

.security-trust-box {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    background-color: var(--slate-50);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-align: left;
    margin-top: var(--space-4);
}

.shield-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.security-note {
    font-size: 0.75rem;
    color: var(--slate-500);
    line-height: 1.5;
    margin: 0;
}

.security-note a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Profile Stats Grid */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.stat-box {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.neutral-bg {
    background-color: var(--slate-50);
    border-color: var(--border-light);
}

.warning-bg {
    background-color: var(--warning-50);
    border-color: var(--warning-border);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: var(--font-black);
    color: var(--slate-900);
    line-height: 1.1;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Settings List Form */
.settings-section {
    margin-bottom: var(--space-8);
}

.settings-list {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.settings-icon {
    font-size: 1.4rem;
    background-color: var(--slate-100);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.settings-item-info h4 {
    font-size: var(--text-base);
    color: var(--slate-900);
    margin-bottom: 2px;
}

.settings-item-info p {
    font-size: var(--text-xs);
    color: var(--slate-500);
}

.chevron-right {
    font-size: 1.5rem;
    color: var(--slate-400);
    font-weight: 300;
}

/* Danger Zone */
.danger-zone {
    margin-top: var(--space-8);
    padding: var(--space-4);
    background-color: var(--error-50);
    border: 1px dashed var(--error-border);
    border-radius: var(--radius-lg);
}

.border-danger {
    border-color: var(--error-600);
}

/* ==========================================================================
   10. VIEW 3: PAST QUIZZES (HISTORY) - Advanced Layout
   ========================================================================== */
/* Sticky Header Complex Layout */
.sticky-header {
    position: sticky;
    top: -16px; /* Offset to hide under main top nav if scrolled */
    background-color: rgba(241, 245, 249, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-top: var(--space-4);
    z-index: var(--z-sticky);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
    margin-left: -16px; /* Negative margin to span full width of padded container */
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.header-top-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: var(--space-3);
    gap: var(--space-2);
}

/* Custom Dropdown Styling */
.filter-dropdown {
    width: 100%;
    flex-grow: 1;
    padding: 10px 16px;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    font-weight: var(--font-semibold);
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
    color: var(--slate-800);
}

.btn-filter-sort {
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* History List Container */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-bottom: var(--space-12);
    margin-top: var(--space-4);
}

/* History Card Design (PhonePe Transaction Style) */
.history-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

/* Decorative Left Accent Border */
.history-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-color);
}

/* History Card Header */
.hc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.hc-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.hc-title h4 {
    font-size: 1.15rem;
    color: var(--slate-900);
    line-height: 1.3;
}

.hc-date {
    font-size: 0.8rem;
    color: var(--slate-500);
    white-space: nowrap;
    font-weight: var(--font-medium);
}

/* Card Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: var(--font-extrabold);
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-attempted {
    background-color: var(--success-100);
    color: var(--success-700);
}

/* Card Statistics Box */
.hc-stats {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--slate-600);
    margin-bottom: var(--space-5);
    background-color: var(--slate-50);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-200);
}

.hc-stats strong {
    color: var(--slate-900);
    font-size: 1.05rem;
    font-weight: var(--font-black);
}

/* Card Action Buttons */
.hc-actions {
    display: flex;
    gap: var(--space-3);
}

.hc-actions button {
    flex: 1;
    height: 44px;
    font-size: 0.9rem;
    padding: 0 12px;
}

/* Skeleton Loading State for History */
.skeleton-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--border-light);
    height: 160px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton-header, .skeleton-body, .skeleton-footer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: loadingSkeleton 1.5s infinite;
    border-radius: 4px;
}

.skeleton-header { width: 60%; height: 24px; }
.skeleton-body { width: 100%; height: 40px; border-radius: 8px; }
.skeleton-footer { width: 100%; height: 44px; display: flex; gap: 12px; background: transparent; animation: none;}
.skeleton-footer::before, .skeleton-footer::after {
    content: ''; flex: 1; height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%; animation: loadingSkeleton 1.5s infinite;
}

@keyframes loadingSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   11. VIEW 4: MY COACHING / GROUPS
   ========================================================================== */
/* Join Group Card Container */
.join-group-card {
    background-color: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    border: 1px solid var(--brand-200);
    margin-bottom: var(--space-8);
    box-shadow: 0 10px 25px -5px rgba(67, 56, 202, 0.1);
    position: relative;
    overflow: hidden;
}

/* Top Accent Line */
.join-header-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-image: var(--primary-gradient);
}

.join-group-card h3 {
    color: var(--slate-900);
    margin-bottom: 6px;
    font-size: var(--text-xl);
}

.join-group-card p {
    color: var(--slate-500);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

/* Input Group for Joining */
.join-input-group {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
}

.join-input-group input {
    flex-grow: 1;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: var(--font-extrabold);
    border-color: var(--brand-300);
    background-color: var(--slate-50);
    font-size: var(--text-lg);
    text-align: center;
    min-width: 0; /* Prevents flex flex-grow overflow */
}

.join-input-group button {
    flex-shrink: 0;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.form-help-text {
    font-size: var(--text-xs);
    color: var(--slate-400);
    display: block;
}

/* Coaching List Container */
.coaching-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding-bottom: var(--space-10);
}

/* Premium Coaching Card Design */
.premium-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.cc-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

/* Gradient Avatar for Groups */
.cc-avatar.gradient-bg {
    width: 60px;
    height: 60px;
    border-radius: 16px; /* Squircle shape */
    background-image: var(--primary-gradient);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-black);
    font-size: var(--text-2xl);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cc-title-area {
    display: flex;
    flex-direction: column;
}

.cc-title-area h4 {
    font-size: 1.25rem;
    margin-bottom: 4px;
    color: var(--slate-900);
    line-height: 1.2;
}

.cc-meta {
    font-size: 0.8rem;
    color: var(--slate-500);
    margin-bottom: 2px;
}

/* Modern Stats Box for Coaching */
.cc-stats-modern {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.cc-stats-modern .stat-item {
    flex: 1;
    background-color: var(--slate-50);
    border: 1px solid var(--border-light);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cc-stats-modern .stat-val {
    font-size: var(--text-xl);
    font-weight: var(--font-black);
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 4px;
}

.cc-stats-modern .stat-lbl {
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px dashed var(--border-medium);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    display: block;
    opacity: 0.8;
}

.empty-state h4 {
    font-size: var(--text-lg);
    color: var(--slate-800);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--text-sm);
    color: var(--slate-500);
    line-height: 1.5;
}

/* END OF PART 1 */
/* ==========================================================================
   NOTES TO QUIZ - PREMIUM CSS ARCHITECTURE (PART 2 OF 2)
   Version: 2.0.0
   Description: Continuation covering Upload Engine, Live CBT Engine, 
                Scorecard, Store, Legal Policies, Animations & Print Media.
   ========================================================================== */

/* ==========================================================================
   12. VIEW 5: UPLOAD & CONFIGURATOR FORM ENGINE
   ========================================================================== */

/* Form Container Layout */
.config-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-bottom: 120px; /* Space for fixed sticky footer */
    width: 100%;
}

/* Premium Form Card Wrapper */
.form-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-normal) var(--ease-out);
}

.form-card:focus-within {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-border);
}

/* Highlighted Settings Card (Strict Mode) */
.highlight-card {
    background-image: linear-gradient(145deg, #ffffff 0%, var(--slate-50) 100%);
    border: 2px solid var(--primary-light);
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.08);
}

/* Card Section Header */
.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: var(--text-lg);
    color: var(--slate-900);
    margin: 0;
    font-weight: var(--font-extrabold);
    letter-spacing: -0.01em;
}

/* Step Number Indicator */
.step-badge {
    background-image: var(--primary-gradient);
    color: var(--text-inverse);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    font-weight: var(--font-black);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    flex-shrink: 0;
}

/* --- 12.1 Interactive Drop Zone --- */
.drop-zone {
    border: 2.5px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-5);
    text-align: center;
    background-color: var(--slate-50);
    transition-property: background-color, border-color, transform;
    transition-duration: var(--transition-normal);
    transition-timing-function: var(--ease-out);
    margin-bottom: var(--space-4);
    cursor: pointer;
    position: relative;
    outline: none;
}

.drop-zone:focus-visible {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

.drop-zone:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.drop-zone:active {
    transform: scale(0.98);
}

/* Drag-over state controlled via JS */
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.upload-icon {
    font-size: var(--text-4xl);
    display: block;
    margin-bottom: var(--space-3);
    opacity: 0.8;
    transition: transform var(--transition-fast) var(--ease-spring);
}

.drop-zone:hover .upload-icon {
    transform: translateY(-4px) scale(1.1);
    opacity: 1;
}

.drop-zone .primary-text {
    font-weight: var(--font-extrabold);
    margin-bottom: var(--space-1);
    color: var(--slate-900);
    font-size: var(--text-lg);
}

.drop-zone .secondary-text {
    font-size: var(--text-sm);
    color: var(--slate-500);
    margin-bottom: var(--space-5);
}

/* Upload Action Buttons inside Drop Zone */
.upload-actions {
    display: flex;
    flex-direction: row;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-4);
    pointer-events: none; /* Let parent handle clicks */
}

.upload-actions button {
    flex: 1;
    height: 48px;
    background-color: var(--bg-card);
    pointer-events: auto; /* Re-enable clicks for actual buttons */
    box-shadow: var(--shadow-sm);
}

/* --- 12.2 File Preview Grid --- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
    margin-bottom: var(--space-3);
}

.preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-medium);
    background-color: var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    animation: scaleIn var(--transition-normal) var(--ease-spring);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow) var(--ease-out);
}

.preview-item:hover img {
    transform: scale(1.1);
}

.btn-remove-file {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(220, 38, 38, 0.95);
    color: var(--text-inverse);
    width: 24px;
    height: 24px;
    min-height: 24px;
    font-size: 0.7rem;
    font-weight: var(--font-black);
    border-radius: var(--radius-full);
    padding: 0;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform var(--transition-fast) var(--ease-out);
}

.btn-remove-file:hover {
    background-color: var(--error-700);
    transform: scale(1.15);
}

.btn-remove-file:active {
    transform: scale(0.9);
}

/* Limit Information Texts */
.upload-limits-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
}

.hint-text {
    font-size: var(--text-xs);
    color: var(--slate-500);
    line-height: var(--leading-normal);
}

.warning-text {
    color: var(--warning-700);
    font-weight: var(--font-semibold);
}

/* --- 12.3 Form Input Controls --- */
.form-group {
    margin-bottom: var(--space-5);
    position: relative;
    width: 100%;
}

.form-row {
    display: flex;
    flex-direction: row;
    gap: var(--space-4);
    width: 100%;
}

.half-width {
    flex: 1;
    min-width: 0; /* Prevents flex flex-grow overflow on small devices */
}

/* Standard Label Styling */
.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
    color: var(--slate-800);
    letter-spacing: 0.02em;
}

.required-asterisk {
    color: var(--error-600);
    font-weight: var(--font-black);
    margin-left: 2px;
}

/* Unified Form Control Input/Select */
.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    background-color: var(--slate-50);
    color: var(--slate-900);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition-property: border-color, background-color, box-shadow;
    transition-duration: 0.2s;
    transition-timing-function: var(--ease-out);
    font-weight: var(--font-medium);
}

/* Focus States for Inputs */
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-card);
    box-shadow: var(--shadow-focus);
}

/* Invalid States */
.form-control:invalid:focus {
    border-color: var(--error-500);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Disabled States */
.form-control:disabled {
    background-color: var(--slate-100);
    color: var(--slate-400);
    cursor: not-allowed;
    border-color: var(--border-light);
}

/* Custom Select Dropdown Chevron Injection */
select.form-control {
    /* Injecting a custom SVG chevron down arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 12px auto;
    padding-right: 44px; /* Ensure text doesn't overlap arrow */
    cursor: pointer;
}

/* Placeholder styling */
.form-control::placeholder {
    color: var(--slate-400);
    opacity: 1;
}

/* --- 12.4 Custom Range Slider Component --- */
.slider-container {
    background-color: var(--bg-card);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-top: var(--space-2);
}

.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.label-with-value label {
    margin-bottom: 0; /* Override default */
}

/* Value Display Badge */
.range-value {
    font-weight: var(--font-black);
    color: var(--primary-color);
    font-size: var(--text-xl);
    background-color: var(--primary-light);
    padding: 4px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-border);
    font-variant-numeric: tabular-nums;
}

/* HTML5 Range Input Styling Strip Down */
.styled-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background-color: var(--slate-200);
    border-radius: var(--radius-full);
    outline: none;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
}

/* Track focus state */
.styled-slider:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Webkit Slider Thumb */
.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-image: var(--primary-gradient);
    cursor: pointer;
    border: 4px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    transition: transform var(--transition-fast) var(--ease-spring);
}

.styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.styled-slider::-webkit-slider-thumb:active {
    transform: scale(0.95);
    background-image: none;
    background-color: var(--primary-hover);
}

/* Mozilla Slider Thumb */
.styled-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-color);
    cursor: pointer;
    border: 4px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    transition: transform var(--transition-fast) var(--ease-spring);
}

/* Slider Tick Marks */
.slider-marks {
    display: flex;
    justify-content: space-between;
    padding-top: var(--space-2);
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.slider-marks span {
    font-size: var(--text-xs);
    color: var(--slate-400);
    font-weight: var(--font-bold);
}

/* --- 12.5 Custom iOS-Style Toggle Switch --- */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.toggle-text label {
    margin-bottom: 4px;
    font-size: var(--text-base);
    color: var(--slate-900);
    font-weight: var(--font-extrabold);
}

/* Switch Container */
.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 32px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* The Background Track */
.slider.round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--slate-300);
    transition: background-color 0.4s;
    border-radius: 34px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* The Moving Thumb */
.slider.round:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Checked States */
input:checked + .slider.round {
    background-color: var(--success-600);
}

input:checked + .slider.round:before {
    /* 56px width - 24px thumb - 8px padding = 24px transform */
    transform: translateX(24px);
}

/* Focus state for accessibility */
input:focus-visible + .slider.round {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* --- 12.6 Sticky Submit Area (Glassmorphism Footer) --- */
.form-submit-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding-top: var(--space-4);
    padding-bottom: var(--space-5);
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    box-shadow: 0 -4px 30px rgba(15, 23, 42, 0.08);
    z-index: var(--z-sticky);
    max-width: var(--max-w-app);
    margin-left: auto;
    margin-right: auto;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.cost-indicator {
    text-align: center;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
    color: var(--slate-600);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cost-value {
    color: var(--warning-700);
    font-size: var(--text-lg);
    font-weight: var(--font-black);
    background-color: var(--warning-100);
    padding: 2px 10px;
    border-radius: var(--radius-md);
    margin-left: var(--space-2);
    border: 1px solid var(--warning-border);
    font-variant-numeric: tabular-nums;
}

/* Loading Spinner CSS */
.loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.terms-micro-text {
    font-size: 0.7rem;
    color: var(--slate-400);
    margin-top: var(--space-2);
    text-align: center;
    line-height: var(--leading-tight);
}

/* ==========================================================================
   13. VIEW 6: LIVE QUIZ / CBT EXAM ENGINE
   ========================================================================== */
/* Core Quiz View Constraints */
#view-live-quiz {
    background-color: var(--slate-50);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0; /* Override default padding */
}

/* --- 13.1 Exam Fixed Header --- */
.quiz-header {
    padding-top: var(--space-4);
    padding-bottom: var(--space-3);
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    border-bottom: 1px solid var(--border-medium);
    background-color: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-sm);
}

.quiz-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.quiz-title-truncate {
    font-weight: var(--font-black);
    font-size: var(--text-lg);
    color: var(--slate-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
    margin: 0;
    letter-spacing: -0.02em;
}

/* Advanced Timer Badge States */
.timer-badge {
    background-color: var(--bg-card);
    color: var(--slate-800);
    font-weight: var(--font-black);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

/* --- 13.2 Progress Bar --- */
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--slate-200);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-2);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.progress-bar-fill {
    height: 100%;
    background-image: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy fill */
    will-change: width;
}

.question-tracker {
    font-size: var(--text-sm);
    color: var(--slate-500);
    font-weight: var(--font-bold);
    text-align: right;
    display: block;
}

#current-q-num {
    color: var(--slate-900);
    font-size: var(--text-base);
}

/* --- 13.3 Quiz Body Scrollable Area --- */
.quiz-body {
    flex-grow: 1;
    padding-top: var(--space-6);
    padding-bottom: 140px; /* Space for fixed action footer */
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Question Content Container */
.question-container {
    margin-bottom: var(--space-6);
    background-color: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    border-left: 5px solid var(--primary-color);
}

#question-text {
    font-size: 1.25rem;
    line-height: var(--leading-relaxed);
    font-weight: var(--font-bold);
    color: var(--slate-900);
    word-wrap: break-word;
}

/* --- 13.4 Premium Options Grid (Radio Buttons) --- */
.options-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.option-label {
    cursor: pointer;
    display: block;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

/* Hide true radio input visually but keep for screen readers */
.option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* Option Box Styling */
.option-box {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-xl);
    background-color: var(--bg-card);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: var(--space-4);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.02);
}

/* Option Letter Circle (A, B, C, D) */
.option-letter {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--slate-50);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-black);
    color: var(--slate-500);
    flex-shrink: 0;
    transition: all 0.25s ease;
    font-size: var(--text-lg);
}

/* Option Text Typography */
.option-text {
    font-size: 1.1rem;
    line-height: var(--leading-normal);
    color: var(--slate-800);
    flex-grow: 1;
    font-weight: var(--font-medium);
}

/* --- Hover and Selected States --- */
.option-label:hover .option-box {
    border-color: var(--brand-400);
    background-color: var(--slate-50);
}

.option-label input[type="radio"]:focus-visible + .option-box {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

.option-label input[type="radio"]:checked + .option-box {
    border-color: var(--primary-color);
    background-color: var(--brand-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.option-label input[type="radio"]:checked + .option-box .option-letter {
    background-image: var(--primary-gradient);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.option-label input[type="radio"]:checked + .option-box .option-text {
    color: var(--primary-active);
    font-weight: var(--font-bold);
}

/* --- Review Mode Specific Solution Coloring --- */
/* Disables pointer events visually when in review mode */
.option-box.correct-option {
    border-color: var(--success-600);
    background-color: var(--success-50);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.option-box.correct-option .option-letter {
    background-image: none;
    background-color: var(--success-600);
    color: var(--text-inverse);
    border-color: var(--success-600);
}

.option-box.wrong-option {
    border-color: var(--error-600);
    background-color: var(--error-50);
}

.option-box.wrong-option .option-letter {
    background-image: none;
    background-color: var(--error-600);
    color: var(--text-inverse);
    border-color: var(--error-600);
}

/* --- 13.5 In-Exam Actions (Bookmark) --- */
.review-action-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-6);
}

.btn-bookmark {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--slate-600);
    background-color: var(--bg-card);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.btn-bookmark:hover {
    background-color: var(--slate-50);
}

.btn-bookmark.flagged {
    color: var(--warning-700);
    background-color: var(--warning-50);
    border-color: var(--warning-border);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
}

/* --- 13.6 AI Solution Explanation Box --- */
.ai-explanation {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 6px solid var(--brand-500);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-5);
    margin-top: var(--space-4);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.solution-heading {
    color: var(--brand-700);
    font-size: 1.15rem;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 8px;
}

#ai-solution-text {
    color: var(--slate-800);
    font-size: 1.05rem;
    line-height: var(--leading-relaxed);
    font-weight: var(--font-medium);
}

/* --- 13.7 Quiz Sticky Footer Action --- */
.single-action-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-top: var(--space-4);
    padding-bottom: var(--space-5);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    box-shadow: var(--shadow-footer);
    max-width: var(--max-w-app);
    margin-left: auto;
    margin-right: auto;
    z-index: var(--z-sticky);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* ==========================================================================
   14. VIEW 7: REPORT & SCORECARD
   ========================================================================== */
.report-scroll-area {
    padding-top: var(--space-4);
    padding-bottom: 120px;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    overflow-y: auto;
}

/* --- 14.1 Score Hero Card --- */
.score-card-hero {
    background-color: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: var(--space-8) var(--space-5);
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: var(--space-6);
    border: 1px solid rgba(15, 23, 42, 0.04);
}

/* SVG Circular Chart Core */
.score-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: var(--space-5);
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.08));
}

.circle-bg {
    fill: none;
    stroke: var(--slate-100);
    stroke-width: 2.8;
}

.circle-fill {
    fill: none;
    stroke: var(--primary-color); /* Overwritten by JS based on score */
    stroke-width: 3.2;
    stroke-linecap: round;
    /* This animation is critical for the "filling" effect */
    transition: stroke-dasharray 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Text centered inside SVG */
.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-big {
    font-size: 4rem;
    font-weight: var(--font-black);
    color: var(--slate-900);
    line-height: 1;
    letter-spacing: -0.05em;
}

.score-total {
    font-size: 1.25rem;
    color: var(--slate-500);
    font-weight: var(--font-bold);
    margin-top: 4px;
}

/* Verdict Typography */
.score-verdict h3 {
    font-size: 1.7rem;
    color: var(--primary-color); /* Overwritten by JS */
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

#verdict-subtitle {
    font-size: var(--text-sm);
    color: var(--slate-500);
}

/* --- 14.2 Statistics Grid --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-box {
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-box.success-bg { border-color: var(--success-border); }
.stat-box.error-bg { border-color: var(--error-border); }
.stat-box.warning-bg { border-color: var(--warning-border); }
.stat-box.neutral-bg { border-color: var(--border-medium); }

.stat-box .stat-icon {
    font-size: 1.8rem;
    margin-bottom: var(--space-2);
}

.stat-box .stat-num {
    font-size: 2rem;
    font-weight: var(--font-black);
    line-height: 1;
    color: inherit; /* Inherits from specific semantic class */
}

.stat-box .stat-label {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    margin-top: 8px;
    color: inherit;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- 14.3 Promotional Banner --- */
.promo-banner {
    background-image: linear-gradient(to right, var(--slate-900), var(--brand-900));
    color: white;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s;
}

.promo-banner:active {
    transform: scale(0.98);
}

.promo-content h4 {
    font-size: var(--text-lg);
    margin-bottom: 2px;
    color: var(--warning-500);
}

.promo-content p {
    font-size: var(--text-sm);
    color: var(--slate-300);
}

.promo-arrow {
    font-size: 2rem;
    font-weight: 300;
}

/* --- 14.4 Report Footer Actions --- */
.report-action-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    padding-top: var(--space-4);
    padding-bottom: var(--space-5);
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    display: flex;
    gap: var(--space-3);
    box-shadow: var(--shadow-footer);
    max-width: var(--max-w-app);
    margin-left: auto;
    margin-right: auto;
    z-index: var(--z-sticky);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* ==========================================================================
   15. VIEW 8: STORE / BUY CREDITS
   ========================================================================== */
.store-container {
    padding-bottom: var(--space-12);
}

/* --- 15.1 Wallet Status Hero --- */
.wallet-status-box {
    background-color: var(--slate-900);
    color: var(--text-inverse);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.4);
    border: 1px solid var(--slate-700);
    position: relative;
    overflow: hidden;
}

/* Decorative background for dark hero */
.wallet-status-box::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background-color: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.coin-icon.large {
    font-size: 3.5rem;
    background-color: rgba(255,255,255,0.05);
    padding: var(--space-4);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.wallet-text {
    z-index: 1;
}

.wallet-text h4 {
    font-size: 1.05rem;
    color: var(--slate-400);
    font-weight: var(--font-semibold);
    margin-bottom: 4px;
}

.wallet-text p {
    font-size: 2.5rem;
    color: var(--text-inverse);
    font-weight: var(--font-black);
    letter-spacing: -0.02em;
    line-height: 1;
}

.wallet-text strong {
    color: var(--warning-500); /* Gold color for coins */
}

/* --- 15.2 Pricing Plans Grid --- */
.pricing-plans {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.plan-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: relative;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), border-color 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
    border-color: var(--brand-300);
    transform: translateY(-2px);
}

/* Popular Plan Highlight */
.popular-plan {
    border: 2.5px solid var(--primary-color);
    box-shadow: 0 15px 35px -5px rgba(67, 56, 202, 0.15);
    transform: scale(1.02);
}

.popular-plan:hover {
    border-color: var(--primary-hover);
    transform: scale(1.02) translateY(-2px);
}

.popular-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background-image: var(--primary-gradient);
    color: var(--text-inverse);
    font-size: 0.8rem;
    font-weight: var(--font-black);
    padding: 6px 20px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    white-space: nowrap;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--slate-100);
}

.plan-header h3 {
    font-size: 1.5rem;
    color: var(--slate-900);
    margin-bottom: 4px;
}

.plan-desc {
    font-size: 0.85rem;
    color: var(--slate-500);
}

.plan-price {
    font-size: 2.5rem;
    font-weight: var(--font-black);
    color: var(--slate-900);
    letter-spacing: -0.05em;
}

/* Plan Features List */
.plan-features {
    list-style: none;
    margin-bottom: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.plan-features li {
    font-size: 1.05rem;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: var(--font-medium);
}

/* --- 15.3 Checkout Form Area --- */
.checkout-form {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-10);
    animation: slideUpFade 0.4s var(--ease-out);
}

/* Legal Terms Checkbox Area */
.legal-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    background-color: var(--slate-50);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.legal-checkbox-group input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-top: 2px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.legal-checkbox-group input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.terms-label {
    font-size: 0.85rem;
    color: var(--slate-600);
    font-weight: var(--font-medium);
    line-height: var(--leading-relaxed);
    margin: 0;
    cursor: pointer;
}

.terms-label a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: var(--font-bold);
}

.secure-badge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px dashed var(--border-light);
    padding-top: var(--space-3);
    margin-top: var(--space-4);
}

.secure-badge {
    font-size: 0.9rem;
    color: var(--success-700);
    font-weight: var(--font-bold);
    background-color: var(--success-50);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--success-border);
}

.payment-methods-text {
    font-size: 0.75rem;
    color: var(--slate-400);
}

/* ==========================================================================
   16. VIEW 9: POLICIES & LEGAL
   ========================================================================== */
.policy-content-box {
    padding-top: var(--space-4);
    padding-bottom: var(--space-12);
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    background-color: var(--bg-card);
    min-height: 80vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-8);
}

/* Long Form Typography Overrides */
.policy-text h3 {
    font-size: 1.7rem;
    color: var(--slate-900);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--border-light);
    letter-spacing: -0.02em;
}

.policy-text h4 {
    font-size: 1.25rem;
    color: var(--slate-800);
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.policy-date {
    font-size: 0.9rem;
    color: var(--slate-500);
    margin-bottom: var(--space-6) !important;
}

.policy-text p {
    font-size: 1.05rem;
    color: var(--slate-700);
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.policy-text ul {
    padding-left: var(--space-6);
    margin-bottom: var(--space-5);
    list-style-type: disc;
}

.policy-text li {
    font-size: 1.05rem;
    color: var(--slate-700);
    margin-bottom: var(--space-3);
    line-height: 1.6;
    padding-left: var(--space-1);
}

.policy-text strong {
    color: var(--slate-900);
    font-weight: var(--font-bold);
}

/* Alert Boxes inside text */
.alert-box {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    background-color: var(--slate-50);
}

.alert-danger {
    border-left-color: var(--error-600);
    background-color: var(--error-50);
    color: var(--error-700);
}

/* Address Styling */
.contact-address {
    font-style: normal;
    background-color: var(--slate-50);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--slate-700);
}

/* ==========================================================================
   17. VIEW 10: HELP & SUPPORT
   ========================================================================== */
.support-container {
    padding-bottom: var(--space-10);
}

.support-info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.info-card {
    background-color: var(--bg-card);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.info-card .info-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-2);
}

.info-card h4 {
    color: var(--slate-900);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.info-card p {
    color: var(--primary-color);
    font-weight: var(--font-bold);
    font-size: 0.9rem;
    margin-bottom: 8px;
    word-break: break-all;
}

.info-card small {
    color: var(--slate-500);
    font-size: 0.75rem;
}

/* Support Form overrides */
.support-form {
    background-color: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ==========================================================================
   18. VIEW 11: FAQs
   ========================================================================== */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-bottom: var(--space-10);
}

.faq-item {
    background-color: var(--bg-card);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-200);
}

.faq-question {
    font-size: 1.15rem;
    color: var(--slate-900);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.faq-question::before {
    content: 'Q.';
    color: var(--primary-color);
    font-weight: var(--font-black);
}

.faq-answer {
    font-size: 1rem;
    color: var(--slate-600);
    line-height: 1.6;
    padding-left: 28px; /* Align with text after Q. */
}

/* ==========================================================================
   19. KEYFRAMES & ANIMATIONS
   ========================================================================== */

/* Universal Fade up for screen transitions */
@keyframes slideUpFade { 
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

/* Alert/Timer pulsing urgency */
@keyframes pulseWarning {
    0% { 
        opacity: 1; 
        transform: scale(1); 
        box-shadow: 0 0 0 rgba(220, 38, 38, 0); 
    }
    100% { 
        opacity: 0.85; 
        transform: scale(1.03); 
        box-shadow: 0 0 12px rgba(220, 38, 38, 0.5); 
    }
}

/* Loading spinner */
@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* Skeleton Loading shimmer effect */
@keyframes loadingSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Image preview scaling */
@keyframes scaleIn {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* Solution Box sliding in */
@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   20. RESPONSIVE DESIGN & MEDIA QUERIES
   ========================================================================== */

/* --- Constraints for very small devices (e.g., iPhone SE) --- */
@media (max-width: 380px) {
    :root {
        /* Slightly reduce padding on small phones */
        --space-4: 12px;
        --space-5: 16px;
        --space-6: 20px;
    }

    h2 { font-size: 1.4rem; }
    
    .dashboard-stats-row {
        gap: var(--space-2);
    }
    
    .ds-val { font-size: 1.5rem; }
    .ds-icon { width: 36px; height: 36px; font-size: 1.4rem; }
    
    .plan-price { font-size: 2rem; }
    .score-big { font-size: 3rem; }
    .score-circle { width: 140px; height: 140px; }
}

/* --- Constraints for Desktop/Tablet (Wrapping the mobile view) --- */
@media (min-width: 481px) {
    body {
        /* Center the app on large screens with a subtle background */
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--slate-800); /* Dark theater mode outside app */
        background-image: radial-gradient(circle at center, var(--slate-700) 0%, var(--slate-900) 100%);
    }

    #app-wrapper {
        height: 100vh;
        max-height: 900px; /* Prevent it getting ridiculously tall on 4k */
        border-radius: var(--radius-xl);
        overflow: hidden;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        border: 4px solid var(--slate-900);
        margin-top: 2vh;
        margin-bottom: 2vh;
    }

    /* Adjust fixed elements relative to absolute wrapper on desktop */
    #top-nav {
        position: absolute;
        width: 100%;
    }

    .form-submit-area,
    .single-action-footer,
    .report-action-footer {
        position: absolute; /* Changes from fixed to absolute to stay inside app wrapper */
        bottom: 0;
        border-radius: 0 0 calc(var(--radius-xl) - 4px) calc(var(--radius-xl) - 4px);
    }

    #sidebar {
        position: absolute; /* Ensures sidebar doesn't bleed out of desktop wrapper */
    }
}

/* ==========================================================================
   21. ACCESSIBILITY (A11Y) OVERRIDES
   ========================================================================== */
/* High Contrast Mode fallback */
@media (prefers-contrast: more) {
    :root {
        --primary-color: #0000ff;
        --slate-500: #333333;
        --border-medium: #000000;
        --success-600: #006600;
        --error-600: #cc0000;
    }
    
    .btn-primary { background-image: none; background-color: var(--primary-color); }
    .form-control { border-width: 2px; }
}

/* ==========================================================================
   22. PRINT STYLES (For Exporting Report/Solutions)
   ========================================================================== */
@media print {
    body, #app-wrapper {
        background-color: white !important;
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Hide non-printable UI elements */
    #top-nav,
    #sidebar,
    .report-action-footer,
    .promo-banner,
    .btn-back,
    .single-action-footer,
    .review-action-container {
        display: none !important;
    }

    /* Expand containers for full-page printing */
    #main-content,
    .screen-view,
    .report-scroll-area,
    .quiz-body {
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .score-card-hero {
        box-shadow: none !important;
        border: 2px solid black !important;
        page-break-inside: avoid;
    }

    /* Ensure backgrounds print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Reset Typography for Print */
    h2, h3, h4, p, span, div {
        color: black !important;
    }

    .option-box {
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }

    .ai-explanation {
        border: 1px solid #000 !important;
        border-left: 4px solid #000 !important;
        page-break-inside: avoid;
    }

    /* Page Setup */
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }
}
/* ==========================================================================
   WELCOME MODAL CSS
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 23, 42, 0.85); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    opacity: 1; transition: opacity 0.3s ease; padding: 16px;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
/* 🔥 MODAL CONTAINER SETTINGS */
.modal-content {
    background-color: var(--bg-card); 
    padding: 32px 24px;
    border-radius: 24px; 
    text-align: center; 
    max-width: 400px; 
    width: 100%;
    transform: scale(1); 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    
    /* Phone screens ke liye auto-scroll fix */
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain; 
    
    /* Firefox ke liye thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.modal-overlay.hidden .modal-content { 
    transform: scale(0.95) translateY(20px); 
}

.modal-icon { 
    font-size: 3.5rem; 
    display: block; 
    margin-bottom: 16px; 
    text-shadow: 0 4px 10px rgba(0,0,0,0.1); 
}

/* 🔥 CUSTOM THIN GREY SCROLLBAR (Chrome, Safari, Edge) */
.modal-content::-webkit-scrollbar {
    width: 5px; 
}

.modal-content::-webkit-scrollbar-track {
    background: transparent; 
    margin: 10px 0; 
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1; 
    border-radius: 10px; 
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8; 
}
/* ==========================================================================
   DARK THEME VARIABLES & OVERRIDES (100% WORKING)
   ========================================================================== */
body.dark-theme {
    /* Main body background outside the app wrapper */
    background-color: #020617; 

    /* Mapping exact variables from your :root */
    --bg-main: #0f172a;       /* Deep dark blue for main app background */
    --bg-card: #1e293b;       /* Slightly lighter dark for cards */
    --text-main: #f8fafc;     /* Bright white for text */
    --text-muted: #94a3b8;    /* Muted grey for secondary text */
    --border-color: #334155;  /* Dark borders */
}

/* 1. Override Hardcoded White Backgrounds (Cards & Containers) */
body.dark-theme .profile-card,
body.dark-theme .join-group-card,
body.dark-theme .premium-card,
body.dark-theme .how-it-works-section,
body.dark-theme .policy-content-box,
body.dark-theme .question-container,
body.dark-theme .score-card-hero,
body.dark-theme .checkout-form {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 2. Override Hardcoded White/Glassmorphism Headers & Footers */
body.dark-theme #top-nav,
body.dark-theme .sticky-header,
body.dark-theme .form-submit-area,
body.dark-theme .quiz-header,
body.dark-theme .single-action-footer,
body.dark-theme .report-action-footer {
    background: rgba(30, 41, 59, 0.92) !important; /* Dark glassmorphism */
    border-color: var(--border-color) !important;
}

/* 3. Inputs, Sliders, and Small Gray Boxes */
body.dark-theme .form-control,
body.dark-theme .cost-summary-container,
body.dark-theme .hc-stats,
body.dark-theme .step-item,
body.dark-theme .slider-container,
body.dark-theme .legal-checkbox-group,
body.dark-theme .stat-box.neutral-bg {
    background-color: var(--bg-main);
    color: var(--text-main);
    border-color: var(--border-color);
}

/* 4. Text Forcing (Ensuring Headings & Labels turn white) */
body.dark-theme h1, 
body.dark-theme h2, 
body.dark-theme h3, 
body.dark-theme h4, 
body.dark-theme label, 
body.dark-theme .score-big, 
body.dark-theme .plan-price, 
body.dark-theme #question-text {
    color: var(--text-main) !important;
}

body.dark-theme .secondary-action h3 {
    color: var(--primary-light);
}

/* 5. Dropzone & File Preview */
body.dark-theme .drop-zone {
    background-color: var(--bg-main);
    border-color: var(--border-color);
}
body.dark-theme .preview-item {
    background-color: #020617;
    border-color: var(--border-color);
}

/* 6. Fix for Option Selection (MCQs) in Dark Mode */
body.dark-theme .option-box {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}
body.dark-theme .option-letter {
    background-color: var(--bg-main);
    color: var(--text-muted);
    border-color: var(--border-color);
}


/* ==========================================================================
   PREMIUM COST SUMMARY UI (UPLOAD PAGE)
   ========================================================================== */
.cost-summary-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--slate-50);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    margin-bottom: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.cost-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cost-title {
    font-size: 0.9rem;
    font-weight: var(--font-extrabold);
    color: var(--slate-800);
}

.cost-subtitle {
    font-size: 0.75rem;
    color: var(--slate-500);
    font-weight: var(--font-medium);
}

.cost-badge {
    background-image: linear-gradient(135deg, var(--warning-50) 0%, var(--warning-100) 100%);
    border: 1px solid var(--warning-border);
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    align-items: baseline;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.15);
}

.cost-badge .cost-value {
    font-size: 1.25rem;
    font-weight: var(--font-black);
    color: var(--warning-700);
    line-height: 1;
}

.cost-badge .cost-currency {
    font-size: 0.75rem;
    font-weight: var(--font-bold);
    color: var(--warning-600);
    text-transform: uppercase;
}

/* Dark theme support for the new cost box */
body.dark-theme .cost-summary-container {
    background-color: var(--slate-100);
    border-color: var(--border-light);
}
body.dark-theme .cost-title {
    color: var(--text-primary);
}
body.dark-theme .cost-subtitle {
    color: var(--text-secondary);
}

/* Fix for sticky footers lifting up during scroll */
.form-submit-area,
.single-action-footer,
.report-action-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 480px !important;
    z-index: 100 !important;
}

/* ==========================================================================
   🚨 UX IMPROVEMENTS: FONTS, BADGES, COMPACT CARDS & DUAL FOOTER
   ========================================================================== */
/* 1. Dual Action Sticky Footer */
.dual-action-footer {
    display: flex; gap: 12px;
    position: sticky !important; bottom: 0 !important; left: 0 !important;
    width: 100% !important; z-index: 999 !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light); padding: 16px;
}
body.dark-theme .dual-action-footer { 
    background-color: rgba(30, 41, 59, 0.95) !important; border-color: var(--border-color) !important; 
}

/* 2. Professional Fonts for Test Paper (Menu-sized) */
#question-text { font-size: 1.05rem !important; line-height: 1.5 !important; }
.option-box { padding: 12px 16px !important; gap: 12px !important; min-height: 48px !important; }
.option-letter { width: 32px !important; height: 32px !important; font-size: 0.9rem !important; }
.option-text { font-size: 0.95rem !important; }

/* 3. Review Mode Badges (Missed & Bookmarked) */
.q-badges-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.q-badges-row:empty { margin-bottom: 0; }
.badge-bookmarked { background-color: var(--warning-50); color: var(--warning-700); border: 1px solid var(--warning-border); }
.badge-missed { background-color: var(--slate-100); color: var(--slate-600); border: 1px solid var(--border-medium); }
body.dark-theme .badge-missed { background-color: var(--slate-800); color: var(--slate-300); border-color: var(--slate-700); }

/* 4. Compact Past Quizzes History Card */
.history-card { padding: 16px !important; }
.hc-title h4 { font-size: 1rem !important; }
.hc-stats { padding: 8px 12px !important; margin-bottom: 12px !important; font-size: 0.8rem !important; }
.hc-stats strong { font-size: 0.9rem !important; }
.hc-actions button { height: 36px !important; font-size: 0.8rem !important; padding: 0 10px !important; }
/* ==========================================================================
   🚨 REVIEW MODE: STRICT RED & GREEN BORDER LOGIC (DARK/LIGHT SAFE)
   ========================================================================== */

/* 1. Correct Option (Always Green, whether user selected it or not) */
.option-box.correct-option,
body.dark-theme .option-box.correct-option {
    border-color: var(--success-600) !important;
    background-color: var(--success-50) !important;
}

/* Dark mode specific subtle green background */
body.dark-theme .option-box.correct-option {
    background-color: rgba(5, 150, 105, 0.15) !important; 
}

/* Green Circle for correct option */
.option-box.correct-option .option-letter,
body.dark-theme .option-box.correct-option .option-letter {
    background-color: var(--success-600) !important;
    color: white !important;
    border-color: var(--success-600) !important;
}


/* 2. Wrong Option (Only Red if User Selected It) */
.option-box.wrong-option,
body.dark-theme .option-box.wrong-option {
    border-color: var(--error-600) !important;
    background-color: var(--error-50) !important;
}

/* Dark mode specific subtle red background */
body.dark-theme .option-box.wrong-option {
    background-color: rgba(225, 29, 72, 0.15) !important;
}

/* Red Circle for wrong option */
.option-box.wrong-option .option-letter,
body.dark-theme .option-box.wrong-option .option-letter {
    background-color: var(--error-600) !important;
    color: white !important;
    border-color: var(--error-600) !important;
}

/* 🔥 SPLASH SCREEN STYLES (Full screen overlay) */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #090d16; /* Ekdam dark premium theme */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999; /* Sabse upar dikhega */
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
}

.splash-logo {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 5px;
    animation: pulseLogo 1.2s infinite ease-in-out;
}

.splash-logo span {
    color: #4338ca; /* Tera primary brand color */
}

.splash-tagline {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.splash-loader {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(67, 56, 202, 0.2);
    border-top: 3px solid #4338ca;
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spinLoader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseLogo {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.04); opacity: 1; }
}

/* 🔥 QUIZ SCREEN SPACING FIXES (Anti-Scroll) */
.quiz-body {
    padding: 10px 15px !important;
    margin-bottom: 70px !important; /* Footer overlaps preventer */
}
.question-container {
    margin-bottom: 12px !important; /* Sawal aur option ke bich ki space kam ki */
}
.question-container h3 {
    font-size: 1.05rem !important; /* Font thoda optimize kiya */
    line-height: 1.4 !important;
}
.option-label {
    margin-bottom: 6px !important; /* Options ke bich ka gap tightly pack kiya */
}
.option-box {
    padding: 10px 14px !important; /* Option box ko thoda patla kiya */
}
.quiz-footer.dual-action-footer {
    padding: 10px 15px !important; /* Bottom buttons ki height adjust ki */
}
.ai-explanation {
    margin-top: 15px !important;
    padding: 12px !important;
}

/* =========================================================
   🔥 CUSTOM TOAST NOTIFICATIONS (PREMIUM UX)
   ========================================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    min-width: 280px;
    max-width: 380px;
    padding: 16px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.4s ease;
    opacity: 0;
    border-left: 5px solid var(--primary-color);
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.hide {
    transform: translateX(120%);
    opacity: 0;
}
.toast-icon { font-size: 1.4rem; line-height: 1; }
.toast-content { flex: 1; }
.toast-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; color: var(--slate-800); }
.toast-message { font-size: 0.85rem; color: var(--slate-600); line-height: 1.4; white-space: pre-wrap; }
.toast-close { background: none; border: none; font-size: 1.2rem; color: var(--slate-400); cursor: pointer; padding: 0; line-height: 1; margin-left: auto; }
.toast-close:hover { color: var(--error-500); }

/* Types */
.toast.success { border-left-color: var(--success-500); }
.toast.error { border-left-color: var(--error-500); }
.toast.warning { border-left-color: var(--warning-500); }
.toast.info { border-left-color: var(--primary-500); }

/* =========================================================
   🔥 MOBILE OPTIMIZATION: QUESTION PALETTE SHRINK (FIXED)
   ========================================================= */
@media screen and (max-width: 768px) {
    /* 1. Main Palette container ki padding kam karna */
    #nta-palette {
        padding: 10px !important;
    }
    
    /* 2. Grid (Jahan buttons hote hain) ka gap kam karna */
    #nta-grid {
        gap: 6px !important;
        /* Mobile me buttons fit karne ke liye width 40px se 32px kar di */
        grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)) !important; 
    }
    
    /* 3. JS se jo bhi Buttons banenge unko direct chhota karna */
    #nta-grid button, #nta-grid div {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
        line-height: 32px !important;
        padding: 0 !important;
        border-radius: 6px !important;
    }

    /* 4. Upar ke indicators (Answered, Marked) ka text chhota karna */
    #nta-palette-content > div:first-child {
        gap: 8px !important;
        margin-bottom: 10px !important;
        font-size: 0.65rem !important; /* Text aur chhota */
    }
    
    /* 5. Indicator wale gol circles (green/red/yellow) ko chhota karna */
    #nta-palette-content > div:first-child div {
        width: 9px !important;
        height: 9px !important;
    }
}