/**
 * Modern Design System & Animation Stylesheet
 * Project: Multi-School Student Data Collection Platform (EduData Hub)
 * Design Paradigm: Dark Minimalist Luxury, Mobile-First, Accessible
 */

/* ==========================================================================
   1. Design Tokens & CSS Custom Properties
   ========================================================================== */
:root {
    /* Color Palette - Deep Obsidian & Electric Indigo */
    --bg-base: #07090e;
    --bg-surface: #0e121b;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(24, 32, 50, 0.85);
    --bg-input: #121824;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(99, 102, 241, 0.3);
    --border-focus: #6366f1;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverted: #07090e;

    /* Accent & Semantic Brand Colors */
    --accent-primary: #6366f1;       /* Electric Indigo */
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);
    
    --accent-cyan: #06b6d4;          /* Vivid Cyan */
    --accent-emerald: #10b981;       /* Approval Success */
    --accent-amber: #f59e0b;         /* Pending Warning */
    --accent-rose: #f43f5e;          /* Rejection / Danger */

    /* Typography Clamps */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Fluid Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.25rem;
    --radius-pill: 9999px;

    /* Transitions & Curves */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 150ms var(--ease-standard);
    --transition-base: 250ms var(--ease-standard);
    --transition-smooth: 450ms var(--ease-out-expo);

    /* Shadows & Glassmorphism */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--border-subtle);
    --shadow-glow: 0 0 25px -5px var(--accent-glow);
    --blur-glass: blur(14px);
}

/* ==========================================================================
   2. Reset & Base Typography (Mobile-First)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    word-break: break-word;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.05) 0%, transparent 45%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.85rem, 4vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.4rem, 2.5vw + 0.8rem, 2.25rem); }
h3 { font-size: clamp(1.15rem, 1.5vw + 0.6rem, 1.5rem); }

p {
    color: var(--text-secondary);
    font-size: clamp(0.925rem, 0.5vw + 0.8rem, 1.05rem);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
}

/* ==========================================================================
   3. Animated Hover Links (Left-to-Right Draw)
   ========================================================================== */
.animated-underline {
    position: relative;
    display: inline-block;
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    padding-bottom: 2px;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-smooth);
}

.animated-underline:hover::after,
.animated-underline:focus::after {
    transform: scaleX(1);
}

/* ==========================================================================
   4. Layout Containers & Grid Helpers
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

.main-content {
    flex: 1 0 auto;
    padding-top: var(--space-8);
    padding-bottom: var(--space-12);
}

/* Glassmorphic Card Container */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
}

/* ==========================================================================
   5. Modern Header & Mobile-First Navigation
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 9, 14, 0.85);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-bottom: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4.5rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Mobile Hamburger Toggle */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    gap: 5px;
    z-index: 110;
    transition: border-color var(--transition-fast);
}

.menu-toggle:hover {
    border-color: var(--accent-primary);
}

.menu-toggle span {
    display: block;
    width: 1.25rem;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

/* Hamburger active transformation */
.menu-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Navigation Links (Mobile Drawer to Desktop Row) */
.nav-menu {
    position: fixed;
    top: 4.5rem;
    left: 0;
    width: 100%;
    height: calc(100vh - 4.5rem);
    background: rgba(7, 9, 14, 0.98);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-4);
    gap: var(--space-3);
    overflow-y: auto;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-smooth), opacity var(--transition-smooth);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--accent-cyan);
    border-left: 3px solid var(--accent-cyan);
}

/* Desktop Navigation (>= 768px / 1024px) */
@media (min-width: 900px) {
    .menu-toggle {
        display: none;
    }

    .nav-menu {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        backdrop-filter: none;
        flex-direction: row;
        align-items: center;
        padding: 0;
        gap: var(--space-1);
        transform: none;
        opacity: 1;
        pointer-events: auto;
        border-bottom: none;
    }

    .nav-link {
        font-size: 0.925rem;
        padding: 0.5rem 0.85rem;
    }

    .nav-link.active {
        border-left: none;
        border-bottom: 2px solid var(--accent-cyan);
        border-radius: 0;
        background: transparent;
    }
}

/* ==========================================================================
   6. Reveal-on-Scroll & Parallax Keyframes Animation System
   ========================================================================== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
    will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay helpers */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Subtle Parallax Float Keyframe */
@keyframes softFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(0.5deg);
    }
}

.parallax-float {
    animation: softFloat 7s ease-in-out infinite;
}

/* ==========================================================================
   7. Form Controls, Inputs & Custom Badges
   ========================================================================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    width: 100%;
    background-color: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.95rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.25rem;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #ffffff;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #f87171;
    border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: var(--accent-rose);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.825rem;
    border-radius: var(--radius-sm);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-approved { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-rejected { background: rgba(244, 63, 94, 0.15); color: #f87171; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-role-super { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-role-admin { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-role-school { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.925rem;
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
}

.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
.alert-danger  { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.3); color: #fda4af; }
.alert-info    { background: rgba(6, 182, 212, 0.1); border: 1px solid rgba(6, 182, 212, 0.3); color: #67e8f9; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fde68a; }

/* ==========================================================================
   8. Responsive Tables & Data Grid
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.custom-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.student-photo-thumb {
    width: 44px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
}

/* ==========================================================================
   9. Live Webcam Modal & Capture UI
   ========================================================================== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4/5;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-captured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.camera-overlay-guideline {
    position: absolute;
    inset: 15% 15%;
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50% 50% 45% 45%;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

.camera-controls-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   10. Utility Classes (Flex, Grid, Sizing, Colors)
   ========================================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

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

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

.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-white { color: #ffffff; }
.text-muted { color: var(--text-secondary); }
.text-indigo-400 { color: #818cf8; }
.text-cyan-400 { color: #22d3ee; }
.text-emerald-400 { color: #34d399; }
.text-amber-400 { color: #fbbf24; }
.text-rose-400 { color: #fb7185; }

/* Serial Number Accent Pill */
.serial-pill {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

/* ==========================================================================
   11. Accessibility Standard: Respect prefers-reduced-motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .parallax-float {
        animation: none !important;
    }

    .animated-underline::after {
        transition: none !important;
    }
}
