/**
 * CBSE Result Analyzer - Premium Design System
 * 
 * This stylesheet implements a modern glassmorphic interface designed for
 * school administrators. It uses a sophisticated dark-mode palette with
 * vibrant primary gradients and high-performance blur effects.
 *
 * Design Language: Modern SaaS / Enterprise Dashboard
 * Typography: Plus Jakarta Sans
 */

:root {
    /* --- COLOR TOKENS --- */
    --primary: #8b5cf6;            /* Royal Violet */
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #1e293b;          /* Slate Navy */
    --accent: #06b6d4;             /* Electric Cyan */
    --bg-dark: #020617;            /* Deep Space Blue */
    --card-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --error: #f43f5e;
    --warning: #f59e0b;
}

/* --- BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    /* Subtle background texture for depth */
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- UI COMPONENTS: GLASSMORPHISM --- */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

header {
    margin-bottom: 3rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- DASHBOARD: ANALYTICS CARDS --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    padding: 1.25rem 1.75rem;
    position: relative;
    overflow: hidden;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.1rem;
    font-weight: 800;
}

/* Visual accent line for priority metrics */
.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    opacity: 0.5;
}

/* --- LAYOUT: GRIDS & WRAPPERS --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.chart-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

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

/* --- DATA VISUALIZATION: TABLES --- */
.table-section {
    padding: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-error { background: rgba(244, 63, 94, 0.1); color: var(--error); }

/* --- INTERACTIVE: BUTTONS & INPUTS --- */
.btn {
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #7c3aed;
    box-shadow: 0 6px 20px 0 var(--primary-glow);
}

/* File Upload Target Zone */
.drop-zone {
    border: 3px dashed var(--glass-border);
    padding: 5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

/* --- NAVIGATION: TAB SYSTEM --- */
.tab-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tab-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-link.active {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: block;
}

/* --- FEEDBACK: SUPPORT HUB & FLOATING ACTIONS --- */
.support-hub {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6);
}

.support-menu {
    position: absolute;
    bottom: 80px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s ease;
}

.support-hub.active .support-menu {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.support-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.support-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-5px);
}

/* --- FEEDBACK: MODAL OVERLAYS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.825rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: white;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select option,
.form-control option {
    background: #0f172a;
    color: #f8fafc;
    padding: 12px;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover { color: white; }

/* --- MOTION & ANIMATION --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
