:root {
    --bg-dark: #eef2f5;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(0, 0, 0, 0.1);
    --neon-cyan: #0077b6;
    --neon-magenta: #d90429;
    --text-main: #1a1a2e;
    --text-muted: #5c677d;
    --font-ui: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
}

/* Ambient Background Glares */
.ambient-glow { position: absolute; border-radius: 50%; filter: blur(150px); z-index: -1; opacity: 0.15; }
.cyan-glow { width: 600px; height: 600px; background: var(--neon-cyan); top: -100px; left: -100px; }
.purple-glow { width: 500px; height: 500px; background: var(--neon-magenta); bottom: -100px; right: -100px; }

/* Base Layout */
.app-container { display: flex; height: 100vh; padding: 20px; gap: 20px; }

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05); /* Light shadow */
}

/* Sidebar */
.sidebar { width: 300px; display: flex; flex-direction: column; justify-content: space-between; }
.brand h1 { font-size: 24px; color: var(--text-main); letter-spacing: 2px; }
.sub-brand { font-size: 11px; color: var(--neon-cyan); font-weight: 600; letter-spacing: 1px; }

.nav-menu { display: flex; flex-direction: column; gap: 10px; margin-top: 40px; flex-grow: 1; }
.nav-btn { background: transparent; border: 1px solid transparent; color: var(--text-muted); font-family: var(--font-ui); font-size: 14px; text-align: left; padding: 12px 16px; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 12px; }
.nav-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--text-main); }
.nav-btn.active { background: rgba(0, 119, 182, 0.1); border: 1px solid rgba(0, 119, 182, 0.2); color: var(--neon-cyan); }
.icon { font-size: 18px; }

.system-status { background: rgba(255, 255, 255, 0.5); border-radius: 8px; padding: 16px; border: 1px solid var(--glass-border); }
.status-indicator { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; font-size: 11px; letter-spacing: 1px; font-weight: bold;}
.led { width: 8px; height: 8px; border-radius: 50%; background: #d90429; box-shadow: 0 0 8px #d90429; }
.led.online { background: var(--neon-cyan); box-shadow: 0 0 12px var(--neon-cyan); }

.stat-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-family: var(--font-mono); font-size: 12px; }
.stat-row:last-child { margin-bottom: 0; }
.stat-row .label { color: var(--text-muted); font-weight: bold;}
.text-neon { color: var(--neon-cyan); font-weight: bold;}

/* Main Content & Routing */
.main-content { flex-grow: 1; overflow-y: auto; position: relative; }
.main-content::-webkit-scrollbar { display: none; }
.tab-pane { display: none; animation: fadeIn 0.4s ease forwards; }
.tab-pane.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 16px 24px; }
.live-pulse { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--neon-magenta); }
.live-pulse .dot { width: 6px; height: 6px; background: var(--neon-magenta); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }

/* 3D Flip Cards */
.flip-card-container { display: flex; gap: 20px; align-items: stretch; justify-content: space-between; margin-bottom: 20px; }
.flip-card { background-color: transparent; width: 100%; height: 160px; perspective: 1000px; cursor: pointer; }
.flip-card-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.6s; transform-style: preserve-3d; }
.flip-card:hover .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--glass-border); }
.flip-card-front { background: rgba(0, 119, 182, 0.1); backdrop-filter: blur(14px); }
.flip-card-back { background: rgba(217, 4, 41, 0.1); backdrop-filter: blur(14px); transform: rotateY(180deg); color: var(--neon-magenta); }
.flip-title { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; font-weight: bold; text-transform: uppercase; margin-bottom: 10px; }
.flip-value { font-size: 32px; color: var(--neon-cyan); font-family: var(--font-mono); font-weight: 700; }
.flip-sub { font-size: 10px; margin-top: 8px; font-weight:bold;}

/* Grids */
.grid-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.col-span-2 { grid-column: span 2; }
.full-height { height: calc(100vh - 130px); overflow-y: auto; }

/* Table Styles */
.data-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; text-align: left; }
.data-table th { color: var(--text-muted); font-weight: bold; padding: 12px; border-bottom: 1px solid var(--glass-border); }
.data-table td { padding: 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.data-table tr:hover { background: rgba(0, 0, 0, 0.02); }

.btn-sm { background: transparent; border: 1px solid var(--neon-cyan); color: var(--neon-cyan); padding: 4px 10px; border-radius: 4px; cursor: pointer; font-family: var(--font-mono); font-size: 10px; transition: all 0.2s; font-weight: bold;}
.btn-sm:hover { background: rgba(0, 119, 182, 0.1); }

/* Console Log */
.log-console { background: rgba(255, 255, 255, 0.5); border: 1px solid var(--glass-border); border-radius: 6px; padding: 15px; height: 250px; overflow-y: auto; font-family: var(--font-mono); font-size: 11px; line-height: 1.6; }
.log-entry { margin-bottom: 4px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom:4px;}
.log-timestamp { color: #8d99ae; margin-right: 8px; }
.log-accent { color: var(--neon-cyan); font-weight: bold; }
.log-warn { color: #e85d04; font-weight: bold;}
.log-crit { color: var(--neon-magenta); font-weight: bold;}

/* Switches */
.flex-row { display: flex; gap: 20px; }
.control-box { background: rgba(255, 255, 255, 0.4); border: 1px solid var(--glass-border); padding: 20px; border-radius: 8px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.control-box h4 { font-size: 11px; color: var(--text-main); text-align: center; font-weight: bold;}
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.1); transition: .4s; border-radius: 34px; border: 1px solid var(--glass-border);}
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.3);}
input:checked + .slider { background-color: var(--neon-cyan); box-shadow: 0 0 10px rgba(0,119,182,0.3); }
input:checked + .slider:before { transform: translateX(24px); }
.status-txt { font-family: var(--font-mono); font-size: 12px; font-weight: bold;}

/* Modal */
.modal-overlay { background: rgba(255, 255, 255, 0.8); position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: none; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(5px); }
.modal-overlay.active { display: flex; }
.modal-content { width: 600px; max-width: 90%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; color: var(--text-main);}
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.code-block { background: #f8f9fa; border: 1px solid #dee2e6; padding: 15px; border-radius: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--neon-magenta); white-space: pre-wrap; max-height: 400px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 15px; margin-top: 20px; }
.btn { padding: 10px 20px; font-family: var(--font-ui); font-size: 12px; border-radius: 6px; cursor: pointer; border: none; font-weight: bold; }
.btn-outline { background: transparent; border: 1px solid var(--neon-cyan); color: var(--neon-cyan); }
.btn-danger { background: rgba(217, 4, 41, 0.1); border: 1px solid var(--neon-magenta); color: var(--neon-magenta); }
