/* ============================================
   C3 — CONTROL CENTRE
   Retro CRT + Anime-themed Design System
   ============================================ */

:root {
    /* Backgrounds */
    --bg-deep: #07070d;
    --bg-surface: #0d0d15;
    --bg-elevated: #12121e;
    --bg-card: #151522;
    --bg-hover: #1a1a2e;

    /* Borders */
    --border: #1a1a2e;
    --border-bright: #2a2a45;
    --border-glow: rgba(232, 197, 71, 0.2);

    /* Primary — Amber (CRT) */
    --amber: #e8c547;
    --amber-dim: #b89a30;
    --amber-glow: 0 0 12px rgba(232, 197, 71, 0.25);
    --amber-strong-glow: 0 0 20px rgba(232, 197, 71, 0.4);

    /* Accents */
    --green: #24e08a;
    --green-dim: rgba(36, 224, 138, 0.15);
    --red: #ff5c5c;
    --red-dim: rgba(255, 92, 92, 0.15);
    --cyan: #00d4ff;
    --cyan-dim: rgba(0, 212, 255, 0.15);
    --purple: #b44dff;
    --purple-dim: rgba(180, 77, 255, 0.15);
    --orange: #ff9f43;
    --orange-dim: rgba(255, 159, 67, 0.15);
    --pink: #ff6b9d;
    --pink-dim: rgba(255, 107, 157, 0.15);

    /* Division Colors (Anime) */
    --dbz: #ff6b35;
    /* Dragon Ball Z — fiery orange */
    --dbz-dim: rgba(255, 107, 53, 0.12);
    --naruto: #ff9f43;
    /* Naruto — gold/orange */
    --naruto-dim: rgba(255, 159, 67, 0.12);
    --onepiece: #00d4ff;
    /* One Piece — ocean blue */
    --onepiece-dim: rgba(0, 212, 255, 0.12);
    --jjk: #b44dff;
    /* Jujutsu Kaisen — cursed purple */
    --jjk-dim: rgba(180, 77, 255, 0.12);
    --bots: #24e08a;
    /* Automation — matrix green */
    --bots-dim: rgba(36, 224, 138, 0.12);

    /* Text */
    --text-primary: #e8e0cc;
    --text-secondary: #8b8b7a;
    --text-dim: #5a5a50;
    --text-amber: #e8c547;

    /* Typography */
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --font-display: 'Orbitron', 'SF Pro Display', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    /* Spacing */
    --gap-xs: 4px;
    --gap-sm: 8px;
    --gap-md: 12px;
    --gap-lg: 16px;
    --gap-xl: 24px;
    --gap-2xl: 32px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

/* ============================================
   CRT EFFECTS
   ============================================ */

.scanline-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    mix-blend-mode: multiply;
}

/* Subtle screen curvature vignette */
.scanline-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.35) 100%);
}

/* ============================================
   BOOT SCREEN
   ============================================ */

#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-deep);
    display: grid;
    place-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#boot-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.boot-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.boot-logo {
    font-size: 72px;
    margin-bottom: 12px;
    animation: boot-pulse 2s ease-in-out infinite;
}

@keyframes boot-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.3);
    }
}

.boot-title {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 900;
    color: var(--amber);
    text-shadow: var(--amber-strong-glow);
    letter-spacing: 12px;
    margin-bottom: 4px;
}

.boot-subtitle {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 6px;
    margin-bottom: 36px;
}

.boot-progress {
    width: 100%;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.boot-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--green));
    border-radius: 2px;
    transition: width 0.15s ease;
    box-shadow: 0 0 8px var(--amber);
}

.boot-log {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-align: left;
    min-height: 120px;
    line-height: 1.8;
}

.boot-log .log-line {
    opacity: 0;
    animation: log-fade-in 0.3s ease forwards;
}

@keyframes log-fade-in {
    to {
        opacity: 1;
    }
}

.boot-log .log-ok {
    color: var(--green);
}

.boot-log .log-warn {
    color: var(--orange);
}

.boot-log .log-info {
    color: var(--text-secondary);
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: 40px 1fr;
    grid-template-areas:
        "sidebar titlebar"
        "sidebar content";
    height: 100vh;
    overflow: hidden;
}

.app.hidden {
    display: none;
}

/* ============================================
   TITLE BAR
   ============================================ */

.titlebar {
    grid-area: titlebar;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    -webkit-app-region: drag;
    padding: 0 16px 0 80px;
    /* space for macOS traffic lights */
    user-select: none;
}

.titlebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.titlebar-icon {
    font-size: 14px;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    gap: 8px;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: 16px;
    padding-top: 24px;
    /* space for macOS traffic lights */
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 8px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
}

.nav-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--amber);
    border-radius: 0 2px 2px 0;
    transition: height 0.2s ease;
    box-shadow: var(--amber-glow);
}

.nav-btn:hover {
    background: var(--bg-hover);
}

.nav-btn.active {
    background: var(--bg-hover);
}

.nav-btn.active::before {
    height: 24px;
}

.nav-btn.active .nav-icon {
    filter: brightness(1.3);
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    font-size: 8px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn.active .nav-label {
    color: var(--amber);
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px;
}

.gateway-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.indicator-text {
    font-size: 7px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    grid-area: content;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-deep);
}

.view {
    display: none;
    padding: var(--gap-xl);
    min-height: 100%;
}

.view.active {
    display: block;
}

/* ============================================
   SHARED COMPONENTS
   ============================================ */

.section-header {
    display: flex;
    align-items: baseline;
    gap: var(--gap-md);
    margin-bottom: var(--gap-xl);
}

.section-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--amber);
    text-shadow: var(--amber-glow);
}

.section-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

/* Stat Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--gap-md);
    margin-bottom: var(--gap-xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--gap-lg);
    text-align: center;
    transition: border-color 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-bright);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    color: var(--amber);
    text-shadow: var(--amber-glow);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card[data-color="green"] .stat-value {
    color: var(--green);
    text-shadow: 0 0 12px rgba(36, 224, 138, 0.3);
}

.stat-card[data-color="green"] {
    border-color: rgba(36, 224, 138, 0.15);
}

.stat-card[data-color="red"] .stat-value {
    color: var(--red);
    text-shadow: 0 0 12px rgba(255, 92, 92, 0.3);
}

.stat-card[data-color="red"] {
    border-color: rgba(255, 92, 92, 0.15);
}

.stat-card[data-color="cyan"] .stat-value {
    color: var(--cyan);
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.stat-card[data-color="cyan"] {
    border-color: rgba(0, 212, 255, 0.15);
}

.stat-card[data-color="purple"] .stat-value {
    color: var(--purple);
    text-shadow: 0 0 12px rgba(180, 77, 255, 0.3);
}

.stat-card[data-color="purple"] {
    border-color: rgba(180, 77, 255, 0.15);
}

.stat-card[data-color="orange"] .stat-value {
    color: var(--orange);
    text-shadow: 0 0 12px rgba(255, 159, 67, 0.3);
}

.stat-card[data-color="orange"] {
    border-color: rgba(255, 159, 67, 0.15);
}