/**
 * ==============================================================================================
 * PROJECT: QUESTGEN PRO - LIQUID INTELLIGENCE UI (MASTER SYSTEM)
 * VERSION: 14.0.0 (FINAL PRODUCTION RELEASE)
 * AUTHOR: Lead Frontend Architect
 * * DESCRIPTION:
 * This is the complete, high-performance styling engine for the QuestGen platform.
 * It implements the "Liquid Metal" design language with a strict mobile-first architecture.
 * * CRITICAL FIXES APPLIED IN THIS BUILD:
 * 1. [CROP ENGINE] Removed conflicting dimensional constraints on the source image. 
 * The cropping library now calculates coordinates freely within a locked full-screen container.
 * 2. [PRIVACY PAGE] Restored the static background layer (#bg-static) to ensure visibility 
 * on pages where the video background is absent.
 * 3. [LAYOUT ENGINE] Enforced vertical expansion (min-height: 70vh) on result blocks to 
 * eliminate whitespace on laptop screens.
 * 4. [GRID SYSTEM] Implemented 'auto-fit' logic to perfectly balance 2-column (Exam) 
 * and 3-column (Practice) layouts automatically.
 * * TABLE OF CONTENTS:
 * [1.0]  Design Tokens (Root Variables)
 * [2.0]  CSS Reset & Normalization
 * [3.0]  Global Document Styles
 * [4.0]  Background Rendering Engine
 * [5.0]  Layout & Container System
 * [6.0]  Header & Brand Identity
 * [7.0]  Glassmorphism Surface Engine
 * [8.0]  Form Control System
 * [9.0]  Upload & Camera Interface
 * [10.0] Interaction Component Library
 * [11.0] Result Card Architecture
 * [12.0] Modal System (Crop & Alerts)
 * [13.0] Footer Architecture
 * [14.0] Animation Keyframes
 * [15.0] Responsive Media Queries
 * [16.0] Print Styles
 * ==============================================================================================
 */

/* ==========================================================================
   1.0 - DESIGN TOKENS (ROOT VARIABLES)
   ========================================================================== */
:root[data-theme="dark"] {
    
    /* 1.1 - Core Palette (Deep Ocean / Liquid Metal)
       ---------------------------------------------------------------------- */
    /* Background Colors */
    --bg-void: #02040a;       /* Deepest Black-Blue */
    --bg-deep: #050a14;       /* Secondary Depth */
    --bg-overlay: #000000;    /* Pure Black for Overlays */
    
    /* Glass Surfaces */
    --bg-glass-base: rgba(6, 12, 30, 0.85);
    --bg-glass-hover: rgba(10, 20, 45, 0.95);
    --bg-glass-active: rgba(15, 25, 50, 0.98);
    
    /* Brand Accents */
    --color-midnight: #1e3a8a; /* Base Blue */
    --color-electric: #2563eb; /* Primary Action Blue */
    --color-sapphire: #60a5fa; /* Highlight Blue */
    --color-cyan: #06b6d4;     /* Secondary Accent */
    
    /* Semantic Colors (Status Indicators) */
    --color-success: #22c55e;
    --color-success-bg: rgba(34, 197, 94, 0.15);
    --color-success-border: rgba(34, 197, 94, 0.4);
    
    --color-warning: #eab308;
    --color-warning-bg: rgba(234, 179, 8, 0.15);
    --color-warning-border: rgba(234, 179, 8, 0.4);
    
    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.15);
    --color-danger-border: rgba(239, 68, 68, 0.4);
    
    /* Text Hierarchy */
    --text-main: #ffffff;      /* Primary Content */
    --text-secondary: #cbd5e1; /* Secondary Labels */
    --text-tertiary: #94a3b8;  /* Placeholder / Disabled */
    --text-disabled: #475569;
    --text-inverse: #0f172a;

    /* Difficulty Colors (Explicit Definition) */
    --diff-easy-text: #4ade80;
    --diff-easy-bg: rgba(74, 222, 128, 0.2);
    --diff-easy-border: #22c55e;
    
    --diff-med-text: #facc15;
    --diff-med-bg: rgba(250, 204, 21, 0.2);
    --diff-med-border: #eab308;
    
    --diff-hard-text: #f87171;
    --diff-hard-bg: rgba(248, 113, 113, 0.2);
    --diff-hard-border: #ef4444;

    /* 1.2 - Gradient Systems 
       ---------------------------------------------------------------------- */
    --grad-liquid-primary: linear-gradient(
        135deg, 
        var(--color-midnight) 0%, 
        var(--color-electric) 50%, 
        var(--color-sapphire) 100%
    );
    
    --grad-text-metallic: linear-gradient(
        180deg, 
        #ffffff 0%, 
        #e0f2fe 50%, 
        var(--color-sapphire) 100%
    );
    
    --grad-glass-sheen: linear-gradient(
        120deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.08) 50%, 
        rgba(255,255,255,0) 100%
    );

    /* 1.3 - Spacing & Layout
       ---------------------------------------------------------------------- */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* 1.4 - Effects (Borders, Shadows, Glows)
       ---------------------------------------------------------------------- */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 24px;
    --border-radius-pill: 100px;
    
    --border-glass-thin: 1px solid rgba(147, 197, 253, 0.18);
    --border-glass-highlight: 1px solid rgba(147, 197, 253, 0.3);
    
    --shadow-cinematic: 0 30px 60px -12px rgba(0, 0, 0, 0.95);
    --shadow-float: 0 20px 40px -10px rgba(0, 0, 0, 0.8);
    
    --glow-text-blue: 0 0 25px rgba(59, 130, 246, 0.7);
    --glow-box-blue: 0 0 40px rgba(37, 99, 235, 0.25);

    /* 1.5 - Typography
       ---------------------------------------------------------------------- */
    --font-brand: 'Orbitron', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --weight-light: 300;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-bold: 700;
    --weight-black: 900;
    
    /* 1.6 - Animation Timings
       ---------------------------------------------------------------------- */
    --ease-fluid: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    --trans-fast: 0.2s var(--ease-fluid);
    --trans-normal: 0.3s var(--ease-fluid);
    --trans-slow: 0.6s var(--ease-fluid);
}

/* ==========================================================================
   2.0 - CSS RESET & NORMALIZATION
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
    padding-top: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

img, 
video, 
canvas, 
svg {
    display: block;
    max-width: 100%;
}

button, 
input, 
select, 
textarea {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    border-top: none;
    border-right: none;
    border-bottom: none;
    border-left: none;
    background-color: transparent;
    border-radius: 0;
}

button {
    cursor: pointer;
    background-color: transparent;
}

a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

ul, 
ol {
    list-style-type: none;
}

/* ==========================================================================
   3.0 - GLOBAL DOCUMENT STYLES
   ========================================================================== */
body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-body);
    font-weight: var(--weight-regular);
    line-height: 1.6;
    
    /* CRITICAL: Flexbox Layout for Sticky Footer Support */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* 3.1 - Scrollbar Customization */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background-color: var(--bg-void);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background-color: var(--color-midnight);
    border-radius: 5px;
    border: 2px solid var(--bg-void);
    transition-property: background-color;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-electric);
}

/* 3.2 - Text Selection Styling */
::selection {
    background-color: var(--color-electric);
    color: #ffffff;
    text-shadow: none;
}

/* ==========================================================================
   4.0 - BACKGROUND RENDERING ENGINE
   ========================================================================== */

/* Layer 1a: Static Base Image (For Privacy Page & Fallback) */
/* The ID #bg-static-privacy is included here to ensure coverage */
#bg-static, 
#bg-static-privacy {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -4; /* Deepest layer */
    
    /* Standardized Path - Assumes style.css is in /css/ and image in /assets/ */
    background-image: url('../assets/image.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    
    /* Subtle breathing animation for liveness */
    animation-name: bgBreathe;
    animation-duration: 25s;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    animation-timing-function: ease-in-out;
    
    will-change: transform;
}

/* Layer 1b: Video Background (For Home Page) */
#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100vw;
    min-height: 100vh;
    width: auto;
    height: auto;
    z-index: -4; /* Same level as static, HTML order decides precedence */
    
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    
    /* Fallback if video fails to load */
    background-image: url('../assets/image.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

/* Layer 2: Readability Overlay (Darkener) */
#video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -3; /* Above video/image, below content */
    pointer-events: none;
    
    /* Tuned for Cinematic Dark Feel */
    background-color: rgba(0, 0, 0, 0.6); 
}

/* Layer 3: Liquid Interactive Canvas */
#liquid-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    opacity: 0.8;
    mix-blend-mode: screen;
}

/* Layer 4: Cinematic Vignette (Edge darkening) */
.cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    
    background-image: radial-gradient(
        circle at 50% 50%, 
        transparent 0%, 
        rgba(2, 4, 10, 0.4) 60%, 
        rgba(2, 4, 10, 0.95) 100%
    );
}

/* ==========================================================================
   5.0 - MAIN LAYOUT CONTAINER
   ========================================================================== */
.main-container {
    position: relative;
    z-index: 10;
    width: 100%;
    
    /* Enterprise Constraint: 1400px for comfortable reading lines */
    max-width: 1400px;
    
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
    
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
    
    /* Flex Grow Push: Ensures footer is pushed to bottom */
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: auto;
    
    display: flex;
    flex-direction: column;
    gap: 4rem; /* Standard Section Vertical Spacing */
}

/* ==========================================================================
   6.0 - HEADER & BRAND IDENTITY
   ========================================================================== */
.hero-section {
    text-align: center;
    margin-top: 2rem;
    
    animation-name: slideUpFade;
    animation-duration: 1s;
    animation-timing-function: var(--ease-fluid);
    animation-fill-mode: forwards;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
}

/* Brand Symbol - Protected Identity */
.brain-pulse {
    font-size: 3.5rem;
    color: var(--color-electric);
    filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.8));
    
    animation-name: pulse;
    animation-duration: 4s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

/* Brand Logotype */
.brand-text {
    font-family: var(--font-brand);
    font-size: 4.5rem;
    font-weight: var(--weight-black);
    letter-spacing: 8px;
    line-height: 1;
    text-transform: uppercase;
    
    background-image: var(--grad-text-metallic);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.brand-caption {
    font-family: var(--font-brand);
    font-size: 1rem;
    font-weight: var(--weight-light);
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--color-sapphire);
    opacity: 0.9;
    margin-top: 10px;
    text-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
}

/* ==========================================================================
   7.0 - GLASSMORPHISM SURFACE ENGINE
   ========================================================================== */
.layer-glass {
    position: relative;
    background-color: var(--bg-glass-base);
    
    /* Hardware Accelerated Blur */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    border: var(--border-glass-thin);
    border-radius: var(--border-radius-xl);
    
    padding-top: 3rem;
    padding-right: 3rem;
    padding-bottom: 3rem;
    padding-left: 3rem;
    
    box-shadow: var(--shadow-cinematic);
    
    transition-property: all;
    transition-duration: var(--trans-normal);
    
    overflow: hidden;
}

.layer-glass:hover {
    background-color: var(--bg-glass-hover);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

/* Moving Sheen Animation */
.layer-glass::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background-image: var(--grad-glass-sheen);
    transform: skewX(-25deg);
    
    animation-name: sheen;
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    
    pointer-events: none;
}

/* ==========================================================================
   8.0 - FORM CONTROL SYSTEM
   ========================================================================== */
.settings-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-glow {
    color: var(--color-electric);
    font-size: 1.2rem;
    filter: drop-shadow(0 0 10px var(--color-electric));
}

/* 8.1 - Select Inputs */
.glass-select {
    appearance: none;
    -webkit-appearance: none;
    
    background-color: rgba(2, 4, 10, 0.8);
    border: var(--border-glass-thin);
    color: var(--text-main);
    
    padding-top: 14px;
    padding-right: 48px;
    padding-bottom: 14px;
    padding-left: 28px;
    
    border-radius: var(--border-radius-md);
    
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: var(--weight-medium);
    cursor: pointer;
    min-width: 220px;
    
    transition-property: all;
    transition-duration: 0.2s;
    transition-timing-function: ease;
    
    /* SVG Arrow Injection */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
}

.glass-select:hover {
    border-color: var(--color-electric);
    background-color: #000000;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
}

.glass-select option {
    background-color: var(--bg-void);
    color: white;
    padding: 10px;
}

/* 8.2 - Toggle Switches */
.toggle-container {
    background-color: rgba(255, 255, 255, 0.05);
    
    padding-top: 10px;
    padding-right: 24px;
    padding-bottom: 10px;
    padding-left: 24px;
    
    border-radius: var(--border-radius-pill);
    border: var(--border-glass-thin);
    
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-label {
    font-family: var(--font-brand);
    font-size: 0.9rem;
    font-weight: var(--weight-bold);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1e293b;
    transition-duration: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition-duration: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-electric);
    box-shadow: 0 0 15px var(--color-electric);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* 8.3 - Input Groups (Configuration Panel) */
.exam-config {
    width: 100%;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    
    display: flex;
    flex-direction: column;
    gap: 20px;
    
    animation-name: slideDownFade;
    animation-duration: 0.4s;
    animation-timing-function: ease;
}

.config-header {
    text-align: center;
    font-family: var(--font-brand);
    color: var(--color-sapphire);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.config-wrapper {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.glass-input {
    background-color: rgba(0, 0, 0, 0.6);
    border: var(--border-glass-thin);
    color: white;
    padding: 10px;
    border-radius: 8px;
    width: 70px;
    text-align: center;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
}

.glass-input:focus {
    border-color: var(--color-electric);
    background-color: #000000;
}

/* ==========================================================================
   9.0 - UPLOAD INTERFACE & CAMERA
   ========================================================================== */
.upload-section h3 {
    font-family: var(--font-brand);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-main);
}

.input-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.file-trigger {
    padding-top: 20px;
    padding-right: 40px;
    padding-bottom: 20px;
    padding-left: 40px;
    
    border-radius: 16px;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(148, 163, 184, 0.4);
    
    display: flex;
    align-items: center;
    gap: 12px;
    
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--trans-normal);
}

.file-trigger:hover {
    border-color: var(--color-electric);
    color: #ffffff;
    background-color: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.cam-trigger {
    padding-top: 20px;
    padding-right: 40px;
    padding-bottom: 20px;
    padding-left: 40px;
    
    border-radius: 16px;
    cursor: pointer;
    background-color: var(--color-midnight);
    border: none;
    color: #ffffff;
    
    display: flex;
    align-items: center;
    gap: 12px;
    
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(30, 64, 175, 0.3);
    transition: var(--trans-normal);
}

.cam-trigger:hover {
    background-color: var(--color-electric);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.5);
}

/* Gallery Grid */
.gallery-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.gallery-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 30px;
}

.gallery-item {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--trans-fast);
    box-shadow: var(--shadow-cinematic);
}

.gallery-item:hover {
    border-color: var(--color-electric);
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--color-electric);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Add More Button */
.btn-dashed {
    background-color: transparent;
    border: 2px dashed var(--color-electric);
    color: var(--color-electric);
    width: 120px;
    height: 120px;
    border-radius: 12px;
    cursor: pointer;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    font-family: var(--font-body);
    font-weight: 600;
    transition: var(--trans-fast);
}

.btn-dashed:hover {
    background-color: rgba(59, 130, 246, 0.15);
    transform: scale(1.02);
}

.preview-actions {
    text-align: center;
    margin-top: 20px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    transition-property: color;
    transition-duration: 0.2s;
}

.btn-text:hover {
    color: var(--color-electric);
}

/* ==========================================================================
   10.0 - INTERACTION COMPONENT LIBRARY (BUTTONS)
   ========================================================================== */
.action-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

/* 10.1 - Primary Liquid Hero Button */
.btn-liquid {
    position: relative;
    width: 100%;
    max-width: 600px;
    padding: 26px;
    border: none;
    border-radius: 20px;
    
    font-family: var(--font-brand);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ffffff;
    
    background-image: var(--grad-liquid-primary);
    box-shadow: 0 10px 40px rgba(37, 99, 235, 0.5);
    
    cursor: pointer;
    overflow: hidden;
    
    transition-property: transform, box-shadow;
    transition-duration: 0.2s;
}

/* Shine Animation Layer */
.liquid-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-20deg);
    
    animation-name: shineMove;
    animation-duration: 4s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.btn-liquid:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.7);
}

.btn-liquid:active:not(:disabled) {
    transform: translateY(2px);
}

.btn-liquid:disabled {
    background: #1f2937;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* 10.2 - Secondary Ghost Button */
.btn-secondary {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    width: 100%;
    max-width: 600px;
    padding: 18px;
    border-radius: 16px;
    
    font-family: var(--font-brand);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    
    cursor: pointer;
    transition: var(--trans-normal);
}

.btn-secondary:hover {
    border-color: #ffffff;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   11.0 - RESULT CARD ARCHITECTURE (GRID ALIGNMENT & FULLNESS FIXES)
   ========================================================================== */
.results-stack {
    margin-top: 40px;
    animation-name: fadeIn;
    animation-duration: 0.8s;
    animation-timing-function: ease;
    
    width: 100%;
    flex-grow: 1; /* Helps push footer down */
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 20px;
}

.results-header h2 {
    font-family: var(--font-brand);
    font-size: 2rem;
    font-weight: var(--weight-bold);
    
    background-image: var(--grad-text-metallic);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* PDF Export Button */
.btn-pdf {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-pdf:hover {
    background-color: #ef4444;
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* 11.1 - Difficulty Block Grid (THE FIX FOR EXAM MODE) */
.blocks-wrapper {
    display: grid;
    /* AUTO-FIT MAGIC:
       - If there are 3 items (Easy/Med/Hard), they will split 33% each.
       - If there are 2 items (Part A/Part B), they will split 50% each.
       - minmax(400px, 1fr) ensures they don't get too skinny.
    */
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    width: 100%;
}

/* 11.2 - Difficulty Block Container (Viewport Filling) */
.difficulty-block {
    display: flex;
    flex-direction: column;
    gap: 24px;
    
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.difficulty-title {
    font-family: var(--font-brand);
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    font-weight: 700;
}

/* Block Theme Definitions */
.block-easy {
    border-top: 4px solid var(--diff-easy-border);
    box-shadow: 0 0 20px var(--diff-easy-bg);
}
.block-easy .difficulty-title { color: var(--diff-easy-text); }

.block-medium {
    border-top: 4px solid var(--diff-med-border);
    box-shadow: 0 0 20px var(--diff-med-bg);
}
.block-medium .difficulty-title { color: var(--diff-med-text); }

.block-hard {
    border-top: 4px solid var(--diff-hard-border);
    box-shadow: 0 0 20px var(--diff-hard-bg);
}
.block-hard .difficulty-title { color: var(--diff-hard-text); }

/* 11.3 - Question Card Architecture */
.question-card {
    background-color: rgba(10, 20, 35, 0.85);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 16px;
    
    padding-top: 2.5rem;
    padding-right: 2.5rem;
    padding-bottom: 2.5rem;
    padding-left: 2.5rem;
    
    border-left: 4px solid var(--color-electric);
    position: relative;
    
    transition-property: transform, box-shadow;
    transition-duration: 0.2s;
    
    /* Allow cards to grow evenly to fill row gaps */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.question-card:hover {
    transform: translateY(-3px);
    background-color: rgba(15, 25, 45, 0.98);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    border-color: var(--color-electric);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Badge Styles */
.badge {
    padding-top: 6px;
    padding-right: 14px;
    padding-bottom: 6px;
    padding-left: 14px;
    
    border-radius: 4px;
    font-family: var(--font-brand);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge.easy { background: var(--diff-easy-bg); color: var(--diff-easy-text); border: 1px solid var(--diff-easy-border); }
.badge.medium { background: var(--diff-med-bg); color: var(--diff-med-text); border: 1px solid var(--diff-med-border); }
.badge.hard { background: var(--diff-hard-bg); color: var(--diff-hard-text); border: 1px solid var(--diff-hard-border); }

/* Audio Interaction Button */
.btn-audio {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    transition: 0.2s;
}

.btn-audio:hover {
    color: white;
    border-color: var(--color-electric);
    background-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.btn-audio.active {
    color: white;
    background-color: #ef4444;
    border-color: #ef4444;
}

/* ENHANCED TYPOGRAPHY (Large & Readable) */
.q-text {
    font-size: 1.35rem; /* ~22px for excellent desktop reading */
    line-height: 1.8;   /* Loose spacing */
    margin-bottom: 30px;
    color: var(--text-main);
    font-weight: 500;
    flex-grow: 1; /* Pushes answer button to bottom */
}

/* Answer Reveal Area */
.answer-box {
    margin-top: 15px;
    padding: 24px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    line-height: 1.7;
    display: none;
    
    animation-name: slideDownFade;
    animation-duration: 0.3s;
    
    font-size: 1.1rem;
}

.btn-reveal {
    background-color: transparent;
    border: 1px solid #475569;
    color: var(--text-secondary);
    
    padding-top: 8px;
    padding-right: 24px;
    padding-bottom: 8px;
    padding-left: 24px;
    
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-brand);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    
    transition: 0.3s;
    align-self: flex-start;
}

.btn-reveal:hover {
    border-color: var(--color-electric);
    color: white;
    background-color: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* ==========================================================================
   12.0 - MODAL SYSTEM & NUCLEAR CROP FIX
   ========================================================================== */
.hidden { display: none !important; }

/* Global Loading State */
.loader-box {
    text-align: center;
    padding: 6rem 0;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-electric);
    border-radius: 50%;
    margin: 0 auto 24px;
    
    animation-name: spin;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

#loader-text {
    font-family: var(--font-brand);
    letter-spacing: 3px;
    font-size: 1rem;
    animation: bgBreathe 2s infinite;
    text-transform: uppercase;
}

/* Modal Overlay Base */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(2, 4, 10, 0.98); /* Heavy Dark BG for focus */
    backdrop-filter: blur(15px);
    z-index: 99999;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    opacity: 0;
    animation-name: fadeIn;
    animation-duration: 0.3s;
    animation-fill-mode: forwards;
}

/* ----------------------------------------------------------------------
   NUCLEAR OVERRIDE FOR CROP MODAL CONTENT 
   This section fixes the "Image Offset" bug by removing conflicting Image Styles
   ---------------------------------------------------------------------- 
*/
#crop-modal .modal-content {
    background-color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 20px;
    
    /* FORCE FULL SCREEN DIMENSIONS */
    width: 95vw !important;
    height: 90vh !important;
    max-width: 1600px !important;
    max-height: 1000px !important;
    
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.9);
}

.crop-title {
    text-align: center;
    font-family: var(--font-brand);
    color: var(--color-electric);
    font-size: 1.4rem;
    margin: 0;
    flex-shrink: 0;
}

/* IMAGE WRAPPER - FORCE FILL
   We use flex: 1 to fill the vertical gap.
   We use position: relative to anchor the cropper tool.
*/
.crop-area-wrapper{
    flex-grow: 1;
    width: 100%;
    min-height: 0;

    position: relative;
    overflow: hidden;

    display: block; /* <- add this */
}

/* Let Cropper control its own layout */
.cropper-container {
    width: 100%;
    height: 100%;
}


/* IMAGE RESET - CLEAN SLATE
   We remove any forced dimensions from the source image.
   The library will handle the sizing dynamically.
*/
#crop-image-target {
    max-width: 100%;
    display: block;
    /* REMOVED: width: 100% !important */
    /* REMOVED: height: 100% !important */
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-shrink: 0;
    padding-top: 10px;
}

.btn-liquid.small {
    padding: 12px 30px;
    font-size: 1rem;
    width: auto;
}

.btn-secondary.small {
    padding: 12px 30px;
    font-size: 1rem;
    width: auto;
    margin: 0;
}

/* ==========================================================================
   13.0 - STICKY FOOTER SYSTEM
   ========================================================================== */
.app-footer {
    width: 100%;
    background-color: rgba(2, 4, 10, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    
    padding-top: 20px;
    padding-bottom: 20px;
    
    margin-top: auto; /* This property pushes the footer to bottom */
    position: relative;
    z-index: 50;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    
    padding-left: 2rem;
    padding-right: 2rem;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-left {
    font-family: var(--font-brand);
    letter-spacing: 1px;
    color: var(--color-sapphire);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    border-bottom: 1px dotted transparent;
}

.footer-link:hover {
    color: var(--color-electric);
    border-bottom-color: var(--color-electric);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ==========================================================================
   14.0 - ANIMATION KEYFRAMES
   ========================================================================== */
@keyframes bgBreathe {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.98); }
}

@keyframes shineMove {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sheen {
    0% { left: -150%; }
    20% { left: 250%; }
    100% { left: 250%; }
}

/* ==========================================================================
   15.0 - RESPONSIVE MEDIA QUERIES (FULLNESS LOGIC)
   ========================================================================== */

/* LARGE DESKTOP SCREENS (1400px+) */
@media (min-width: 1400px) {
    .main-container {
        max-width: 1600px;
    }
    
    .difficulty-block {
        padding: 3rem;
        gap: 30px;
        min-height: 70vh; /* Forces content to expand nicely */
    }
}

/* LAPTOP / DESKTOP SCREENS (1024px - 1399px) */
@media (min-width: 1024px) {
    /* AUTO-FIT: This automatically adjusts column count.
       - 2 Items (Exam): 50% / 50%
       - 3 Items (Practice): 33% / 33% / 33%
    */
    .blocks-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); 
    }
    
    .difficulty-block {
        height: 100%;
        min-height: 60vh;
    }
}

/* TABLET SCREENS (768px - 1023px) */
@media (max-width: 1023px) {
    .blocks-wrapper {
        grid-template-columns: 1fr; /* Stack vertically */
    }
    
    .brand-text {
        font-size: 3.5rem;
    }
    
    .config-wrapper {
        flex-direction: column;
        gap: 15px;
    }
}

/* MOBILE SCREENS (Below 768px) */
@media (max-width: 767px) {
    .main-container {
        padding: 1.5rem 1rem;
        gap: 2.5rem;
    }
    
    .brand-text {
        font-size: 2.5rem;
    }
    
    .settings-grid {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .config-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-trigger, 
    .cam-trigger {
        justify-content: center;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    /* Disable Expensive Graphics */
    #liquid-canvas { display: none; }
    .layer-glass::after { animation: none; }
    
    /* Reset expansive styles for small screens */
    .difficulty-block {
        min-height: auto;
        padding: 20px;
    }
    
    /* Mobile Modal Sizing */
    #crop-modal .modal-content { 
        width: 95% !important; 
        height: auto !important; 
        max-height: 90vh !important; 
    }
    
    .crop-area-wrapper {
        max-height: 50vh;
    }
    
    .q-text {
        font-size: 1.1rem;
        line-height: 1.5;
    }
}

/* ==========================================================================
   16.0 - PRINT STYLES (FOR PDF EXPORT)
   ========================================================================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .hero-section, 
    .settings-bar, 
    .upload-section, 
    .action-bar, 
    .app-footer {
        display: none;
    }
    
    .results-stack {
        margin: 0;
    }
    
    .question-card {
        border: 1px solid #ccc;
        background: white;
        color: black;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .q-text {
        color: black;
        font-size: 12pt;
    }
    
    .badge {
        border: 1px solid #000;
        color: black;
        background: transparent;
    }
}
/* END OF FILE */