/* ============================================
   PREMIUM SCHOOL DATA VISUALIZATION SITE
   World-Class Design with Advanced Effects
   ============================================ */

/* CSS Variables for Theming - Premium Blue/Teal Scheme */
:root {
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --success-gradient: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-surface-elevated: #334155;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.24);
    --shadow-2xl: 0 24px 80px rgba(0, 0, 0, 0.32);
    --glow: 0 0 20px rgba(59, 130, 246, 0.4);
    --glow-lg: 0 0 40px rgba(59, 130, 246, 0.6);
    --glow-xl: 0 0 60px rgba(59, 130, 246, 0.8);
}

/* Reduced Motion Support */
@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;
    }
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Static Background - No Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    display: none;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Optimized Header */
header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

header::before {
    display: none; /* Removed gradient line to fix visual split */
}

header::after {
    display: none; /* Disabled for performance */
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Removed animations for performance */

header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

header h1 .site-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.school-header .school-logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 120px;
    margin-right: 1.5rem;
}

.school-header .school-logo {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

.school-header .school-logo-fallback {
    font-size: 4rem;
    display: inline-block;
    line-height: 1;
}

.school-header .school-name {
    display: inline-block;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

nav a::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: -1;
}

nav a:hover {
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg), var(--glow);
    border-color: rgba(59, 130, 246, 0.5);
}

nav a:hover::before {
    left: 0;
}

nav a:hover::after {
    width: 300px;
    height: 300px;
}

nav a:active {
    transform: translateY(-1px) scale(0.98);
}

nav a:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Optimized Main Content */
main {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Welcome Section */
.welcome {
    text-align: center;
    padding: 4rem 2rem;
}

.welcome h2 {
    font-size: 3rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    position: relative;
}

.welcome p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.8;
}

/* Premium Button with Advanced Effects */
.btn-primary {
    display: inline-block;
    padding: 1.25rem 2.5rem;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

/* Stats Grid - Modern Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card::after {
    display: none; /* Disabled for performance */
}

.stat-card .stat-number {
    font-size: 3.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1;
    position: relative;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.5);
    padding: 1.5rem;
    margin-top: 2rem;
}

/* Modern Table Design */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

table thead {
    background: var(--primary-gradient);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

table th:first-child {
    border-top-left-radius: 16px;
}

table th:last-child {
    border-top-right-radius: 16px;
}

table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

table tbody tr {
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative;
}

table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 16px;
}

table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 16px;
}

table a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
}

table a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

table a:hover {
    color: #06b6d4;
}

table a:hover::after {
    width: 100%;
}

/* Data Source Badges */
table small {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    display: inline-block;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.data-item {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(59, 130, 246, 0.15);
    transition: transform 0.2s ease;
    position: relative;
}

.data-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.data-item:hover {
    transform: translateY(-2px);
}

.data-item:hover::before {
    transform: scaleX(1);
}

.data-item::after {
    display: none; /* Disabled for performance */
}

.data-item strong {
    color: #3b82f6;
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-item span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* School Profile Styles */
.school-profile {
    max-width: 1200px;
    margin: 0 auto;
}

.info-section,
.metrics-section,
.student-section {
    margin-bottom: 3rem;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: fadeInUp 0.6s ease-out both;
}

.info-section {
    animation-delay: 0.1s;
}

.metrics-section {
    animation-delay: 0.2s;
}

.student-section {
    animation-delay: 0.3s;
}

.info-section h2,
.metrics-section h2,
.student-section h2 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid;
    border-image: var(--primary-gradient) 1;
    position: relative;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.info-item {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    transition: transform 0.2s ease;
    position: relative;
}

.info-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.3);
}

.info-item:hover::before {
    transform: scaleX(1);
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item strong {
    color: #3b82f6;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.info-item a:hover {
    color: #06b6d4;
    text-decoration: underline;
}

/* Modern Metrics Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-card:hover::before {
    transform: scaleX(1);
}

.metric-card::after {
    display: none; /* Disabled for performance */
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.metric-value {
    font-size: 3rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
    position: relative;
}

.metric-value small {
    font-size: 0.75rem;
    display: block;
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.5rem;
    font-weight: 400;
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.chart-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.chart-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}


.chart-wrapper:hover::before {
    transform: scaleX(1);
}

.chart-wrapper h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chart-wrapper canvas {
    max-height: 350px;
}

/* Data Year Note */
#dataYearNote {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-style: italic;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    font-weight: 500;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile-First Enhancements */
/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .stat-card:hover,
    .metric-card:hover,
    .data-item:hover,
    .info-item:hover,
    .chart-wrapper:hover {
        transform: none;
    }
    
    /* Better touch targets */
    nav a,
    .btn-primary,
    table a {
        min-height: 48px;
        min-width: 48px;
        padding: 0.875rem 1.5rem;
    }
    
    /* Remove 3D transforms on mobile for performance */
    .stat-card,
    .metric-card,
    .data-item,
    .info-item {
        transform-style: flat;
    }
}

/* Safe Area Insets for Notched Devices */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    header {
        padding-top: max(1.5rem, env(safe-area-inset-top));
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }
    
    header {
        padding: 2rem;
    }
    
    header h1 {
        font-size: 2.25rem;
    }
    
    header h1 .site-logo {
        height: 50px;
    }
    
    main {
        padding: 2rem;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    /* Optimize animations for tablets */
    .stat-card,
    .metric-card,
    .data-item {
        animation-duration: 0.4s;
    }
}

@media (max-width: 768px) {
    /* Optimize background animations for mobile */
    body::before,
    body::after {
        animation-duration: 30s;
        opacity: 0.7;
    }
    
    .container {
        padding: 1rem;
    }
    
    header {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 20px;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
    
    header::after {
        display: none; /* Disable rotating gradient on mobile for performance */
    }
    
    header h1 {
        font-size: 1.75rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    header h1 .site-logo {
        height: 40px;
    }
    
    .school-header .school-logo-container {
        min-width: 80px;
        height: 80px;
        margin-right: 0.75rem;
    }
    
    .school-header .school-logo {
        max-width: 80px;
        max-height: 80px;
    }
    
    .school-header .school-logo-fallback {
        font-size: 3rem;
    }
    
    .school-header .school-name {
        font-size: 1.5rem;
        flex: 1;
        min-width: 0;
    }
    
    nav {
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    nav a {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
        flex: 1;
        text-align: center;
        min-width: 0;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
    }
    
    main {
        padding: 1.5rem;
        border-radius: 20px;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
    
    .welcome {
        padding: 2rem 1rem;
    }
    
    .welcome h2 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .welcome p {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .stat-card {
        padding: 1.75rem 1.5rem;
        border-radius: 20px;
    }
    
    .stat-card .stat-number {
        font-size: 2.75rem;
    }
    
    .stat-card .stat-label {
        font-size: 1rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .metric-card {
        padding: 1.75rem 1.5rem;
        border-radius: 20px;
    }
    
    .metric-value {
        font-size: 2.5rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .info-section,
    .metrics-section,
    .student-section {
        padding: 1.75rem 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 20px;
    }
    
    .info-section h2,
    .metrics-section h2,
    .student-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
        line-height: 1.3;
    }
    
    .info-item {
        padding: 1.25rem;
        border-radius: 14px;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .data-item {
        padding: 1.5rem;
        border-radius: 18px;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-wrapper {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .chart-wrapper h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    .chart-wrapper canvas {
        max-height: 250px;
    }
    
    /* Enhanced table for mobile */
    .table-container {
        margin: 1rem -1.5rem;
        padding: 0;
        border-radius: 0;
        background: transparent;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .table-container::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: var(--primary-gradient);
        border-radius: 4px;
    }
    
    table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 0.875rem 0.75rem;
        white-space: nowrap;
    }
    
    table th {
        font-size: 0.8rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    table a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0;
    }
    
    .btn-primary {
        padding: 1.125rem 1.75rem;
        font-size: 1rem;
        width: 100%;
        text-align: center;
        min-height: 52px;
        border-radius: 16px;
        font-weight: 700;
    }
    
    /* Feature cards on mobile */
    .welcome > div > div {
        padding: 1.5rem;
        border-radius: 18px;
        margin-bottom: 1rem;
    }
}

/* Landscape phones and small tablets (600px and below) */
@media (max-width: 600px) {
    .charts-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .chart-wrapper {
        padding: 1.5rem;
    }
    
    .chart-wrapper canvas {
        max-height: 240px;
    }
    
    /* Better spacing for landscape */
    .welcome {
        padding: 2rem 1rem;
    }
    
    .stats-grid,
    .metrics-grid {
        gap: 1.25rem;
    }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        padding: 1rem;
        border-radius: 16px;
    }
    
    header h1 {
        font-size: 1.375rem;
    }
    
    main {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .welcome h2 {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-number {
        font-size: 2rem;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
    
    .btn-primary {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* Mobile phones (480px and below) - Enhanced */
@media (max-width: 480px) {
    /* Further optimize animations */
    * {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.25);
    }
    
    body::before,
    body::after {
        opacity: 0.5;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    header {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: 18px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        line-height: 1.2;
    }
    
    header h1 .site-logo {
        height: 35px;
    }
    
    .school-header .school-logo-container {
        min-width: 60px;
        height: 60px;
        margin-right: 0.5rem;
    }
    
    .school-header .school-logo {
        max-width: 60px;
        max-height: 60px;
    }
    
    .school-header .school-logo-fallback {
        font-size: 2.5rem;
    }
    
    .school-header .school-name {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    
    nav {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.25rem;
    }
    
    nav a {
        width: 100%;
        padding: 1rem 1.25rem;
        min-height: 52px;
        font-size: 1rem;
        border-radius: 14px;
    }
    
    main {
        padding: 1.25rem;
        border-radius: 18px;
    }
    
    .welcome {
        padding: 1.5rem 0.5rem;
    }
    
    .welcome h2 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .welcome p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
    
    .stats-grid {
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem 1.25rem;
        border-radius: 18px;
    }
    
    .stat-card .stat-number {
        font-size: 2.25rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.95rem;
    }
    
    .metrics-grid {
        gap: 1rem;
    }
    
    .metric-card {
        padding: 1.5rem 1.25rem;
        border-radius: 18px;
    }
    
    .metric-label {
        font-size: 0.8rem;
        margin-bottom: 0.875rem;
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .info-section,
    .metrics-section,
    .student-section {
        padding: 1.5rem 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 18px;
    }
    
    .info-section h2,
    .metrics-section h2,
    .student-section h2 {
        font-size: 1.375rem;
        margin-bottom: 1.25rem;
        padding-bottom: 0.875rem;
        line-height: 1.3;
    }
    
    .info-grid {
        gap: 1rem;
    }
    
    .info-item {
        padding: 1.125rem;
        border-radius: 14px;
    }
    
    .info-item strong {
        font-size: 0.85rem;
        margin-bottom: 0.625rem;
    }
    
    .data-grid {
        gap: 1rem;
    }
    
    .data-item {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .data-item strong {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
    
    .data-item .metric-value {
        font-size: 1.5rem;
    }
    
    .charts-container {
        gap: 1.25rem;
    }
    
    .chart-wrapper {
        padding: 1.25rem;
        border-radius: 18px;
    }
    
    .chart-wrapper h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    .chart-wrapper canvas {
        max-height: 220px;
    }
    
    /* Enhanced mobile table */
    .table-container {
        margin: 1rem -1.25rem;
        padding: 0;
        border-radius: 0;
    }
    
    table {
        min-width: 650px;
        font-size: 0.8rem;
    }
    
    table th,
    table td {
        padding: 0.75rem 0.625rem;
    }
    
    table th {
        font-size: 0.75rem;
        padding: 0.875rem 0.625rem;
    }
    
    table a {
        min-height: 44px;
        padding: 0.375rem 0;
    }
    
    .btn-primary {
        padding: 1.125rem 1.5rem;
        font-size: 1rem;
        min-height: 52px;
        border-radius: 16px;
    }
    
    /* Feature cards spacing */
    .welcome > div > div {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: 16px;
    }
    
    /* Optimize text shadows for mobile */
    .welcome h2,
    header h1 .school-name {
        text-shadow: 0 2px 15px rgba(59, 130, 246, 0.2);
    }
    
    /* Reduce glow effects on mobile */
    .stat-card:hover,
    .metric-card:hover,
    .data-item:hover {
        box-shadow: var(--shadow-lg);
    }
}

/* Premium Scrollbar Styling */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.6) rgba(255, 255, 255, 0.1);
}

/* Page Transition Effect */
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Enhanced Focus States for Accessibility */
*:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Selection Styling */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
}

/* Smooth Transitions for All Interactive Elements */
a, button, input, select, textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Viewport Fix */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific */
    body {
        min-height: -webkit-fill-available;
    }
    
    html {
        height: -webkit-fill-available;
    }
}

/* Prevent text size adjustment on iOS */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header,
    main {
        background: white;
        box-shadow: none;
    }
    
    * {
        animation: none !important;
        transition: none !important;
    }
}
