:root {
    /* Color Palette */
    --bg-dark: #0a0a0c;
    --bg-panel: #111318;
    --border-color: #2a2e38;
    
    --text-main: #e2e8f0;
    --text-muted: #64748b;
    
    --neon-green: #10b981;
    --neon-blue: #38bdf8;
    --neon-red: #ef4444;
    --neon-yellow: #f59e0b;

    /* Typography */
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden; /* Prevent scrolling for dashboard feel */
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    gap: 1rem;
}

/* --- Header --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel);
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sys-status {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--neon-green);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--neon-green);
    border-radius: 4px;
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.system-time {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--neon-blue);
}

/* --- Grid Layout --- */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr;
    gap: 1rem;
    height: 100%;
    min-height: 0; /* Important for nested scrollbars */
}

/* --- Widgets --- */
.widget {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.widget.alert-active {
    border-color: var(--neon-red);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
    animation: borderFlash 1s infinite alternate;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h2 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.status-indicator {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--neon-green);
}

.status-indicator.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--neon-yellow);
}

.status-indicator.critical {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--neon-red);
    animation: textFlash 1s infinite alternate;
}

/* Sensor Visuals */
.sensor-value {
    font-size: 3.5rem;
    font-weight: 600;
    font-family: var(--font-mono);
    margin-bottom: 1rem;
}

.unit {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-top: auto;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--neon-blue);
    width: 0%;
    transition: width 0.5s ease-out, background-color 0.3s;
}

/* --- Control Panel --- */
.control-panel {
    grid-column: 1 / 2;
}

.controls-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.btn-danger {
    background-color: transparent;
    color: var(--neon-red);
    border: 1px solid var(--neon-red);
    padding: 1rem;
    font-family: var(--font-mono);
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.system-stats {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.system-stats p {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.system-stats span {
    color: var(--text-main);
}

/* --- Security Terminal --- */
.security-terminal {
    grid-column: 2 / 4; /* Spans two columns */
    background-color: #050505; /* Darker than panel for terminal feel */
}

.terminal-header {
    border-bottom: 1px solid #1f2937;
}

.terminal-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 5px;
    background-color: #374151;
}

.terminal-dots span:nth-child(1) { background-color: #ef4444; }
.terminal-dots span:nth-child(2) { background-color: #f59e0b; }
.terminal-dots span:nth-child(3) { background-color: #10b981; }

.terminal-body {
    flex-grow: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    padding-right: 10px;
}

/* Custom Scrollbar for terminal */
.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-track { background: var(--bg-dark); }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.log-entry { margin-bottom: 0.25rem; }
.log-entry.system { color: var(--text-muted); }
.log-entry.info { color: var(--neon-blue); }
.log-entry.warning { color: var(--neon-yellow); }
.log-entry.critical { color: var(--neon-red); font-weight: bold; }
.log-entry .timestamp { color: var(--text-muted); margin-right: 10px; font-size: 0.75rem; }

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background-color: var(--bg-panel);
    border-left: 4px solid var(--neon-red);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-ui);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out forwards;
}

/* --- Animations --- */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes borderFlash {
    from { border-color: var(--border-color); }
    to { border-color: var(--neon-red); }
}

@keyframes textFlash {
    from { color: var(--neon-red); opacity: 1; }
    to { color: var(--neon-red); opacity: 0.4; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}