

:root {
    
    --bg-main: #09090b;
    --sidebar-bg: rgba(15, 15, 18, 0.98);
    --card-bg: rgba(24, 24, 27, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.15);
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    
    --brand-primary: #8b5cf6;
    --brand-secondary: #3b82f6;
    --brand-gradient: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    --brand-glow: 0 0 24px rgba(139, 92, 246, 0.25);
    
  
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.15);
    
    --sidebar-width: 260px;
    --glass-blur: blur(20px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Table & Inputs */
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(255, 255, 255, 0.08);
    --row-hover: rgba(255, 255, 255, 0.025);
}

[data-theme="light"] {

    --bg-main: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.06);
    --card-hover-border: rgba(0, 0, 0, 0.12);
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --brand-glow: 0 8px 30px rgba(139, 92, 246, 0.15);
    
    --input-bg: #f1f5f9;
    --input-border: #e2e8f0;
    --row-hover: #f8fafc;
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}


::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 10px; opacity: 0.3; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-primary); }


.app-container { 
    display: flex; 
    width: 100%; 
    min-height: 100vh; 
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: background-color 0.3s, border-color 0.3s;
}

.brand {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.8px;
}

.brand i {
    -webkit-text-fill-color: initial;
    color: var(--brand-primary);
    font-size: 2rem;
}

.nav-menu { list-style: none; flex-grow: 1; display: flex; flex-direction: column; gap: 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link i { font-size: 1.4rem; transition: transform 0.25s ease; opacity: 0.7; }
.nav-link:hover { background: var(--row-hover); color: var(--text-primary); }
.nav-link:hover i { transform: translateX(2px); color: var(--brand-primary); opacity: 1; }
.nav-link.active { 
    background: rgba(139, 92, 246, 0.08); 
    color: var(--brand-primary); 
    font-weight: 700; 
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version-tag { 
    font-size: 0.75rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    background: var(--input-bg); 
    padding: 4px 10px; 
    border-radius: 20px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 3rem;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
}


.top-bar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 3rem; }
.page-title h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 4px; }
.page-title p { color: var(--text-secondary); font-size: 1.1rem; }


.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover { border-color: var(--card-hover-border); box-shadow: 0 20px 40px rgba(0,0,0,0.1); }


.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 24px; border-radius: var(--radius-md);
    border: none; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary { background: var(--brand-gradient); color: white; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25); }
.btn-primary:hover { box-shadow: var(--brand-glow); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 1.5px solid var(--card-border); color: var(--text-primary); }
.btn-outline:hover { background: var(--row-hover); border-color: var(--text-muted); }

/* Theme Toggle */
.theme-toggle-btn {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--input-bg); border: 1.5px solid var(--card-border);
    color: var(--text-primary); display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.3rem; transition: all 0.25s ease;
}


.upload-zone {
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-md);
    padding: 0;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(139, 92, 246, 0.02);
    cursor: pointer;
    display: block;
    width: 100%;
}

.upload-zone-content {
    padding: 4.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--brand-primary);
    background: rgba(139, 92, 246, 0.06);
    transform: scale(1.005);
}

.upload-icon { 
    font-size: 4rem; 
    color: var(--brand-primary); 
    margin-bottom: 1.5rem; 
    transition: transform 0.3s ease; 
}

.upload-zone:hover .upload-icon { transform: translateY(-8px); }
.upload-zone input[type="file"] { display: none; }

.feature-pill {
    padding: 1.5rem !important;
    border-left: 4px solid var(--accent) !important;
    background: linear-gradient(to right, rgba(0,0,0,0.02), transparent) !important;
}


.table-filters {
    padding: 1.25rem 1.5rem;
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

.filter-input {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    width: 280px;
    font-family: inherit;
}

.filter-select {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.filter-select option {
    background-color: #18181b; 
    color: var(--text-primary);
}

.row-counter {
    margin-left: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--card-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    table-layout: fixed;
}

th {
    padding: 18px 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    background: var(--input-bg);
    border-bottom: 1.5px solid var(--card-border);
    font-weight: 700;
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


th:nth-child(1), td:nth-child(1) { width: 65px; text-align: center; } /* Increased width to fix "1..." truncation */
th:nth-child(2), td:nth-child(2) { width: 100px; }
th:nth-child(3), td:nth-child(3) { width: 100px; }
th:nth-child(4), td:nth-child(4) { width: 100px; }
th:nth-child(5), td:nth-child(5) { width: auto; min-width: 250px; white-space: normal; }
th:nth-child(6), td:nth-child(6) { width: 140px; }
th:nth-child(7), td:nth-child(7) { width: 120px; }

tbody tr:hover td { background: var(--row-hover); }

.cm-grid {
    display: grid;
    grid-template-columns: 120px repeat(var(--cm-cols), 1fr);
    gap: 4px;
    margin-top: 1rem;
    background: var(--card-border);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cm-corner { background: var(--input-bg); }

.cm-head {
    background: var(--input-bg);
    padding: 12px 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cm-side {
    background: var(--input-bg);
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.cm-cell {
    padding: 20px 10px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.cm-correct { background: var(--success-bg); color: var(--success); }
.cm-wrong { background: var(--danger-bg); color: var(--danger); opacity: 0.6; }


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.stat-card-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.stat-card-inner i.bg-icon {
    position: absolute;
    right: -10px;
    bottom: -20px;
    font-size: 7rem;
    opacity: 0.04;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-val { font-size: 3rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-sub { font-size: 0.85rem; color: var(--text-muted); }


.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.badge-low { background: var(--success-bg); color: var(--success); }
.badge-medium { background: var(--info-bg); color: var(--info); }
.badge-high { background: var(--danger-bg); color: var(--danger); }


.insight-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-bottom: 2.5rem;
}

.insight-row.reverse .insight-text-col { order: 2; }
.insight-row.reverse .insight-visual-col { order: 1; }

.insight-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.insight-visual-col img {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    background: var(--input-bg);
}

.takeaway-box {
    background: var(--info-bg);
    border-left: 5px solid var(--info);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}



/* Accordion */
.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
    background: rgba(255, 255, 255, 0.01);
}

.accordion-body.open {
    max-height: 2000px;
    transition: max-height 0.8s ease-in-out;
}

.accordion-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--row-hover);
}

.chevron {
    transition: transform 0.3s ease;
}

/* FAB Buttons */
.fab-group {
    position: fixed;
    right: 3rem;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.fab-btn {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    backdrop-filter: var(--glass-blur);
}

.fab-btn.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.fab-btn:hover {
    transform: scale(1.1) translateY(-5px);
    filter: brightness(1.1);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.6);
}

@media (max-width: 1024px) {
    .main-content { padding: 2rem; }
    .insight-row { grid-template-columns: 1fr; gap: 2rem; }
    .insight-row.reverse .insight-text-col { order: unset; }
    .insight-row.reverse .insight-visual-col { order: unset; }
    .table-filters { flex-wrap: wrap; }
    .filter-input { width: 100%; }
    .row-counter { margin-left: 0; width: 100%; padding-top: 10px; border-top: 1px solid var(--card-border); }
}

@media (max-width: 768px) {
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .fab-group { right: 1.5rem; bottom: 1.5rem; }
}