:root {
    /* City Brain Theme */
    --bg-dark: #020617;
    --bg-panel: rgba(15, 23, 42, 0.90);
    --border-color: rgba(56, 189, 248, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;

    /* Mode Colors */
    --color-traffic: #10b981;
    /* Emerald Green */
    --color-mfg: #06b6d4;
    /* Cyan */
    --color-emergency: #f59e0b;
    /* Amber/Orange */
    --color-danger: #ef4444;
    /* Red */

    --font-main: "Outfit", sans-serif;
    --font-title: "Ma Shan Zheng", cursive;
    --font-tech: "Rajdhani", sans-serif;

    --shadow-glow: 0 0 10px rgba(6, 182, 212, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
        linear-gradient(rgba(2, 6, 23, 0.95), rgba(2, 6, 23, 0.95)),
        url('https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?q=80&w=2670&auto=format&fit=crop');
    background-size: cover;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

/* Header */
.dashboard-header {
    height: 70px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pulse-circle {
    width: 12px;
    height: 12px;
    background: var(--color-mfg);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.title-group h1 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: -5px;
}

.title-group .highlight {
    color: var(--color-mfg);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.subtitle {
    font-family: var(--font-tech);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
}

.mode-nav {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 8px;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--color-mfg);
    color: var(--color-mfg);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

/* Mode Specific Colors */
body[data-mode="traffic"] .nav-btn.active {
    border-color: var(--color-traffic);
    color: var(--color-traffic);
    background: rgba(16, 185, 129, 0.15);
}

body[data-mode="emergency"] .nav-btn.active {
    border-color: var(--color-emergency);
    color: var(--color-emergency);
    background: rgba(245, 158, 11, 0.15);
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-tech);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-traffic);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--color-traffic);
    border-radius: 50%;
}

.date-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Main Layout */
.dashboard-main {
    display: flex;
    flex: 1;
    gap: 10px;
    overflow: hidden;
}

.panel {
    width: 320px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-deco {
    width: 40px;
    height: 2px;
    background: var(--color-mfg);
    box-shadow: 0 0 5px var(--color-mfg);
}

.panel-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Guide Box */
.guide-box {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.1), transparent);
    border-left: 3px solid var(--color-mfg);
    padding: 12px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 5px;
}

.guide-icon {
    font-size: 1.2rem;
}

.guide-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #fff;
}

/* Controls */
.control-group label,
.legend-box label,
.log-box label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-row {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn.primary {
    background: var(--color-mfg);
    color: #000;
}

.action-btn.warning {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.action-btn.secondary {
    background: rgba(6, 182, 212, 0.2);
    color: var(--color-mfg);
    border: 1px solid var(--color-mfg);
    width: 100%;
    margin-top: 10px;
}

.action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    border-left: 2px solid var(--text-secondary);
}

.highlight-red {
    color: #ef4444;
    font-weight: bold;
}

.highlight-cyan {
    color: #06b6d4;
    font-weight: bold;
}

.highlight-orange {
    color: #f59e0b;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

/* Legend */
.legend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.l-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.l-line {
    width: 20px;
    height: 2px;
}

/* Visualizer */
.visualizer-container {
    flex: 1;
    background: rgba(2, 6, 23, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-lines {
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Tooltip */
.custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--color-mfg);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* SVG Elements */
.edge-line {
    stroke: #334155;
    stroke-width: 1.5;
    transition: all 0.3s;
}

.edge-line.active {
    stroke-width: 3;
    filter: drop-shadow(0 0 5px currentColor);
}

.node-group {
    cursor: pointer;
    transition: all 0.3s;
}

/* REMOVED HOVER SCALE TO PREVENT SHAKING */
.node-group:hover .node-circle {
    stroke: #fff;
    stroke-width: 3;
}

.node-circle {
    fill: #1e293b;
    stroke: #94a3b8;
    stroke-width: 2;
    transition: all 0.2s;
}

.node-label {
    font-size: 10px;
    fill: #fff;
    text-anchor: middle;
    pointer-events: none;
    font-family: var(--font-tech);
}

/* Right Panel Stats */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-tech);
    font-size: 1.2rem;
    font-weight: 700;
}

.stat-value.highlight {
    color: var(--color-mfg);
}

/* Theme Box */
.theme-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 15px;
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.red-star {
    color: #ef4444;
    font-size: 1.2rem;
}

.theme-header h4 {
    color: #fca5a5;
    font-family: var(--font-title);
    font-size: 1.1rem;
}

.theme-content p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #e2e8f0;
}

/* Logs */
.log-list {
    height: 150px;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.log-item {
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 2px;
}

.log-item span {
    color: var(--color-mfg);
    margin-right: 5px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}