:root {
    /* CATCHY ELECTRIC BLUE PALETTE */
    --primary: #2563eb;
    /* Brighter Blue */
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --accent: #06b6d4;
    /* Cyan Accent */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-body: #f0f4f8;
    /* Cool Bluish Grey */
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --glass: rgba(255, 255, 255, 0.7);
    /* Frostier glass */
    --shadow-sm: 0 1px 3px rgba(37, 99, 235, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(37, 99, 235, 0.1), 0 2px 4px -1px rgba(37, 99, 235, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(37, 99, 235, 0.1), 0 10px 10px -5px rgba(37, 99, 235, 0.04);
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(30, 41, 59, 0.7);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    transition: background 0.3s ease, color 0.3s ease;
    font-size: 0.925rem;
    /* Scaled down from default 16px */
}

/* Typography Utilities */
h1,
.h1 {
    font-size: 2rem;
}

h2,
.h2 {
    font-size: 1.75rem;
}

h3,
.h3 {
    font-size: 1.5rem;
}

h4,
.h4 {
    font-size: 1.25rem;
}

h5,
.h5 {
    font-size: 1.1rem;
}

h6,
.h6 {
    font-size: 0.95rem;
}

/* --- ULTRA CARD DESIGN --- */
.ultra-card {
    background: var(--bg-card);
    border-radius: 16px;
    /* Reduced from 20px */
    box-shadow: var(--shadow-md);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    border: 1px solid var(--border);
    overflow: hidden;
}

.ultra-card:hover {
    transform: translateY(-3px);
    /* Reduced movement */
    box-shadow: var(--shadow-lg);
}

/* Utilities */
.icon-box-lg {
    width: 48px;
    /* Reduced from 56px */
    height: 48px;
}

.ms-n2 {
    margin-left: -0.75rem;
}

.hover-scale {
    transition: transform 0.2s;
}

.hover-scale:hover {
    transform: scale(1.02);
}

.tracking-wide {
    letter-spacing: 0.05em;
}

/* --- ADMIN PANEL PREMIUM STYLES --- */

/* Sidebar */
.sidebar {
    width: 240px;
    /* Reduced from 260px */
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 2000;
    /* Increased to ensure clickable */
    padding: 1.25rem 0.85rem;
    /* Tighter padding */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Main Content Area - Global Fix */
.main-content {
    margin-left: 270px;
    /* Exact match to --sidebar-width */
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: auto;
}

/* Nav Items */
.nav-item-custom {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-item-custom i {
    width: 24px;
    font-size: 1rem;
    margin-right: 12px;
    transition: transform 0.2s ease;
}

.nav-item-custom:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.nav-item-custom:hover i {
    transform: translateX(3px);
}

.nav-item-custom.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-item-custom.active i {
    color: white;
}

/* Tables */
.table {
    margin-bottom: 0;
    color: var(--text-main);
}

.table thead th {
    background: transparent;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.02);
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
    }

    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* Hide sidebar toggle on desktop */
    .menu-toggle {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .menu-toggle {
        display: none !important;
    }
}

/* Login Page Styles (Preserved) */
body.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card-glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
    margin: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    position: relative;
    overflow: hidden;
}

.circle-decor {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -50px;
    left: -50px;
}

.circle-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: -50px;
}

.login-form-wrapper {
    padding: 4rem;
}

@media (max-width: 768px) {
    .login-form-wrapper {
        padding: 2rem;
    }
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
    color: var(--primary);
    transform: scale(.85) translateY(-.5rem) translateX(.15rem);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* =========================================
   PREMIUM UI UPGRADE - GLASSMORPHISM & ANIMATIONS
   ========================================= */

/* --- Glassmorphism Utilities --- */
.backdrop-blur {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.text-shadow-sm {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* --- Vibrant Gradients --- */
.grad-1 {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5D5D 100%);
}

/* Red-Coral */
.grad-2 {
    background: linear-gradient(135deg, #4FACFE 0%, #00F2FE 100%);
}

/* Blue-Cyan */
.grad-3 {
    background: linear-gradient(135deg, #43E97B 0%, #38F9D7 100%);
}

/* Green-Teal */
.grad-4 {
    background: linear-gradient(135deg, #FA709A 0%, #FEE140 100%);
}

/* Pink-Yellow */
.grad-5 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Purple */
.grad-6 {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
}

/* Sky Blue */

/* --- Animated Progress Ring --- */
.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 250px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    animation: progress 1.5s ease-out forwards;
    transform-origin: center;
}

@keyframes progress {
    0% {
        stroke-dasharray: 0 100;
    }
}

/* --- Interactive Hover Effects --- */
.group-hover-effect {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
}

.group-hover-effect:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15), 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.group-hover-effect:hover .card-header-visual {
    transform: scale(1.05);
    /* Zoom effect on header */
}

.group-hover-effect:hover .blur-3xl {
    opacity: 0.15 !important;
    transform: translate(0, 0) scale(1.2);
    /* Move blob */
}

/* Button Interactions */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-hover-scale {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-hover-scale:hover {
    transform: scale(1.05);
}

/* Decorative Elements */
.blur-3xl {
    filter: blur(64px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.pointer-events-none {
    pointer-events: none;
}

/* --- DASHBOARD PREMIUM CARDS --- */
.dashboard-card {
    background: #ffffff;
    border-radius: 16px;
    /* Reduced */
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.3);
}

.card-icon-bg {
    width: 48px;
    /* Reduced */
    height: 48px;
    /* Reduced */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.25rem;
    /* Reduced */
    margin-bottom: 0.75rem;
    transition: 0.3s;
}

.dashboard-card:hover .card-icon-bg {
    transform: scale(1.1) rotate(5deg);
}

.stat-value {
    font-size: 1.85rem;
    /* Reduced from 2.25rem */
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    /* Reduced */
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Gradient Variants */
.card-primary {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
}

.card-primary .card-icon-bg {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.card-warning {
    background: linear-gradient(145deg, #ffffff 0%, #fffbeb 100%);
}

.card-warning .card-icon-bg {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.card-success {
    background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
}

.card-success .card-icon-bg {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Subject Cards */
.subject-card {
    border: none;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: 0.3s;
    border: 1px solid #f1f5f9;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
    border-color: #6366f1;
}

.subject-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Quick Action Buttons */
.btn-action {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    transition: 0.3s;
    text-align: left;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn-action:hover {
    border-color: #6366f1;
    background: #f8fafc;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.05);
}

.btn-action i {
    font-size: 2rem;
    margin-bottom: 1rem;
    transition: 0.3s;
}

.btn-action:hover i {
    transform: scale(1.1);
}