:root {
    --bg-dark: #0a0e17;
    --bg-panel: rgba(18, 25, 43, 0.7);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-neon: #00f2fe;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
}

#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
#sidebar {
    width: 380px;
    background: var(--bg-dark);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.sidebar-header {
    padding: 30px 25px;
    background: linear-gradient(135deg, rgba(16,25,48,1) 0%, rgba(10,14,23,1) 100%);
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--accent-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-badge {
    display: inline-block;
    margin-top: 15px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.section {
    padding: 25px;
    border-bottom: 1px solid var(--glass-border);
}

.section h2 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
}

/* Toggles */
.layer-control {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-right: 15px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #1e293b;
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

input:checked + .priority-slider {
    background-color: var(--accent-red);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.layer-name {
    font-size: 14px;
    font-weight: 500;
}

.alert-text {
    color: #fca5a5;
}

/* Stats */
.stats-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stats-section h2 {
    grid-column: 1 / -1;
    margin-bottom: 5px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.4);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:nth-child(2) {
    grid-column: 1 / -1;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.highlight-green { color: var(--accent-green); }
.highlight-red { color: var(--accent-red); text-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Feature list */
.feature-list {
    list-style: none;
}

.feature-list li {
    font-size: 12px;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 8px;
}

.feature-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-neon));
    border-radius: 2px;
    box-shadow: 0 0 5px var(--accent-neon);
}

/* Map Area */
#map-area {
    flex-grow: 1;
    position: relative;
    background: #000;
}

#map {
    width: 100%;
    height: 100%;
}

/* Leaflet Dark Theme Overrides */
.leaflet-container {
    background: #0f172a;
}

.leaflet-layer,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.floating-panel {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.map-legend h4 {
    margin-bottom: 15px;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 10px;
}

.bg-blue { background: #3b82f6; opacity: 0.7;}
.bg-neon { background: #00f2fe; box-shadow: 0 0 8px #00f2fe;}
.bg-red { background: #ef4444; box-shadow: 0 0 8px #ef4444; border: 1px solid #fca5a5;}

.gradient-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 10px;
}

.uncertainty-grad {
    background: linear-gradient(135deg, transparent, rgba(255, 255, 0, 0.8), rgba(255, 0, 0, 0.8));
}

/* Custom Tooltip */
.custom-tooltip {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid var(--accent-neon) !important;
    color: white !important;
    border-radius: 6px !important;
    font-family: 'Inter', sans-serif !important;
    box-shadow: 0 4px 15px rgba(0,242,254,0.2) !important;
}

.leaflet-tooltip-left.custom-tooltip::before {
    border-left-color: var(--accent-neon) !important;
}
.leaflet-tooltip-right.custom-tooltip::before {
    border-right-color: var(--accent-neon) !important;
}

/* Priority Poly */
.priority-zone {
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% { fill-opacity: 0.3; stroke-opacity: 0.6; }
    100% { fill-opacity: 0.6; stroke-opacity: 1; }
}
