* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto Mono', monospace;
    background: #0a0e1a;
    color: #00ff88;
    overflow-x: hidden;
    font-size: 12px;
}

.command-center {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0f1419 100%);
}

.header-terminal {
    background: #1a1f2e;
    border-bottom: 2px solid #00ff88;
    padding: 0;
}

.terminal-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f1419;
    padding: 8px 16px;
    border-bottom: 1px solid #333;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.control-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.control-dot.red { background: #ff4444; }
.control-dot.yellow { background: #ffaa00; }
.control-dot.green { background: #00ff88; }

.terminal-title {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 14px;
    color: #00ff88;
    text-transform: uppercase;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff88;
    animation: pulse 2s infinite;
}

.command-line {
    padding: 12px 16px;
    font-family: 'Roboto Mono', monospace;
    background: #1a1f2e;
    border-bottom: 1px solid #333;
}

.prompt {
    color: #00ff88;
    margin-right: 8px;
}

.cursor-blink {
    color: #ffffff;
    animation: blink 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.main-grid {
    display: flex;
    flex: 1;
    gap: 2px;
    background: #0a0e1a;
    flex-direction: column;
}

.left-panel, .right-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.center-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control-module, .stats-module, .ai-module, .log-terminal, .emergency-panel, .performance-monitor, .intersection-monitor, .algorithm-display {
    background: #1a1f2e;
    border: 1px solid #2a3441;
    border-radius: 4px;
    margin: 1px;
}

.module-header {
    background: #0f1419;
    padding: 12px 16px;
    border-bottom: 1px solid #2a3441;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
}

.module-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.module-status.active {
    background: #00ff88;
    animation: pulse 2s infinite;
}

.control-buttons {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cmd-btn {
    background: #2a3441;
    border: 1px solid #3a4551;
    border-radius: 4px;
    padding: 12px 16px;
    color: #ffffff;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.cmd-btn:hover {
    background: #3a4551;
    border-color: #00ff88;
    transform: translateX(4px);
}

.cmd-btn.primary { border-left: 4px solid #00ff88; }
.cmd-btn.secondary { border-left: 4px solid #0088ff; }
.cmd-btn.danger { border-left: 4px solid #ff4444; }
.cmd-btn.emergency { 
    border-left: 4px solid #ffaa00;
    animation: emergencyPulse 3s infinite;
}

@keyframes emergencyPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(255, 170, 0, 0.5); }
}

.btn-code {
    background: #0f1419;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    color: #00ff88;
}

.stats-grid {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #00ff88;
}

.stat-bar {
    width: 100%;
    height: 4px;
    background: #2a3441;
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #00ff88;
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

.bar-fill.orange { background: #ffaa00; }
.bar-fill.green { background: #00ff88; }
.bar-fill.blue { background: #0088ff; }

.refresh-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid #2a3441;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-module {
    flex: 1;
}

.ai-status {
    font-size: 10px;
    color: #00ff88;
    background: #0f1419;
    padding: 4px 8px;
    border-radius: 2px;
    animation: pulse 2s infinite;
}

.prediction-display {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prediction-item {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}

.pred-label {
    color: #888;
    text-transform: uppercase;
}

.pred-value {
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

.weather-controls {
    padding: 0 16px 16px;
    display: flex;
    gap: 8px;
}

.weather-btn {
    flex: 1;
    background: #2a3441;
    border: 1px solid #3a4551;
    border-radius: 2px;
    padding: 8px;
    color: #ffffff;
    font-family: 'Roboto Mono', monospace;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.weather-btn:hover {
    background: #3a4551;
    border-color: #00ff88;
}

.weather-btn.active {
    background: #00ff88;
    color: #0a0e1a;
}

.intersection-monitor {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.monitor-header {
    background: #0f1419;
    padding: 16px;
    border-bottom: 1px solid #2a3441;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.monitor-header h2 {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
}

.grid-coordinates {
    display: flex;
    gap: 20px;
    font-size: 11px;
    color: #888;
}

.intersection-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    grid-template-rows: 1fr 200px 1fr;
    gap: 2px;
    padding: 16px;
}

.lane {
    background: #2a3441;
    border: 1px solid #3a4551;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.north-lane { grid-column: 2; grid-row: 1; }
.east-lane { grid-column: 3; grid-row: 2; }
.south-lane { grid-column: 2; grid-row: 3; }
.west-lane { grid-column: 1; grid-row: 2; }

.intersection-core {
    grid-column: 2;
    grid-row: 2;
    background: #1a1f2e;
    border: 2px solid #00ff88;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.core-display {
    text-align: center;
    z-index: 2;
}

.processing-indicator {
    width: 60px;
    height: 60px;
    border: 3px solid #2a3441;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 2s linear infinite;
    margin-bottom: 16px;
}

.core-status {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #00ff88;
    margin-bottom: 8px;
}

.algorithm-step {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.emergency-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 68, 68, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: emergencyFlash 1s infinite;
}

.emergency-overlay.active {
    display: flex;
}

.emergency-text {
    color: #ffffff;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

@keyframes emergencyFlash {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.5; }
}

.lane-header {
    padding: 8px 12px;
    background: #0f1419;
    border-bottom: 1px solid #3a4551;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.traffic-light {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
    opacity: 0.2;
    transition: all 0.4s ease;
    position: relative;
}

.light.red { 
    background: #ff4444; 
    border-color: #aa2222;
}

.light.yellow { 
    background: #ffaa00; 
    border-color: #cc8800;
}

.light.green { 
    background: #00ff88; 
    border-color: #00cc66;
}

.light.active {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 0 60px currentColor;
    animation: lightGlow 2s ease-in-out infinite alternate;
}

.light.red.active {
    box-shadow: 0 0 20px #ff4444, 0 0 40px #ff4444, 0 0 60px #ff2222;
}

.light.yellow.active {
    box-shadow: 0 0 20px #ffaa00, 0 0 40px #ffaa00, 0 0 60px #ff8800;
}

.light.green.active {
    box-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88, 0 0 60px #00cc66;
}

@keyframes lightGlow {
    0% { 
        filter: brightness(1); 
        transform: scale(1.1);
    }
    100% { 
        filter: brightness(1.3); 
        transform: scale(1.15);
    }
}

.lane-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.lane-name {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #00ff88;
}

.queue-count {
    font-size: 10px;
    color: #888;
}

.vehicle-queue {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-content: flex-start;
}

.vehicle {
    width: 20px;
    height: 20px;
    background: #00ff88;
    border: 1px solid #ffffff;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 8px;
    font-weight: 700;
    color: #0a0e1a;
    transition: all 0.3s ease;
}

.vehicle.normal { background: #00ff88; }
.vehicle.priority { background: #0088ff; }
.vehicle.emergency { 
    background: #ff4444;
    animation: emergencyPulse 1s infinite;
}

.vehicle.moving {
    animation: moveOut 1s ease-in-out forwards;
    opacity: 0;
}

@keyframes moveOut {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.5) translateY(-20px); opacity: 0; }
}

.algorithm-display {
    height: 200px;
}

.algo-header {
    background: #0f1419;
    padding: 12px 16px;
    border-bottom: 1px solid #2a3441;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.algo-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
}

.execution-time {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    color: #888;
}

.algorithm-steps {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.algo-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.algo-step.active {
    opacity: 1;
    transform: scale(1.05);
}

.step-number {
    width: 24px;
    height: 24px;
    border: 2px solid #3a4551;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #888;
    transition: all 0.3s ease;
}

.algo-step.active .step-number {
    border-color: #00ff88;
    color: #00ff88;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.3);
}

.step-content {
    text-align: center;
    width: 100%;
}

.step-title {
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.step-progress {
    width: 100%;
    height: 3px;
    background: #2a3441;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #00ff88;
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}

.log-terminal {
    height: 300px;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #0f1419;
    padding: 12px 16px;
    border-bottom: 1px solid #2a3441;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-controls {
    display: flex;
    gap: 8px;
}

.log-filter {
    background: #2a3441;
    border: 1px solid #3a4551;
    border-radius: 2px;
    padding: 4px 8px;
    color: #888;
    font-family: 'Roboto Mono', monospace;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.log-filter.active {
    background: #00ff88;
    color: #0a0e1a;
    border-color: #00ff88;
}

.log-container {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #0f1419;
    border-bottom: 1px solid #2a3441;
}

.log-entry {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 10px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.log-entry:hover {
    opacity: 1;
}

.log-time {
    color: #888;
    width: 60px;
    flex-shrink: 0;
}

.log-type {
    width: 40px;
    flex-shrink: 0;
    font-weight: 700;
}

.log-type.system { color: #00ff88; }
.log-type.traffic { color: #0088ff; }
.log-type.emergency { color: #ff4444; }
.log-type.info { color: #ffaa00; }

.log-message {
    color: #ffffff;
}

.command-input {
    background: #2a3441;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-prompt {
    color: #00ff88;
    font-weight: 700;
}

#commandInput {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    outline: none;
}

#commandInput::placeholder {
    color: #666;
}

.emergency-panel {
    height: 250px;
}

.emergency-header {
    background: #0f1419;
    padding: 12px 16px;
    border-bottom: 1px solid #2a3441;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.emergency-status {
    font-size: 10px;
    color: #888;
    background: #2a3441;
    padding: 4px 8px;
    border-radius: 2px;
}

.emergency-status.active {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.2);
    animation: pulse 1s infinite;
}

.emergency-buttons {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.emergency-btn {
    background: #2a3441;
    border: 1px solid #3a4551;
    border-radius: 4px;
    padding: 12px;
    color: #ffffff;
    font-family: 'Roboto Mono', monospace;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.emergency-btn:hover {
    background: #3a4551;
    border-color: #ff4444;
    transform: scale(1.05);
}

.emergency-icon {
    font-size: 16px;
}

.active-emergencies {
    flex: 1;
    padding: 16px;
    background: #0f1419;
}

.no-emergencies {
    color: #666;
    font-size: 10px;
    text-align: center;
    text-transform: uppercase;
}

.performance-monitor {
    flex: 1;
}

.monitor-header .cpu-usage {
    font-size: 10px;
    color: #888;
}

.performance-chart {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.performance-stats {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.perf-item {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}

.perf-label {
    color: #888;
}

.perf-value {
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

.footer-status {
    background: #0f1419;
    border-top: 1px solid #2a3441;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.status-section {
    display: flex;
    gap: 8px;
    font-size: 10px;
    margin: 4px 0;
}

.status-label {
    color: #888;
    text-transform: uppercase;
}

.status-value {
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

.loading-animation {
    width: 80px;
    height: 80px;
    border: 4px solid #2a3441;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.loading-text {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: #2a3441;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #0088ff);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-details {
    font-size: 12px;
    color: #888;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}

.log-container::-webkit-scrollbar-track {
    background: #1a1f2e;
}

.log-container::-webkit-scrollbar-thumb {
    background: #3a4551;
    border-radius: 3px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #00ff88;
}

@media (min-width: 768px) {
    .main-grid {
        flex-direction: row;
    }
    
    .left-panel, .right-panel {
        width: 320px;
    }
    
    .intersection-grid {
        grid-template-columns: 1fr 200px 1fr;
        grid-template-rows: 1fr 200px 1fr;
    }
}

@media (min-width: 1200px) {
    .left-panel, .right-panel {
        width: 350px;
    }
    
    body {
        font-size: 12px;
    }
}

@media (max-width: 767px) {
    .intersection-grid {
        grid-template-columns: 80px 120px 80px;
        grid-template-rows: 80px 120px 80px;
    }
    
    .terminal-title {
        font-size: 12px;
    }
    
    .module-header h3 {
        font-size: 11px;
    }
    
    .monitor-header h2 {
        font-size: 14px;
    }
    
    .algorithm-steps {
        flex-direction: column;
        gap: 8px;
    }
    
    .algo-step {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 16px;
    }
    
    .step-content {
        text-align: left;
        flex: 1;
    }
    
    .footer-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .status-section {
        width: 100%;
        justify-content: space-between;
    }
}