:root {
    /* Core Palette: Deep Space & Neon */
    --bg-color: #030712;
    /* Slate 950 */
    --glass-bg: rgba(17, 24, 39, 0.7);
    /* Gray 900 with opacity */
    --glass-border: rgba(56, 189, 248, 0.1);
    /* Sky 400 low opacity */

    --primary-color: #0ea5e9;
    /* Sky 500 */
    --accent-color: #8b5cf6;
    /* Violet 500 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --card-bg: rgba(30, 41, 59, 0.4);
    /* Slate 800 low opacity */

    --font-main: 'Outfit', sans-serif;
}

.light-mode {
    --bg-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(14, 165, 233, 0.2);
    --primary-color: #0284c7;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.6);
}

.light-mode .popup-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

.light-mode .project-name {
    background: linear-gradient(to right, #1e293b, #475569);
    -webkit-background-clip: text;
    background-clip: text;
}

.light-mode .hero-section h1 {
    color: #1e293b;
}

.light-mode .glass-card {
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.light-mode .ai-card {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.15) 0%, transparent 40%);
    font-family: var(--font-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

/* 1. Startup Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out;
}

.popup-hidden {
    opacity: 0;
    pointer-events: none;
}

.popup-content {
    width: 90%;
    max-width: 700px;
    padding: 4rem 2rem;
    text-align: center;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 80px rgba(139, 92, 246, 0.2);
    background: rgba(3, 7, 18, 0.95);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

/* Decorative background line in popup */
.popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.university-title {
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.dept-title {
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 3rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.project-name {
    font-size: 4rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.project-tagline {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.loader-bar {
    width: 60%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.loader-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 40%;
    background: var(--accent-color);
    animation: loading 2s infinite ease-in-out;
}

@keyframes loading {
    0% {
        left: -40%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.developer-credit {
    text-align: left;
}

.dev-name {
    display: block;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 600;
}

.dev-role {
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* 2. Dashboard Layout */
#app-container {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.dashboard-hidden {
    display: none;
}

.dashboard-visible {
    display: block;
    /* Opacity will be handled inline or via a utility, 
       but we need the display:block to be set first */
}

/* Helper to trigger fade */
.fade-in-active {
    opacity: 1 !important;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-green {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* KPI Cards */
.pulse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    transition: transform 0.3s, border-color 0.3s;
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.text-green {
    color: var(--success-color);
}

.text-red {
    color: var(--danger-color);
}

.text-blue {
    color: var(--primary-color);
}

.kpi-pulse-bar {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.green-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 68%;
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.red-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 14%;
    background: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

/* Charts Layout */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

.big-chart {
    min-height: 400px;
}

.small-chart {
    min-height: 250px;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.live-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    animation: flash 2s infinite;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* AI Intro */
.ai-intro-section {
    margin-top: 4rem;
}

.ai-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.ai-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
}

.ai-text strong {
    color: #fff;
    font-weight: 600;
}

/* Footer */
.glass-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    margin-top: 4rem;
}

/* Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    color: white;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.6rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon:hover {
    color: #fff;
    border-color: var(--primary-color);
}

/* Crisis Banner */
.hidden {
    display: none;
}

.crisis-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(90deg, #7f1d1d, #ef4444);
    color: white;
    padding: 1rem;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.5s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.close-banner {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
}