:root {
    --bg-dark: #050505;
    --bg-panel: rgba(10, 10, 10, 0.85);
    
    /* Theme Accents */
    --accent-main: #e63946;
    --accent-dark: #9e1b25;
    --accent-glow: rgba(230, 57, 70, 0.4);

    --green-main: #2a9d8f;
    --green-bright: #00ff88;
    --text-main: #d3d3d3;
    --text-muted: #6c757d;
    --border-color: #222;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#grid-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(230, 57, 70, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(230, 57, 70, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
    pointer-events: none;
}

.crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 50;
    pointer-events: none;
    opacity: 0.6;
}

#dashboard {
    position: relative;
    z-index: 1;
    width: 98vw;
    max-width: 1800px;
    height: 96vh;
    opacity: 0;
    transition: opacity 1.5s ease-in;
}

.complex-grid {
    display: grid;
    grid-template-columns: 280px 1fr 350px;
    grid-template-rows: 50px 1fr 120px;
    gap: 15px;
}

.sys-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 0 10px rgba(0,0,0,0.5);
    padding: 15px;
    position: relative;
}

/* Add corner brackets to panels for that sci-fi system look */
.sys-panel::before, .sys-panel::after {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    border: 1px solid var(--accent-main);
    opacity: 0.5;
    pointer-events: none;
}
.sys-panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.sys-panel::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* Grid Placements */
#top-panel { 
    grid-column: 1 / -1; 
    grid-row: 1; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}
#sidebar { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 20px; min-height: 0; }
#terminal-container { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; padding: 0; min-height: 0; overflow: hidden; }
#right-panel { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; min-height: 0; }
#bottom-panel { grid-column: 1 / -1; grid-row: 3; display: flex; flex-direction: column; min-height: 0; }

.app-visible {
    opacity: 1 !important;
}

#boot-screen {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-dark);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Fira Code', monospace;
    transition: opacity 1s ease-out;
}

#boot-text {
    width: 80%;
    max-width: 600px;
    font-size: 15px;
}

.boot-line { margin-bottom: 8px; animation: fadeIn 0.15s ease-out; }
.fade-out { opacity: 0; pointer-events: none; }

/* Top Panel */
.global-metrics {
    display: flex;
    gap: 30px;
    font-size: 12px;
    color: var(--text-muted);
}
.top-branding {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 2px;
}
.top-branding span { color: var(--accent-main); }

/* Left Sidebar */
.branding h1 { margin: 0; font-size: 28px; font-weight: 600; color: #fff; letter-spacing: -1px; }
.branding h1 span { color: var(--accent-main); }
.subtitle { font-size: 11px; color: var(--text-muted); letter-spacing: 2px; }

.telemetry-box h3 { font-size: 11px; color: var(--text-muted); margin: 0 0 6px 0; letter-spacing: 1px; }
.progress-bar { width: 100%; height: 6px; background: #222; border-radius: 3px; overflow: hidden; margin-bottom: 5px; }
.fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.red-fill { background: var(--accent-main); box-shadow: 0 0 8px var(--accent-main); }
.green-fill { background: var(--green-main); box-shadow: 0 0 8px var(--green-main); }

.metrics { display: flex; justify-content: space-between; font-size: 10px; color: #999; }
.metrics-large { font-size: 32px; font-weight: 300; color: var(--text-main); text-shadow: 0 0 10px rgba(255,255,255,0.2); }

/* CPU Cores Visualizer */
.core-matrix-container h3 { font-size: 11px; color: var(--text-muted); margin: 0 0 6px 0; letter-spacing: 1px; }
.core-matrix {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}
.core-box {
    height: 12px;
    background: #111;
    border: 1px solid #333;
    transition: background 0.1s, box-shadow 0.1s;
}

.status-indicator { margin-top: auto; font-size: 11px; color: var(--green-bright); display: flex; align-items: center; gap: 8px; }
.blinking-dot { width: 8px; height: 8px; background: var(--green-bright); border-radius: 50%; box-shadow: 0 0 8px var(--green-bright); animation: blink 1.5s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Main Terminal */
#terminal-header { background: #121212; padding: 10px 15px; display: flex; align-items: center; border-bottom: 1px solid var(--border-color); }
.window-controls { display: flex; gap: 6px; }
.btn { width: 12px; height: 12px; border-radius: 50%; }
.close { background: #ff5f56; } .min { background: #ffbd2e; } .max { background: #27c93f; }
.window-title { margin: 0 auto; font-size: 12px; color: #777; }

#terminal { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #333 transparent; }
#output { flex-grow: 1; white-space: pre-wrap; line-height: 1.5; font-size: 13px; }
#input-line { display: flex; align-items: center; margin-top: 15px; position: relative; cursor: text; }
#prompt { color: var(--accent-main); margin-right: 12px; font-weight: 600; }
.prompt-arrow { color: var(--green-bright); margin-left: 5px; }
#command-input { background: transparent; border: none; color: transparent; font-family: inherit; font-size: 13px; flex-grow: 1; outline: none; position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; z-index: 2; }
#typed-input { color: #fff; font-size: 13px; }
.cursor { display: inline-block; width: 8px; height: 15px; background-color: var(--text-main); vertical-align: middle; animation: cursorBlink 1s step-end infinite; margin-left: 2px; }
@keyframes cursorBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Right Panel */
.panel-header { font-size: 11px; letter-spacing: 1px; border-bottom: 1px solid #333; padding-bottom: 4px; margin-bottom: 8px; }
.data-stream-box { flex-grow: 1; overflow: hidden; font-size: 10px; line-height: 1.4; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.data-stream-box::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 20px;
    background: linear-gradient(var(--bg-panel), transparent); pointer-events: none;
}

/* Bottom Panel */
.socket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; font-size: 11px; overflow-y: hidden; }
.socket-row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); padding: 2px 0; }

/* Utilities */
.text-info { color: #888; }
.text-warn { color: #f4a261; }
.text-error { color: var(--accent-main); }
.text-success { color: var(--green-bright); }
.text-muted { color: #555; }
.text-highlight { color: #fff; font-weight: 600; }
.text-table-header { color: var(--accent-main); font-weight: 600; border-bottom: 1px dashed #333; display: inline-block; padding-bottom: 4px; margin-bottom: 4px; }
.new-line { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: translateX(0); } }

/* Mobile Responsive */
@media (max-width: 1024px) {
    .complex-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        width: 100vw;
    }
    #dashboard { height: auto; padding: 10px; border: none; }
    #terminal-container { min-height: 60vh; }
}
