/* Import Google Fonts — Warm Premium Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Playfair+Display:wght@700;800&display=swap');

:root {
    /* ── Slate Blue Light Brand Core ── */
    --primary: #2563EB;            /* Cobalt Blue */
    --primary-dark: #1D4ED8;       /* Deep Cobalt */
    --primary-light: #BFDBFE;      /* Blue light */
    --secondary: #1E3A5F;          /* Deep Navy */
    --navy: #1E3A5F;

    /* Accents */
    --accent-gold: #D97706;
    --accent-gold-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --accent-warm: #3B82F6;        /* Lighter blue accent */
    --amber: #F59E0B;
    --gold: #D97706;

    /* Backgrounds — warm white */
    --bg-body: #FAFAF9;
    --bg-card: rgba(255, 255, 255, 0.98);
    --bg-glass: rgba(248, 250, 255, 0.92);
    --bg-glass-heavy: rgba(255, 255, 255, 0.99);
    --bg-secondary: rgba(239, 246, 255, 0.90);
    --bg-tertiary: rgba(219, 234, 254, 0.85);

    /* Text */
    --text-main: #1C1917;          /* Near-black */
    --text-primary: #1C1917;
    --text-muted: #6B7280;         /* Cool gray */
    --text-light: #9CA3AF;
    --text-inverse: #ffffff;
    --text-secondary: #374151;

    /* Borders */
    --border: rgba(37, 99, 235, 0.12);  /* Blue tint */
    --glass-border: rgba(255, 255, 255, 0.75);
    --glass-border-dark: rgba(191, 219, 254, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(37, 99, 235, 0.08);

    /* Shadows — blue-tinted */
    --shadow-sm: 0 2px 8px -2px rgba(37, 99, 235, 0.06);
    --shadow-md: 0 8px 16px -4px rgba(37, 99, 235, 0.09);
    --shadow-lg: 0 12px 32px -6px rgba(37, 99, 235, 0.13);
    --shadow-premium: var(--glass-shadow);
    --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.18);
    --shadow-glow-gold: 0 0 24px rgba(217, 119, 6, 0.30);

    /* Status Colours */
    --success: #16A34A;
    --danger:  #DC2626;
    --warning: #D97706;
    --info:    #0369A1;

    /* Spacing & Radius */
    --radius-md: 0.625rem;
    --radius-lg: 1.125rem;
    --radius-xl: 1.75rem;
    --radius-full: 9999px;

    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --spacing-3xl: 6rem;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    --gradient-gold: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --gradient-hero: linear-gradient(135deg, #1E3A5F 0%, #2D5282 100%);
    --gradient-warm: linear-gradient(135deg, #FFF7ED 0%, #FED7AA 100%);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;

    /* Z-index */
    --z-tooltip: 1060;
    --z-fixed: 1000;
}

[data-theme="dark"], body.dark-mode {
    --bg-body: #1A0F0A;
    --bg-card: rgba(40, 22, 12, 0.80);
    --bg-glass: rgba(35, 18, 8, 0.70);
    --bg-glass-heavy: rgba(44, 24, 12, 0.90);
    --bg-secondary: rgba(55, 30, 14, 0.55);
    --glass-border: rgba(255, 200, 150, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --border: rgba(255, 180, 100, 0.07);

    --text-main: #FDF8F3;
    --text-primary: #FDF8F3;
    --text-secondary: #D6C9BC;
    --text-muted: #A8967E;
    --text-light: #8B7355;

    --primary: #EA580C;
    --primary-dark: #1D4ED8;
    --primary-light: #7C3310;
    --secondary: #2D5282;
}

/* Accent Themes */
[data-accent="indigo"] {
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
}

[data-accent="emerald"] {
    --primary: #10b981;
    --primary-light: #d1fae5;
}

[data-accent="rose"] {
    --primary: #f43f5e;
    --primary-light: #ffe4e6;
}

[data-accent="amber"] {
    --primary: #f59e0b;
    --primary-light: #fef3c7;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background-color: var(--bg-body);
    /* Warm Premium mesh gradient background */
    background-image:
        radial-gradient(at 0% 0%,   rgba(37, 99, 235, 0.07) 0px, transparent 55%),
        radial-gradient(at 100% 0%, rgba(217, 119, 6, 0.06) 0px, transparent 55%),
        radial-gradient(at 50% 100%, rgba(30, 58, 95, 0.05) 0px, transparent 60%),
        radial-gradient(at 0% 100%, rgba(249, 115, 22, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    line-height: 1.2;
}

/* Editorial headings for hero/section titles */
.heading-editorial {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

/* Helper Classes */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--primary);
}

.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.mt-1 {
    margin-top: var(--spacing-xs);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Bento Grid System */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(100px, auto);
    gap: var(--spacing-md);
}

.bento-item {
    grid-column: span 12;
}

@media (min-width: 768px) {
    .bento-item-4 {
        grid-column: span 4;
    }

    .bento-item-6 {
        grid-column: span 6;
    }

    .bento-item-8 {
        grid-column: span 8;
    }

    .bento-item-12 {
        grid-column: span 12;
    }
}

@media (min-width: 1024px) {
    .bento-item-lg-3 {
        grid-column: span 3;
    }

    .bento-item-lg-4 {
        grid-column: span 4;
    }

    .bento-item-lg-6 {
        grid-column: span 6;
    }

    .bento-item-lg-8 {
        grid-column: span 8;
    }

    .bento-item-lg-9 {
        grid-column: span 9;
    }
}

.bento-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    gap: 0.5rem;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #fff;
    box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.35);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 100%);
    box-shadow: 0 6px 20px -2px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
}

/* Premium Card Style - Liquid Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
    overflow: hidden;
    position: relative;
}

/* Inner light glow for edge perfection */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

[data-theme="dark"] .card::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
}

.card:hover {
    transform: translateY(-4px) scale(1.005);
    box-shadow: 0 20px 40px 0 rgba(31, 38, 135, 0.18);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h4 {
    margin: 0;
    font-size: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

/* ─── Student Sidebar (Icon Rail) ────────────────────── */
.student-layout {
    display: flex !important;
    min-height: 100vh;
    position: relative;
}

/* ── Warm Premium Sidebar ── */
.student-sidebar {
    width: 80px !important;
    max-width: 80px !important;
    min-width: 80px !important;
    height: 100vh !important;
    background: #E8EDF7 !important;  /* Slate Blue Light */
    border-right: 1px solid rgba(37, 99, 235, 0.12) !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 20px !important;
    transition: none !important;
    flex-shrink: 0 !important;
}

[data-theme="dark"] .student-sidebar,
body.dark-mode .student-sidebar {
    background: #12243A !important;
    border-right-color: rgba(37, 99, 235, 0.10) !important;
}

.student-sidebar-header {
    padding: 14px 0 10px;
    width: 100%;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(37, 99, 235, 0.10);
    margin-bottom: 8px;
}

.student-sidebar-header img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.student-sidebar-nav {
    flex: 1;
    width: 100%;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.student-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 64px;
    padding: 10px 4px 8px;
    text-decoration: none;
    color: #2D4A7A;
    font-weight: 600;
    border-radius: 14px;
    transition: all 0.18s ease;
}

.student-nav-link .s-icon {
    font-size: 1.45rem;
    line-height: 1;
}

.student-nav-link .s-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
    color: #3D5A8A;
    transition: color 0.18s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.student-nav-link:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1E3A5F;
}

.student-nav-link:hover .s-label {
    color: #1E3A5F;
}

.student-nav-link.active {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.40);
}

.student-nav-link.active .s-label {
    color: #fff;
}

.student-sidebar-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding-top: 8px;
    gap: 4px;
}

.student-main-content {
    flex: 1;
    margin-left: 80px;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .student-sidebar {
        width: 100%;
        height: 64px;
        flex-direction: row;
        top: auto;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        overflow-y: hidden;
        overflow-x: auto;
        justify-content: space-around;
        padding: 0;
    }

    .student-sidebar-header,
    .student-sidebar-footer {
        display: none;
    }

    .student-sidebar-nav {
        flex-direction: row;
        width: auto;
        padding: 0;
        gap: 0;
        flex: 1;
        justify-content: space-around;
        align-items: stretch;
    }

    .student-nav-link {
        width: auto;
        min-width: 50px;
        padding: 6px 8px;
        border-radius: 0;
        flex: 1;
    }

    .student-main-content {
        margin-left: 0;
        padding-bottom: 74px;
    }
}

/* Legacy .navbar - kept for pages not yet converted */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 0.8rem 0;
    display: none;
    /* hidden when sidebar is present */
}

.navbar-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.navbar-link:hover {
    color: var(--primary);
}

/* Hero Section - The Premium Fix */
.hero {
    /* Rich, deep gradient background */
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-radius: var(--radius-xl);
    padding: 4rem 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    margin-bottom: 3rem;
    color: white;
    text-align: center;
}

/* Abstract shapes for depth */
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.4) 0%, transparent 60%);
    filter: blur(60px);
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, transparent 60%);
    filter: blur(60px);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    /* Gradient text for extra pop */
    background: linear-gradient(to right, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* This fixes the visibility issue */
.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9) !important;
    /* Force high contrast */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Stats Cards */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

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

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

@media (max-width: 768px) {

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

    .hero-title {
        font-size: 2.5rem;
    }

    .navbar-menu {
        display: none;
        /* Handled by mobile menu */
    }
}

.stat-card-premium {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent-purple));
}

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

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: inline-block;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 50%;
}

.stat-value-large {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-primary {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Achievement Badges */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fff beb;
    border-radius: 2rem;
    border: 1px solid var(--accent-gold);
    color: #92400e;
    font-weight: 600;
    font-size: 0.85rem;
    background: #fffbeb;
}

.achievement-points {
    background: var(--accent-gold);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

/* Charts */
.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-left-color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #991b1b;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

.slide-in {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* =========================================
   Responsive Enhancements & Mobile Menu
   ========================================= */

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

@media (max-width: 768px) {

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

    .hero {
        padding: 3rem 1.5rem;
        border-radius: 1rem;
        margin-bottom: 2rem;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .navbar-menu {
        display: none;
    }

    /* Hide desktop menu */

    .container {
        padding: 0 1rem;
    }

    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .stat-value-large {
        font-size: 2.5rem;
    }

    /* Ensure forms are touch-friendly */
    .form-control,
    .btn {
        min-height: 40px;
    }
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    z-index: 1002;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-main);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Level Up Animation */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.level-up-card {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-2xl);
    text-align: center;
    max-width: 400px;
    position: relative;
    box-shadow: 0 0 50px var(--primary);
}

[data-theme="dark"] .level-up-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.level-up-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.level-up-number {
    font-size: 5rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 1.5rem;
    line-height: 1;
}

.level-up-sparkle {
    font-size: 3rem;
    position: absolute;
    top: -20px;
    right: -20px;
    animation: bounce 2s infinite;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: gold;
    border-radius: 50%;
    animation: float 3s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

/* XP Toast */
.xp-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
    font-weight: 700;
    z-index: 10002;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xp-amount {
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Badge Carousel */
.badge-carousel-container {
    position: relative;
    width: 100%;
}

.badge-carousel {
    display: flex;
    gap: var(--spacing-lg);
    overflow-x: auto;
    padding: var(--spacing-md) 0;
    scrollbar-width: none;
    cursor: grab;
}

.badge-carousel::-webkit-scrollbar {
    display: none;
}

.badge-carousel.active {
    cursor: grabbing;
}

.badge-item {
    flex: 0 0 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-item:hover {
    transform: translateY(-10px) rotate(3deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.badge-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

/* Floating Bottom Navigation */
.floating-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    align-items: center;
    gap: 25px;
    z-index: var(--z-fixed);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .floating-nav {
        display: flex;
    }
}

.floating-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.floating-nav-item i {
    font-size: 1.25rem;
    font-style: normal;
}

.floating-nav-item.active {
    color: var(--primary);
}

/* Heatmap Style */
.heatmap {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 2px;
}

.heatmap-day.level-1 {
    background: #e0e7ff;
}

.heatmap-day.level-2 {
    background: #818cf8;
}

.heatmap-day.level-3 {
    background: #4f46e5;
}

.heatmap-day.level-4 {
    background: #3730a3;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* Mobile Menu Drawer */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 5rem 2rem 2rem;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background: var(--bg-body);
    color: var(--primary);
    border-color: rgba(0, 0, 0, 0.05);
    transform: translateX(5px);
}

/* Mobile Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* =========================================
   UI/UX Enhancements: Empty States & Skeletons
   ========================================= */

/* Empty States */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-xl);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed #cbd5e1;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    color: #94a3b8;
    margin-bottom: var(--spacing-md);
    opacity: 0.7;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--spacing-sm);
}

.empty-state-text {
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto var(--spacing-lg) auto;
}

/* Skeleton Loaders */
.skeleton {
    background: #e2e8f0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: none;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.4) 20%,
            rgba(255, 255, 255, 0.6) 60%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.skeleton-chart {
    height: 250px;
    width: 100%;
    border-radius: var(--radius-md);
}

.skeleton-card {
    height: 100%;
    min-height: 150px;
}
/* ── tbi-card ─────────────────────────────────────────────────────────────── */
.tbi-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}
.tbi-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
body.dark-mode .tbi-card {
    background: var(--card-bg-dark, #1e2130);
    border-color: var(--border-dark, #2d3148);
}

/* ── stat-card ────────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 20px 18px 16px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}
.stat-card .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted, #6b7280);
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-card .stat-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text, #1a1a2e);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-icon {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 2.4rem;
    opacity: 0.12;
    color: var(--primary, #3b4fd8);
}
body.dark-mode .stat-card {
    background: var(--card-bg-dark, #1e2130);
    border-color: var(--border-dark, #2d3148);
}
body.dark-mode .stat-card .stat-val {
    color: #ffffff;
}

/* ── tbi-progress ─────────────────────────────────────────────────────────── */
.tbi-progress {
    height: 6px;
    background: var(--border, #e5e7eb);
    border-radius: 99px;
    overflow: hidden;
}
.tbi-progress-bar {
    height: 100%;
    background: var(--primary, #3b4fd8);
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ── tbi-table ────────────────────────────────────────────────────────────── */
.tbi-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border, #e5e7eb);
    padding: 12px 16px;
}
.tbi-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #f3f4f6);
    vertical-align: middle;
}
.tbi-table tbody tr:last-child td { border-bottom: none; }

/* ── badge helpers ────────────────────────────────────────────────────────── */
.badge-pending  { background: rgba(251,191,36,0.15); color: #b45309; border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.badge-approved { background: rgba(34,197,94,0.12);  color: #15803d; border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.badge-rejected { background: rgba(239,68,68,0.12);  color: #dc2626; border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ── tbi alerts ───────────────────────────────────────────────────────────── */
.tbi-alert-success {
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.25);
    color: #15803d;
    border-radius: var(--radius-md, 10px);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
}

/* ── Skeleton Loading ─────────────────────────────────────────────────────── */
.skeleton {
    background: #e2e8f0;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .skeleton {
    background: #1e293b;
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-text.short { width: 50%; }
.skeleton-img { height: 160px; width: 100%; border-radius: 0; }
.skeleton-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; padding-bottom: 18px; }

/* =========================================
   Mobile Audit Fixes (2026-03)
   ========================================= */

/* Tables: ensure horizontal scroll on overflow */
.tbi-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Touch targets: minimum 44px per accessibility guidelines */
@media (max-width: 768px) {
    .nav-icon-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* Stat values: scale in 2-column grid */
    .stat-card .stat-val {
        font-size: 1.6rem;
    }

    /* Button groups: wrap instead of overflow */
    .hero-actions,
    .btn-toolbar,
    .d-flex.gap-2.flex-nowrap-mobile {
        flex-wrap: wrap !important;
    }

    /* Bottom nav padding: applied with priority to prevent content bleed */
    .student-main-content {
        padding-bottom: 84px !important;
    }

    /* Tables: all data tables get scroll container */
    .table-responsive-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Form controls: ensure tap-safe height */
    .form-control,
    .form-select,
    select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea {
        min-height: 44px;
    }

    /* Buttons: minimum tap target */
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
    }

    /* Modals: full-width on small screens */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Cards: reduce padding on mobile */
    .card-body,
    .tbi-card.p-4 {
        padding: 1rem !important;
    }

    /* Prevent full-width images from overflowing */
    img, video {
        max-width: 100%;
        height: auto;
    }
}

/* Ultra-small screens: phones < 480px */
@media (max-width: 480px) {
    /* Hero: extra compact */
    .hero {
        padding: 2rem 1rem;
        border-radius: 0.75rem;
    }
    .hero-title {
        font-size: 1.6rem;
    }
    .hero-subtitle {
        font-size: 0.9rem;
    }

    /* Stat cards: tighter */
    .stat-card {
        padding: 12px 10px;
    }
    .stat-card .stat-val {
        font-size: 1.4rem;
    }
    .stat-card .stat-label {
        font-size: 10px;
    }

    /* Headings: scale down */
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1.1rem; }

    /* Container: edge-to-edge on tiny phones */
    .container {
        padding: 0 0.75rem;
    }

    /* Bottom nav icons: slightly smaller text labels */
    .student-nav-link .s-label {
        font-size: 0.5rem;
    }
}

/* ── Progress Ring (SVG donut) ──────────────────────────────────────────── */
.progress-ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.progress-ring {
    transform: rotate(-90deg);
    display: block;
}
.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary, #e2e8f0);
    stroke-width: 6;
}
.progress-ring-fill {
    fill: none;
    stroke: var(--primary, #4f46e5);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--pct, 0));
    transition: stroke-dashoffset 0.6s ease;
}
.progress-ring-pct {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    letter-spacing: 0.02em;
}

