:root {
    /* Light Mode Tokens */
    --bg-base: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.5);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-primary: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    --trend-up: #10b981;
    --trend-down: #ef4444;
    --trend-neutral: #f59e0b;
}

[data-theme="dark"] {
    --bg-base: #020617;
    --bg-glass: rgba(15, 23, 42, 0.6);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #60a5fa;
    --accent-glow: rgba(96, 165, 250, 0.6);
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--card-shadow);
}

/* Sidebar */
.sidebar {
    width: 260px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-glass);
    z-index: 10;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 3rem;
}

.logo-glow {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--accent-glow);
    margin-bottom: 1rem;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

.nav-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-glass);
}

.theme-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--text-secondary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-radius: 12px;
}

.header-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.header-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.glow-effect {
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
}

.rna-icon { background: linear-gradient(135deg, #10b981, #059669); }
.gene-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.cell-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }

.kpi-data h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trend {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.trend.up { background: rgba(16, 185, 129, 0.1); color: var(--trend-up); }
.trend.down { background: rgba(239, 68, 68, 0.1); color: var(--trend-down); }
.trend.neutral { background: rgba(245, 158, 11, 0.1); color: var(--trend-neutral); }

.kpi-data p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.alert-card {
    border: 1px solid rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--trend-down);
}

/* Charts & Insights */
.chart-container {
    grid-column: span 2;
    padding: 1.5rem;
    border-radius: 12px;
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.chart-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.canvas-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.insights-panel {
    grid-column: span 1;
    padding: 1.5rem;
    border-radius: 12px;
}

.insight-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.insight-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.insight-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.insight-indicator.critical { background: var(--trend-down); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.insight-indicator.success { background: var(--trend-up); box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }

.insight-text h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.insight-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .chart-container, .insights-panel {
        grid-column: span 1;
    }
}

.footer-note {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
    transition: border-color 0.3s;
}

.footer-note .disclaimer {
    font-size: 10px;
    color: #f59e0b;
    margin-top: 4px;
    font-style: italic;
}

.powered-by {
    animation: pulse-animation 2s infinite ease-in-out;
    color: var(--accent-primary);
    font-weight: 500;
}

@keyframes pulse-animation {
    0% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 8px var(--accent-glow); }
    100% { opacity: 0.5; }
}

[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
    opacity: 0;
    animation: tooltip-fade 0.2s forwards 0.1s;
}

.nav-item[data-tooltip]:hover::after {
    left: calc(100% + 8px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

@keyframes tooltip-fade {
    to { opacity: 1; }
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .sidebar {
        display: none !important;
    }
    .app-container {
        display: block;
    }
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        width: 100% !important;
    }
    .glass-panel {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    .header-actions {
        display: none !important;
    }
    .dashboard-grid {
        display: block !important;
        width: 100% !important;
    }
    .kpi-card {
        display: inline-block !important;
        width: 31% !important;
        margin: 0 1% 20px 1% !important;
        box-sizing: border-box !important;
        page-break-inside: avoid;
        vertical-align: top;
    }
    .chart-container, .insights-panel, .controls-panel {
        display: block !important;
        width: 100% !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
        box-sizing: border-box !important;
        clear: both;
    }
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    .print-footer {
        display: block !important;
        margin-top: 40px;
        padding-top: 20px;
        border-top: 1px solid #ccc;
        text-align: center;
        font-size: 12px;
        color: #666;
        page-break-inside: avoid;
    }
}
