/* assets/css/style.css - Premium In-Memory Spreadsheet Styling (Light Mode Default) */

:root {
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-blue: #2563eb;
    --accent-indigo: #4f46e5;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    --border-color: #cbd5e1;

    /* Table Headers Color System - Light Default */
    --th-ct1-bg: #e0f2fe;
    --th-ct1-text: #0284c7;
    --th-co1-bg: #dbeafe;
    --th-co2-bg: #e0e7ff;
    --th-ct2-bg: #d1fae5;
    --th-ct2-text: #059669;
    --th-co3-bg: #ecfdf5;
    --th-co4-bg: #f0fdf4;
    --th-co5-bg: #f0fdfa;
    --th-calc-bg: #f1f5f9;
}

body.dark-theme {
    --bg-main: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.95);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.12);
    --th-ct1-bg: #1e293b;
    --th-ct1-text: #60a5fa;
    --th-co1-bg: #172554;
    --th-co2-bg: #1e1b4b;
    --th-ct2-bg: #1e293b;
    --th-ct2-text: #a7f3d0;
    --th-co3-bg: #064e3b;
    --th-co4-bg: #14532d;
    --th-co5-bg: #0f5132;
    --th-calc-bg: #334155;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Header */
.app-header {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
body.dark-theme .app-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
}

/* Cards */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Session Notice Banner */
.notice-banner {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: #b45309;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
}
body.dark-theme .notice-banner {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

/* Table Container & Sticky Elements */
.table-responsive-container {
    max-height: 75vh;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.table-marks {
    font-size: 0.85rem;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    color: var(--text-primary);
}

/* Header Rows */
.table-marks thead tr th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #e2e8f0;
    color: #0f172a;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 6px 8px;
    white-space: nowrap;
}

body.dark-theme .table-marks thead tr th {
    background: #1e293b;
    color: #f8fafc;
}

/* Specific Header Row Offsets for Sticky Multi-tier */
.table-marks thead tr:nth-child(1) th { top: 0; z-index: 14; }
.table-marks thead tr:nth-child(2) th { top: 32px; z-index: 13; }
.table-marks thead tr:nth-child(3) th { top: 62px; z-index: 12; }
.table-marks thead tr:nth-child(4) th { top: 90px; z-index: 11; background-color: #cbd5e1; }
body.dark-theme .table-marks thead tr:nth-child(4) th { background-color: #334155; }

/* Sticky Left Columns for Student Roll & Name */
.table-marks th.sticky-col,
.table-marks td.sticky-col {
    position: sticky;
    z-index: 15;
    background: var(--card-bg);
}
.table-marks th.sticky-col-1,
.table-marks td.sticky-col-1 {
    left: 0;
    min-width: 140px;
}
.table-marks th.sticky-col-2,
.table-marks td.sticky-col-2 {
    left: 140px;
    min-width: 220px;
    border-right: 2px solid var(--accent-blue) !important;
}

/* Sticky Right Column for Actions */
.table-marks th.sticky-col-right,
.table-marks td.sticky-col-right {
    position: sticky;
    right: 0;
    z-index: 16;
    background: var(--card-bg);
    border-left: 2px solid var(--accent-blue) !important;
}

/* Calculated Formula Column Highlighting */
.calc-col {
    background-color: rgba(37, 99, 235, 0.08) !important;
    font-weight: 600;
    color: #1d4ed8 !important;
}
body.dark-theme .calc-col {
    background-color: rgba(59, 130, 246, 0.08) !important;
    color: #60a5fa !important;
}

.ct1-bg { background-color: rgba(99, 102, 241, 0.05); }
.ct2-bg { background-color: rgba(16, 185, 129, 0.05); }

/* Hover Rows */
.table-marks tbody tr:hover td {
    background-color: rgba(37, 99, 235, 0.08) !important;
}

.table-marks td {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 6px 10px;
    vertical-align: middle;
}

/* Badges & Buttons */
.badge-total {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-glow-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}
.btn-glow-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
    color: #fff;
}

.btn-glow-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
}
.btn-glow-purple:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    color: #fff;
}

.btn-glow-excel {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
}
.btn-glow-excel:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    color: #fff;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.8);
}
body.dark-theme ::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.7);
}
