:root {
    --bg-main: #0c0e12;
    --panel-bg: rgba(20, 24, 33, 0.85);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-header-bg: rgba(28, 34, 46, 0.95);
    
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --accent-cad: #00f0ff;
    --accent-waze: #ff3366;
    --accent-incident: #ff9900;
    --accent-closure: #ff3333;
    --accent-dms: #ffcc00;
    --accent-rwis: #10b981;
    --accent-cctv: #a855f7;
    --accent-tss: #3b82f6;
    
    --alert-bg: #7f1d1d;
    --alert-border: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    letter-spacing: -0.01em;
}

/* Severe Weather Alert Banner */
.severe-alert {
    background-color: var(--alert-bg);
    border-bottom: 1px solid var(--alert-border);
    color: #fff;
    text-align: center;
    padding: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.hidden { 
    display: none !important; 
}

/* Application Layout Structure */
.dashboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ops-header {
    background: var(--panel-header-bg);
    border-bottom: 1px solid var(--panel-border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.header-title h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title h1 span {
    color: var(--text-dark);
    font-weight: 400;
    font-size: 0.9rem;
}

.status-indicator.live {
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-weight: 600;
    text-transform: uppercase;
}

.ops-clock {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-cad);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Dashboard Functional Grid */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 360px 1fr 380px;
    gap: 16px;
    padding: 16px;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel-header {
    background: var(--panel-header-bg);
    padding: 14px 18px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Badge Systems */
.badge-group {
    display: flex;
    gap: 6px;
}

.badge {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
}

.badge.waze { color: var(--accent-waze); border-color: rgba(255, 51, 102, 0.2); }
.badge.mdot { color: var(--accent-incident); border-color: rgba(255, 153, 0, 0.2); }
.badge.cad { color: var(--accent-cad); border-color: rgba(0, 240, 255, 0.2); }
.badge.dms { color: var(--accent-dms); border-color: rgba(255, 204, 0, 0.2); }
.badge.cctv { color: var(--accent-cctv); border-color: rgba(168, 85, 247, 0.2); }

/* High-Density Feed Content Layout */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-content::-webkit-scrollbar {
    width: 6px;
}
.panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Real-time Row Components */
.list-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 4px solid var(--text-dark);
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

/* Explicit Status Side-Border Mapping */
.list-item.cad { border-left-color: var(--accent-cad); }
.list-item.waze { border-left-color: var(--accent-waze); }
.list-item.incident { border-left-color: var(--accent-incident); }
.list-item.closure { border-left-color: var(--accent-closure); }
.list-item.dms { border-left-color: var(--accent-dms); }
.list-item.rwis { border-left-color: var(--accent-rwis); }
.list-item.cctv { border-left-color: var(--accent-cctv); }
.list-item.tss { border-left-color: var(--accent-tss); }

.item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.item-details {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.placeholder {
    text-align: center;
    color: var(--text-dark);
    font-size: 0.8rem;
    margin-top: 24px;
    font-style: italic;
}

/* Center Map Infrastructure Panel */
.map-panel {
    display: flex;
    flex-direction: column;
}

#traffic-map {
    flex: 1;
    width: 100%;
    background-color: var(--bg-main);
}

/* Navigation & Utility Bar for Camera System */
.view-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-control:hover, .btn-control.active {
    background: var(--accent-cad);
    color: var(--bg-main);
    border-color: var(--accent-cad);
}

/* Map Popup Enhancements */
.leaflet-popup-content-wrapper {
    background: var(--panel-header-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--panel-border) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
    background: var(--panel-header-bg) !important;
    border: 1px solid var(--panel-border) !important;
}

.dms-board-display {
    background: #000;
    color: #ffcc00;
    font-family: ui-monospace, monospace;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #332200;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.2;
    margin-top: 4px;
}

/* Dynamic Interactive Camera Wall Canvas */
.camera-grid-canvas {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--grid-size, 400px), 1fr));
    gap: 16px;
}

.camera-card {
    background: #000;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.camera-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--accent-cad);
}

.camera-header {
    background: var(--panel-header-bg);
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--panel-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: move; /* Drag Handle Feedback */
    user-select: none;
}

.camera-feed-container {
    width: 100%;
    position: relative;
    aspect-ratio: 16/9;
    background: #030303;
}

.camera-feed-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}