:root {
    --bg-primary: #0a0a0a;
    --bg-glass: rgba(10, 10, 10, 0.92);
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent: #4ecdc4;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --rl-cr: #8b0000;
    --rl-en: #d32f2f;
    --rl-vu: #f57c00;
    --rl-nt: #fbc02d;
    --risk-high: #ff6b6b;
    --risk-medium: #fbc02d;
}

@font-face { font-family: 'Roboto Mono'; font-weight: 300; src: url('../fonts/RobotoMono-Light.ttf') format('truetype'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 400; src: url('../fonts/RobotoMono-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 500; src: url('../fonts/RobotoMono-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 700; src: url('../fonts/RobotoMono-Bold.ttf') format('truetype'); }

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Roboto Mono', monospace; font-weight: 400; background: var(--bg-primary); color: var(--text-primary); }

#map { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

.panel {
    position: fixed; top: 16px; left: 16px; z-index: 1000;
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle); border-radius: 12px;
    padding: 20px; width: 320px; max-height: calc(100vh - 330px);
    overflow-y: auto;
}
.panel h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; color: #fff; }
.panel .subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }

.stat-row { display: flex; gap: 12px; margin-bottom: 16px; }
.stat-box {
    flex: 1; background: rgba(255,255,255,0.04); border-radius: 8px;
    padding: 10px; text-align: center;
}
.stat-box .num { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-box .label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.filter-section { margin-bottom: 16px; }
.filter-section label { font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }

select, input[type="range"] {
    width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; padding: 8px 10px; color: var(--text-primary); font-size: 13px;
    outline: none; cursor: pointer;
}
select:hover, input[type="range"]:hover { border-color: rgba(78, 205, 196, 0.4); }
select option { background: #1a1a1a; color: var(--text-primary); }

.month-label { font-size: 12px; color: var(--accent); text-align: center; margin-top: 4px; }

.species-list { margin-top: 12px; }
.species-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px; cursor: pointer; transition: background 0.15s;
}
.species-item:hover { background: rgba(255,255,255,0.03); }
.species-name { font-style: italic; color: #ccc; display: flex; align-items: center; gap: 5px; }
.rl-badge {
    font-style: normal; font-size: 9px; font-weight: 700; color: #fff;
    padding: 1px 4px; border-radius: 3px; letter-spacing: 0.3px; flex-shrink: 0;
}
.alt-tag {
    font-style: normal; font-size: 9px; color: var(--text-secondary);
    margin-left: 4px; flex-shrink: 0;
}
.species-count {
    background: rgba(78, 205, 196, 0.15); color: var(--accent);
    padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}

.legend {
    position: fixed; bottom: 24px; left: 16px; z-index: 1000;
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 12px 16px;
}
.legend-title { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.legend-gradient {
    width: 100%; height: 12px; border-radius: 4px;
    background: linear-gradient(to right, #1a0533, #3b0f70, #8c2981, #de4968, #fe9f6d, #fecf92, #fcfdbf);
}
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); margin-top: 4px; }

.info-badge {
    position: fixed; bottom: 24px; right: 16px; z-index: 1000;
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 10px 14px; font-size: 11px; color: var(--text-secondary);
}
.info-badge a { color: var(--accent); text-decoration: none; }

.view-toggle {
    display: flex; gap: 4px; margin-bottom: 16px; background: rgba(255,255,255,0.04);
    border-radius: 8px; padding: 3px;
}
.view-btn {
    flex: 1; padding: 6px; text-align: center; font-size: 12px;
    border-radius: 6px; cursor: pointer; transition: all 0.2s;
    color: var(--text-secondary); border: none; background: none;
}
.view-btn.active { background: rgba(78, 205, 196, 0.2); color: var(--accent); }

.loading {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 2000; background: rgba(10,10,10,0.95); padding: 24px 32px;
    border-radius: 12px; font-size: 14px; color: var(--accent);
}

.info-btn {
    display: inline-flex; align-items: center; gap: 5px;
    height: 28px; border-radius: 6px; padding: 0 10px;
    background: rgba(78,205,196,0.1); border: 1px solid rgba(78,205,196,0.2);
    color: var(--accent); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.info-btn:hover { background: rgba(78,205,196,0.2); border-color: rgba(78,205,196,0.4); }

.hide-ui-btn {
    position: fixed; top: 16px; right: 16px; z-index: 1000;
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 6px 10px; color: var(--text-secondary); font-size: 11px;
    cursor: pointer; transition: all 0.2s;
    font-family: 'Roboto Mono', monospace;
}
.hide-ui-btn:hover { background: rgba(10, 10, 10, 1); color: #fff; border-color: rgba(255,255,255,0.2); }
.hide-ui-btn .shortcut { color: #555; margin-left: 4px; }

.ui-hidden .panel,
.ui-hidden .legend,
.ui-hidden .info-badge { display: none; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    z-index: 3000; display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: #111; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; width: 640px; max-width: 90vw;
    max-height: 85vh; overflow-y: auto; padding: 32px;
    color: #ddd; position: relative;
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; color: var(--text-secondary); font-size: 20px;
    cursor: pointer; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
}
.modal-close:hover { background: rgba(255,255,255,0.05); color: #fff; }

.kommune-modal { max-width: 520px; }
.turbine-inputs { display: flex; gap: 12px; margin: 12px 0 6px 0; }
.turbine-inputs .input-group { flex: 1; }
.turbine-inputs label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.turbine-inputs input {
    width: 100%; box-sizing: border-box; padding: 6px 8px;
    background: #1a1a1a; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
    color: #ddd; font-family: monospace; font-size: 14px;
}
.turbine-inputs input:focus { outline: none; border-color: var(--accent); }
.rotor-zone-display { font-size: 11px; color: #888; margin-bottom: 8px; }
.confidence-warning {
    padding: 8px 10px; border-radius: 6px; font-size: 12px; margin-bottom: 10px;
    background: rgba(251,192,45,0.12); color: #fbc02d; border: 1px solid rgba(251,192,45,0.25);
}
.confidence-warning.severe {
    background: rgba(211,47,47,0.12); color: #ff6b6b; border-color: rgba(211,47,47,0.25);
}
.risk-species-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.risk-species-item .species-info { flex: 1; }
.risk-species-item .species-info i { color: #ddd; }
.risk-species-item .obs-count { color: #888; font-size: 11px; white-space: nowrap; margin-left: 8px; }
.kommune-empty { color: #888; font-style: italic; padding: 12px 0; }

.modal h2 { font-size: 20px; color: #fff; margin-bottom: 6px; }
.modal h3 { font-size: 14px; color: var(--accent); margin: 20px 0 8px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.modal p { font-size: 13px; line-height: 1.6; color: #bbb; margin-bottom: 10px; }
.modal .concept-text { font-size: 14px; color: #ddd; line-height: 1.7; }

.legend-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px 0; }
.legend-table td { padding: 6px 10px; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.legend-table td:first-child { width: 60px; text-align: center; }

.source-card {
    background: rgba(255,255,255,0.03); border-radius: 8px;
    padding: 12px 14px; margin-bottom: 8px;
}
.source-card .src-name { font-size: 13px; color: #fff; font-weight: 600; }
.source-card .src-detail { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.source-card a { color: var(--accent); text-decoration: none; }
.source-card a:hover { text-decoration: underline; }

/* Leaflet overrides */
.kommune-tooltip {
    background: rgba(10,10,10,0.9) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: var(--text-primary) !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}
.kommune-tooltip::before { display: none !important; }
.turbine-marker { background: none !important; border: none !important; }
.leaflet-popup-content-wrapper {
    background: rgba(10,10,10,0.95) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}
.leaflet-popup-tip { background: rgba(10,10,10,0.95) !important; }
.leaflet-popup-close-button { color: var(--text-secondary) !important; }
