/**
 * Forecast Workspace - Ultra Modern Design
 * Inspired by Windy.com, Linear, Apple Weather
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Deep ocean dark palette */
    --fc-bg-base: #080c14;
    --fc-bg-surface: #0f1520;
    --fc-bg-elevated: #161d2a;
    --fc-bg-interactive: #1c2536;
    --fc-bg-hover: #232d42;

    /* Borders & Dividers */
    --fc-border: rgba(255, 255, 255, 0.06);
    --fc-border-subtle: rgba(255, 255, 255, 0.03);
    --fc-border-emphasis: rgba(255, 255, 255, 0.12);

    /* Text hierarchy */
    --fc-text-primary: #f0f4f8;
    --fc-text-secondary: #94a3b8;
    --fc-text-tertiary: #64748b;
    --fc-text-muted: #475569;

    /* Accent colors */
    --fc-accent: #3b82f6;
    --fc-accent-bright: #60a5fa;
    --fc-accent-glow: rgba(59, 130, 246, 0.25);
    --fc-accent-subtle: rgba(59, 130, 246, 0.1);

    /* Semantic colors */
    --fc-success: #22c55e;
    --fc-warning: #f59e0b;
    --fc-danger: #ef4444;

    /* Layout */
    --fc-sidebar-width: 220px;
    --fc-radius-sm: 6px;
    --fc-radius-md: 10px;
    --fc-radius-lg: 14px;
    --fc-radius-xl: 20px;

    /* Shadows */
    --fc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --fc-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --fc-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --fc-shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
}

/* ===== FORECAST CONTROLS OVERLAY (on main map) ===== */
.forecast-controls-overlay {
    --fc-sidebar-width: 280px;
    --fc-sidebar-collapsed: 48px;

    position: fixed;
    top: 60px; /* Below header */
    right: 0;
    bottom: 0;
    left: var(--fc-sidebar-width);
    pointer-events: none;
    z-index: 900; /* Above map, below sidebar (2000) */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    transition: left 0.3s ease;
}

/* When sidebar is collapsed - use class toggled by JS */
.forecast-controls-overlay.sidebar-collapsed {
    left: var(--fc-sidebar-collapsed);
}

/* Mobile - no sidebar */
@media (max-width: 768px) {
    .forecast-controls-overlay {
        left: 0;
    }
}

.forecast-controls-overlay > * {
    pointer-events: auto;
}

/* Position options panel on top-right, away from sidebar */
.forecast-controls-overlay .forecast-options-panel {
    position: absolute;
    top: 16px;
    right: 16px;
}

/* Position timeline bar at bottom center */
.forecast-controls-overlay .forecast-timeline-bar {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
}

/* Position scrubber below timeline */
.forecast-controls-overlay .forecast-scrubber {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}

/* Position legend at bottom-left */
.forecast-controls-overlay .forecast-legend {
    position: absolute;
    bottom: 120px;
    left: 16px;
}

/* Loading spinner centered */
.forecast-controls-overlay .forecast-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===== BASE CONTAINER (legacy) ===== */
.forecast-workspace {
    display: flex;
    height: 100%;
    background: var(--fc-bg-base);
    color: var(--fc-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== MINI ICON SIDEBAR (Weather Optics Style) ===== */
.forecast-mini-sidebar {
    width: 56px;
    background: var(--fc-bg-surface);
    border-right: 1px solid var(--fc-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    flex-shrink: 0;
    z-index: 100;
}

.mini-sidebar-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--fc-radius-md);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    position: relative;
}

.mini-sidebar-btn:hover {
    background: var(--fc-bg-interactive);
    color: var(--fc-text-primary);
}

.mini-sidebar-btn.active {
    background: var(--fc-accent-subtle);
    color: var(--fc-accent-bright);
}

.mini-sidebar-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--fc-accent);
    border-radius: 0 2px 2px 0;
}

.mini-sidebar-divider {
    width: 28px;
    height: 1px;
    background: var(--fc-border-emphasis);
    margin: 8px 0;
}

/* ===== FLOATING OPTIONS PANEL (Right) ===== */
.forecast-options-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 260px;
    background: rgba(15, 21, 32, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    z-index: 500;
    box-shadow: var(--fc-shadow-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state styles moved to bottom of file */

.options-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--fc-border);
}

.options-panel-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--fc-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.options-toggle-btn {
    background: transparent;
    border: none;
    color: var(--fc-text-tertiary);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--fc-radius-sm);
    transition: all 0.2s ease;
}

.options-toggle-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-secondary);
}

.options-close-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fc-radius-sm);
    transition: all 0.2s ease;
}

.options-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--fc-danger);
}

.options-panel-body {
    padding: 12px 14px;
}

.options-section {
    margin-bottom: 12px;
}

.options-section:last-child {
    margin-bottom: 0;
}

.options-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--fc-text-tertiary);
    margin-bottom: 6px;
}

.options-select {
    width: 100%;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-primary);
    padding: 8px 28px 8px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 4L5 6.5L7.5 4' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s ease;
}

.options-select:hover {
    background-color: var(--fc-bg-hover);
    border-color: var(--fc-border-emphasis);
}

.options-select:focus {
    outline: none;
    border-color: var(--fc-accent);
    box-shadow: 0 0 0 2px var(--fc-accent-glow);
}

.options-select option {
    background: var(--fc-bg-elevated);
    color: var(--fc-text-primary);
}

.options-divider {
    height: 1px;
    background: var(--fc-border);
    margin: 12px 0;
}

.options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.options-value {
    font-size: 11px;
    font-weight: 500;
    color: var(--fc-text-secondary);
    font-variant-numeric: tabular-nums;
}

.options-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--fc-bg-hover);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.options-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--fc-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.options-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ===== MAIN AREA ===== */
.forecast-main {
    flex: 1;
    display: flex;
    position: relative;
    min-width: 0;
    background: var(--fc-bg-base);
}

#forecastMapContainer {
    flex: 1;
    position: relative;
    min-height: 0;
}

#forecastMap {
    position: absolute;
    inset: 0;
    background: #050810;
}

/* Override Leaflet controls - move to bottom left */
#forecastMap .leaflet-control-container .leaflet-top.leaflet-left {
    top: auto;
    bottom: 100px;
    left: 16px;
}

#forecastMap .leaflet-control-zoom {
    border: none;
    border-radius: var(--fc-radius-md);
    overflow: hidden;
    box-shadow: var(--fc-shadow-lg);
    margin: 0;
}

#forecastMap .leaflet-control-zoom a {
    background: rgba(15, 21, 32, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--fc-text-secondary);
    width: 32px;
    height: 32px;
    line-height: 32px;
    border: none;
    border-bottom: 1px solid var(--fc-border);
}

#forecastMap .leaflet-control-zoom a:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

#forecastMap .leaflet-control-zoom a:last-child {
    border-bottom: none;
}

/* ===== FLOATING TIMELINE ===== */
.forecast-timeline {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 21, 32, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: 100px;
    padding: 6px 6px 6px 6px;
    box-shadow: var(--fc-shadow-lg), var(--fc-shadow-glow);
    z-index: 500;
}

.timeline-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 13px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.timeline-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.timeline-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--fc-accent) 0%, #2563eb 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.timeline-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5);
}

.timeline-play-btn:active {
    transform: scale(0.98);
}

.timeline-play-btn.playing {
    background: linear-gradient(135deg, var(--fc-warning) 0%, #d97706 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

/* Timeline Slider */
.timeline-slider {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--fc-bg-hover);
    border-radius: 3px;
    outline: none;
    margin: 0 12px;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: var(--fc-bg-hover);
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    cursor: grab;
    margin-top: -6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.timeline-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.timeline-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--fc-text-primary);
    min-width: 110px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 0 16px 0 8px;
    white-space: nowrap;
}

/* ===== BOTTOM TIMELINE BAR (Weather Optics Style) ===== */
.forecast-timeline-bar {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(15, 21, 32, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    padding: 10px 16px;
    box-shadow: var(--fc-shadow-lg);
    z-index: 500;
    min-width: 500px;
}

.timeline-left {
    display: flex;
    align-items: center;
    min-width: 140px;
}

.timeline-datetime {
    font-size: 13px;
    font-weight: 600;
    color: var(--fc-text-primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.timeline-center {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tl-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--fc-radius-sm);
    border: none;
    background: transparent;
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.tl-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.tl-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--fc-accent) 0%, #2563eb 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    margin: 0 4px;
}

.tl-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.tl-play-btn.playing {
    background: linear-gradient(135deg, var(--fc-warning) 0%, #d97706 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.timeline-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 100px;
    justify-content: flex-end;
}

.timeline-frame {
    font-size: 12px;
    font-weight: 500;
    color: var(--fc-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.timeline-forecast {
    font-size: 13px;
    font-weight: 700;
    color: var(--fc-accent-bright);
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    background: var(--fc-accent-subtle);
    border-radius: var(--fc-radius-sm);
}

/* Timeline bar sliders */
.tl-slider-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    border-right: 1px solid var(--fc-border);
}

.tl-slider-group i {
    font-size: 12px;
    color: var(--fc-text-tertiary);
    width: 14px;
}

.tl-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--fc-bg-hover);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.tl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: var(--fc-text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tl-slider::-webkit-slider-thumb:hover {
    background: var(--fc-text-primary);
}

/* ===== SCRUBBER SLIDER ===== */
.forecast-scrubber {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    z-index: 500;
}

.scrubber-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(30, 40, 60, 0.8);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.scrubber-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(30, 40, 60, 0.8);
}

.scrubber-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    cursor: grab;
    margin-top: -5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.scrubber-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.scrubber-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

/* ===== FLOATING LEGEND ===== */
.forecast-legend {
    position: absolute;
    bottom: 110px;
    left: 16px;
    background: rgba(15, 21, 32, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    padding: 14px 16px;
    z-index: 500;
    box-shadow: var(--fc-shadow-lg);
    min-width: 80px;
}

.forecast-colorbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.colorbar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--fc-text-primary);
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.colorbar-wrapper {
    display: flex;
    gap: 10px;
}

.colorbar-gradient {
    width: 18px;
    height: 160px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.colorbar-ticks {
    position: relative;
    height: 160px;
    min-width: 36px;
}

.colorbar-tick {
    position: absolute;
    right: 0;
    font-size: 10px;
    font-weight: 500;
    color: var(--fc-text-secondary);
    font-variant-numeric: tabular-nums;
    transform: translateY(50%);
    line-height: 1;
}

.colorbar-unit {
    font-size: 10px;
    color: var(--fc-text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RIGHT SIDE PANEL (legacy - see floating panel at bottom) ===== */
/* Main .forecast-side-panel styles moved to bottom of file */

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

.side-panel-header span {
    font-weight: 600;
    font-size: 14px;
    color: var(--fc-text-primary);
}

.side-panel-header button {
    width: 32px;
    height: 32px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.side-panel-header button:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    border-color: var(--fc-border-emphasis);
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ===== POINT POPUP ===== */
.forecast-point-popup-container .leaflet-popup-content-wrapper {
    background: rgba(15, 21, 32, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    color: var(--fc-text-primary);
    padding: 0;
    box-shadow: var(--fc-shadow-lg), var(--fc-shadow-glow);
}

.forecast-point-popup-container .leaflet-popup-content {
    margin: 0;
    min-width: 160px;
}

.forecast-point-popup-container .leaflet-popup-tip {
    background: rgba(15, 21, 32, 0.95);
    border: none;
    box-shadow: none;
}

.forecast-point-popup {
    padding: 18px 20px;
}

.forecast-point-popup .popup-header {
    font-size: 10px;
    font-weight: 700;
    color: var(--fc-accent-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.forecast-point-popup .popup-coords {
    font-size: 11px;
    color: var(--fc-text-tertiary);
    font-family: 'SF Mono', ui-monospace, monospace;
    margin-bottom: 14px;
}

.forecast-point-popup .popup-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
}

.forecast-point-popup .popup-value .value {
    font-size: 48px;
    font-weight: 700;
    color: var(--fc-text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
}

.forecast-point-popup .popup-value .unit {
    font-size: 20px;
    font-weight: 500;
    color: var(--fc-text-secondary);
}

.forecast-point-popup .popup-value.no-data .value {
    font-size: 14px;
    color: var(--fc-text-tertiary);
    letter-spacing: 0;
}

.forecast-point-popup .popup-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--fc-text-tertiary);
    padding-top: 14px;
    border-top: 1px solid var(--fc-border);
}

.forecast-point-popup .popup-loading {
    text-align: center;
    padding: 28px 20px;
    color: var(--fc-text-secondary);
}

.forecast-point-popup .popup-message {
    font-size: 13px;
    color: var(--fc-text-secondary);
    line-height: 1.5;
}

.forecast-point-popup .popup-message.error {
    color: var(--fc-danger);
}

/* ===== MODAL ===== */
.forecast-modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.forecast-modal.hidden {
    display: none;
}

.forecast-modal .modal-content {
    background: var(--fc-bg-surface);
    border-radius: var(--fc-radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--fc-border-emphasis);
    box-shadow: var(--fc-shadow-lg), 0 0 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.forecast-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--fc-border);
}

.forecast-modal .modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.forecast-modal .modal-close {
    width: 32px;
    height: 32px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.forecast-modal .modal-close:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.forecast-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.forecast-modal .modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--fc-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Buttons */
.forecast-btn {
    background: linear-gradient(135deg, var(--fc-accent) 0%, #2563eb 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--fc-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.forecast-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.forecast-btn:active {
    transform: translateY(0);
}

.forecast-btn.secondary {
    background: var(--fc-bg-interactive);
    color: var(--fc-text-primary);
    border: 1px solid var(--fc-border);
    box-shadow: none;
}

.forecast-btn.secondary:hover {
    background: var(--fc-bg-hover);
    border-color: var(--fc-border-emphasis);
    transform: none;
}

/* ===== CURSORS ===== */
#forecastMap.cursor-crosshair {
    cursor: crosshair;
}

#forecastMap.cursor-grab {
    cursor: grab;
}

#forecastMap.cursor-grabbing {
    cursor: grabbing;
}

/* ===== CUSTOM SCROLLBAR ===== */
.forecast-sidebar::-webkit-scrollbar,
.side-panel-content::-webkit-scrollbar,
.forecast-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

.forecast-sidebar::-webkit-scrollbar-track,
.side-panel-content::-webkit-scrollbar-track,
.forecast-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.forecast-sidebar::-webkit-scrollbar-thumb,
.side-panel-content::-webkit-scrollbar-thumb,
.forecast-modal .modal-body::-webkit-scrollbar-thumb {
    background: var(--fc-bg-hover);
    border-radius: 3px;
}

.forecast-sidebar::-webkit-scrollbar-thumb:hover,
.side-panel-content::-webkit-scrollbar-thumb:hover,
.forecast-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--fc-text-muted);
}

/* ===== LOADING STATE ===== */
@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.forecast-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===== SIDEBAR SLIDERS ===== */
.sidebar-slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-slider-group:last-child {
    margin-bottom: 0;
}

.sidebar-slider-group label {
    font-size: 12px;
    color: var(--fc-text-secondary);
    min-width: 50px;
}

.sidebar-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--fc-bg-hover);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.sidebar-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--fc-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.sidebar-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    font-size: 11px;
    color: var(--fc-text-tertiary);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== FULLSCREEN BUTTON ===== */
.forecast-fullscreen-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(15, 21, 32, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-md);
    color: var(--fc-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 500;
    transition: all 0.2s ease;
}

.forecast-fullscreen-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    transform: scale(1.05);
}

/* ===== FRAME COUNTER ===== */
.frame-counter {
    font-size: 12px;
    font-weight: 600;
    color: var(--fc-text-tertiary);
    min-width: 45px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 0 8px;
    border-right: 1px solid var(--fc-border);
    margin-right: 4px;
}

/* ===== FULLSCREEN STATE ===== */
.forecast-workspace.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: var(--fc-bg-base);
}

.forecast-workspace.fullscreen .forecast-mini-sidebar {
    display: none;
}

.forecast-workspace.fullscreen .forecast-sidebar {
    display: none;
}

.forecast-workspace.fullscreen .forecast-options-panel {
    display: none;
}

.forecast-workspace.fullscreen .forecast-timeline {
    left: 50%;
    transform: translateX(-50%);
}

.forecast-workspace.fullscreen .forecast-timeline-bar {
    left: 50%;
    transform: translateX(-50%);
}

.forecast-workspace.fullscreen .forecast-side-panel {
    display: none;
}

/* Floating exit fullscreen button */
.forecast-workspace.fullscreen .forecast-exit-fullscreen {
    display: flex;
}

.forecast-exit-fullscreen {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    background: rgba(15, 21, 32, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--fc-accent);
    border-radius: var(--fc-radius-md);
    color: var(--fc-accent-bright);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 100000;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.forecast-exit-fullscreen:hover {
    background: var(--fc-accent);
    color: white;
    transform: scale(1.05);
}

/* Alert area popup */
.forecast-alert-area-popup {
    padding: 16px;
    text-align: center;
}

.forecast-alert-area-popup .popup-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fc-accent-bright);
    margin-bottom: 6px;
}

.forecast-alert-area-popup .popup-coords {
    font-size: 11px;
    color: var(--fc-text-tertiary);
    font-family: monospace;
    margin-bottom: 14px;
}

.forecast-alert-area-popup .popup-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.forecast-alert-area-popup .popup-btn {
    padding: 8px 14px;
    border-radius: var(--fc-radius-sm);
    border: 1px solid var(--fc-border);
    background: var(--fc-bg-interactive);
    color: var(--fc-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.forecast-alert-area-popup .popup-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.forecast-alert-area-popup .popup-btn.primary {
    background: var(--fc-accent);
    border-color: var(--fc-accent);
    color: white;
}

.forecast-alert-area-popup .popup-btn.primary:hover {
    background: var(--fc-accent-bright);
}

/* ===== LOADING SPINNER ===== */
.forecast-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.forecast-loading-spinner.visible {
    opacity: 1;
    visibility: visible;
}

.forecast-loading-spinner .spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--fc-bg-hover);
    border-top-color: var(--fc-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .timeline-slider {
        width: 160px;
    }

    .forecast-side-panel {
        width: 380px;
    }

    .forecast-options-panel {
        width: 240px;
    }

    .forecast-timeline-bar {
        min-width: 450px;
    }

    .forecast-scrubber {
        width: 450px;
    }

    .tl-slider {
        width: 50px;
    }
}

@media (max-width: 900px) {
    .forecast-mini-sidebar {
        width: 48px;
    }

    .mini-sidebar-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .forecast-options-panel {
        width: 200px;
        top: 12px;
        right: 12px;
    }

    .forecast-legend {
        bottom: 100px;
        left: 12px;
    }

    .forecast-timeline {
        left: 16px;
        right: 16px;
        transform: none;
        padding: 6px 12px;
    }

    .forecast-timeline-bar {
        min-width: 380px;
        padding: 8px 12px;
    }

    .forecast-scrubber {
        width: 380px;
    }

    .timeline-slider {
        flex: 1;
        min-width: 0;
    }

    .timeline-datetime {
        font-size: 12px;
        min-width: 120px;
    }

    .tl-btn {
        width: 28px;
        height: 28px;
    }

    .tl-play-btn {
        width: 36px;
        height: 36px;
    }

    .tl-slider-group {
        display: none;
    }
}

@media (max-width: 600px) {
    .forecast-mini-sidebar {
        display: none;
    }

    .forecast-options-panel {
        width: 100%;
        top: auto;
        bottom: 100px;
        right: 0;
        left: 0;
        border-radius: 0;
    }

    .forecast-legend {
        right: auto;
        left: 16px;
        top: 16px;
    }

    .forecast-side-panel {
        position: absolute;
        inset: 0;
        width: 100%;
        z-index: 700;
    }

    .forecast-timeline-bar {
        min-width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
        bottom: 50px;
    }

    .forecast-scrubber {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
    }

    .timeline-datetime {
        display: none;
    }

    .timeline-left {
        display: none;
    }

    .timeline-label {
        display: none;
    }

    .forecast-timeline {
        bottom: 16px;
    }
}

/* ===== TIMELINE MINIMIZE/COLLAPSE ===== */
.tl-minimize-btn {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 16px;
    background: rgba(15, 21, 32, 0.95);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: 6px 6px 0 0;
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 10;
    transition: all 0.2s ease;
}

.tl-minimize-btn:hover {
    color: var(--fc-text-primary);
    background: var(--fc-bg-hover);
}

/* Minimized state */
.forecast-timeline-bar.minimized {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(100%);
    transition: all 0.3s ease;
}

.forecast-scrubber.minimized {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(100%);
    transition: all 0.3s ease;
}

/* Minimized indicator bar */
.forecast-minimized-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.forecast-minimized-indicator.visible {
    opacity: 1;
    visibility: visible;
}

.tl-expand-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(15, 21, 32, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    color: var(--fc-text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--fc-shadow-md);
}

.tl-expand-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    transform: translateY(-2px);
    box-shadow: var(--fc-shadow-lg);
}

.tl-expand-btn i {
    font-size: 10px;
}

.tl-expand-btn span {
    font-variant-numeric: tabular-nums;
    color: var(--fc-accent-bright);
}

/* ===== CONTROLS COLLAPSE/EXPAND ===== */
.forecast-collapse-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(15, 21, 32, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-md);
    color: var(--fc-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 600;
    transition: all 0.2s ease;
    box-shadow: var(--fc-shadow-md);
}

.forecast-collapse-toggle:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    transform: scale(1.05);
}

.forecast-collapse-toggle.active {
    background: var(--fc-accent);
    color: white;
    border-color: var(--fc-accent-bright);
}

/* Options panel collapsed state */
.forecast-options-panel.collapsed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(20px);
}

/* Options panel slider row */
.options-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.options-slider-row .options-slider {
    flex: 1;
}

.options-slider-row .options-value {
    min-width: 50px;
    text-align: right;
    font-size: 11px;
    color: var(--fc-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===== TOOL BUTTONS IN OPTIONS PANEL ===== */
.forecast-tool-buttons {
    display: flex;
    gap: 6px;
}

.fc-tool-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-md);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.fc-tool-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-secondary);
    border-color: var(--fc-border-emphasis);
}

.fc-tool-btn.active {
    background: var(--fc-accent);
    border-color: var(--fc-accent-bright);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.fc-tool-btn i.fa-rotate-90 {
    transform: rotate(90deg);
}

/* ===== FORECAST POPUPS ===== */
.forecast-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 21, 32, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.forecast-popup .leaflet-popup-content {
    margin: 0;
    color: #e2e8f0;
}

.forecast-popup .leaflet-popup-tip {
    background: rgba(15, 21, 32, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.forecast-popup .leaflet-popup-close-button {
    color: #94a3b8;
}

.forecast-popup .leaflet-popup-close-button:hover {
    color: #fff;
}

.forecast-inspect-popup {
    padding: 12px 16px;
    min-width: 180px;
}

.forecast-inspect-popup .inspect-header {
    font-size: 14px;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.forecast-inspect-popup .inspect-coords {
    font-size: 12px;
    color: #94a3b8;
    font-family: monospace;
    margin-bottom: 6px;
}

.forecast-inspect-popup .inspect-time,
.forecast-inspect-popup .inspect-forecast {
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 4px;
}

.forecast-inspect-popup .inspect-note {
    font-size: 10px;
    color: #64748b;
    font-style: italic;
    margin-top: 8px;
}

.forecast-inspect-popup .inspect-chart-placeholder {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.forecast-inspect-popup .inspect-chart-placeholder i {
    font-size: 32px;
    color: #3b82f6;
    margin-bottom: 10px;
}

.forecast-inspect-popup .inspect-chart-placeholder p {
    margin: 4px 0;
    font-size: 12px;
}

/* ===== WIDE POPUP (for Meteogram/Sounding) ===== */
.forecast-wide-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 21, 32, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 0;
}

.forecast-wide-popup .leaflet-popup-content {
    margin: 0;
    color: #e2e8f0;
    width: 100% !important;
}

.forecast-wide-popup .leaflet-popup-tip {
    background: rgba(15, 21, 32, 0.98);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Meteogram popup */
.forecast-meteogram-popup,
.forecast-sounding-popup {
    min-width: 380px;
    max-width: 480px;
}

.meteogram-popup-header,
.sounding-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.meteogram-popup-header span:first-child,
.sounding-popup-header span:first-child {
    font-size: 14px;
    font-weight: 600;
    color: #60a5fa;
}

.meteogram-coords,
.sounding-coords {
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
}

.meteogram-popup-content,
.sounding-popup-content {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

.meteogram-popup-content .meteogram-loading,
.sounding-popup-content .sounding-loading,
.meteogram-error,
.sounding-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #94a3b8;
    gap: 10px;
}

.meteogram-error,
.sounding-error {
    color: #f87171;
}

.meteogram-popup-content i,
.sounding-popup-content i {
    font-size: 24px;
}

/* ===== FLOATING SIDE PANEL (for Meteogram/Sounding) ===== */
.forecast-side-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 450px;
    height: calc(100vh - 60px);
    background: rgba(15, 21, 32, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid var(--fc-border-emphasis);
    z-index: 950;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

.forecast-side-panel.visible {
    transform: translateX(0);
}

.forecast-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--fc-border);
    flex-shrink: 0;
}

.forecast-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fc-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forecast-panel-close {
    width: 32px;
    height: 32px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.forecast-panel-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--fc-danger);
    border-color: rgba(239, 68, 68, 0.4);
}

.forecast-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.forecast-panel-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--fc-danger);
    text-align: center;
    gap: 12px;
}

.forecast-panel-error i {
    font-size: 32px;
}

.forecast-panel-error p {
    font-size: 13px;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .forecast-side-panel {
        width: 380px;
    }
}

@media (max-width: 600px) {
    .forecast-side-panel {
        width: 100%;
        top: 0;
        height: 100vh;
    }
}

/* ===== LAYER PICKER MODAL ===== */
.forecast-layer-picker-modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.layer-picker-content {
    background: var(--fc-bg-surface);
    border-radius: var(--fc-radius-xl);
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--fc-border-emphasis);
    box-shadow: var(--fc-shadow-lg), 0 0 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.layer-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--fc-border);
}

.layer-picker-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--fc-text-primary);
}

.layer-picker-close {
    width: 32px;
    height: 32px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.layer-picker-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--fc-danger);
    border-color: rgba(239, 68, 68, 0.4);
}

.layer-picker-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.layer-picker-category {
    margin-bottom: 16px;
}

.layer-picker-category:last-child {
    margin-bottom: 0;
}

.category-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--fc-text-tertiary);
    padding: 8px 12px 6px;
}

.category-layers {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.layer-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-picker-item:hover {
    background: var(--fc-bg-hover);
    border-color: var(--fc-border-emphasis);
}

.layer-picker-item.active {
    background: var(--fc-accent-subtle);
    border-color: var(--fc-accent);
}

.layer-picker-item i {
    width: 20px;
    font-size: 14px;
    color: var(--fc-text-tertiary);
    text-align: center;
}

.layer-picker-item.active i {
    color: var(--fc-accent-bright);
}

.layer-picker-item span {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--fc-text-secondary);
}

.layer-picker-item.active span {
    color: var(--fc-text-primary);
}

/* Toggle switch */
.layer-toggle {
    width: 36px;
    height: 20px;
    position: relative;
}

.toggle-track {
    width: 100%;
    height: 100%;
    background: var(--fc-bg-hover);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.layer-toggle.on .toggle-track {
    background: var(--fc-accent);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.layer-toggle.on .toggle-thumb {
    transform: translateX(16px);
}

/* Expand icon for layers with sub-options */
.layer-picker-item .expand-icon {
    font-size: 10px;
    color: var(--fc-text-tertiary);
    transition: transform 0.2s ease;
    margin-left: auto;
    margin-right: 8px;
}

.layer-picker-item .expand-icon.rotated {
    transform: rotate(180deg);
}

.layer-picker-item.has-suboptions {
    padding-right: 10px;
}

/* Sub-options container */
.layer-suboptions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 0;
    margin-left: 20px;
    margin-bottom: 0;
}

.layer-suboptions.expanded {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 8px;
}

/* Sub-option item */
.suboption-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin: 4px 0;
    background: var(--fc-bg-base);
    border: 1px solid var(--fc-border-subtle);
    border-radius: var(--fc-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.suboption-item:hover {
    background: var(--fc-bg-interactive);
    border-color: var(--fc-border);
}

.suboption-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.suboption-item span {
    font-size: 12px;
    font-weight: 500;
    color: var(--fc-text-secondary);
}

.suboption-item.active span {
    color: var(--fc-accent-bright);
}

/* Checkbox style */
.suboption-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--fc-border-emphasis);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.suboption-check i {
    font-size: 10px;
    color: transparent;
    transition: color 0.15s ease;
}

.suboption-check.checked {
    background: var(--fc-accent);
    border-color: var(--fc-accent);
}

.suboption-check.checked i {
    color: white;
}

/* Layer picker scrollbar */
.layer-picker-body::-webkit-scrollbar {
    width: 6px;
}

.layer-picker-body::-webkit-scrollbar-track {
    background: transparent;
}

.layer-picker-body::-webkit-scrollbar-thumb {
    background: var(--fc-bg-hover);
    border-radius: 3px;
}

.layer-picker-body::-webkit-scrollbar-thumb:hover {
    background: var(--fc-text-muted);
}

/* ===== REOPEN BUTTONS (for collapsed panels) ===== */
.forecast-reopen-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(15, 21, 32, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-md);
    color: var(--fc-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 500;
    transition: all 0.2s ease;
    box-shadow: var(--fc-shadow-md);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.forecast-reopen-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.forecast-reopen-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    transform: scale(1.05);
    border-color: var(--fc-accent);
}

/* Position reopen options button (top right) */
.forecast-reopen-options {
    top: 16px;
    right: 16px;
}

/* Position reopen legend button (bottom left) */
.forecast-reopen-legend {
    bottom: 110px;
    left: 16px;
}

/* ===== LEGEND MINIMIZE ===== */
.colorbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.colorbar-minimize-btn {
    width: 22px;
    height: 22px;
    background: var(--fc-bg-interactive);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-sm);
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.colorbar-minimize-btn:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
    border-color: var(--fc-border-emphasis);
}

/* Minimized legend state */
.forecast-legend.minimized {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    pointer-events: none;
    transition: all 0.25s ease;
}

/* Adjust colorbar title when in header */
.colorbar-header .colorbar-title {
    margin-bottom: 0;
}

/* ===== RADIO-STYLE SUB-OPTIONS ===== */
.layer-suboptions[data-type="radio"] .suboption-item {
    cursor: pointer;
}

.layer-suboptions[data-type="radio"] .suboption-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--fc-text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-suboptions[data-type="radio"] .suboption-check i {
    font-size: 8px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.layer-suboptions[data-type="radio"] .suboption-item.active .suboption-check {
    border-color: var(--fc-accent);
    background: var(--fc-accent);
}

.layer-suboptions[data-type="radio"] .suboption-item.active .suboption-check i {
    opacity: 1;
    color: white;
}

/* ===== BASEMAP PICKER MODAL ===== */
.forecast-basemap-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.15s ease;
}

.basemap-picker-content {
    background: rgba(15, 21, 32, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--fc-border-emphasis);
    border-radius: var(--fc-radius-lg);
    width: 280px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--fc-shadow-xl);
}

.basemap-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--fc-border);
}

.basemap-picker-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--fc-text-primary);
}

.basemap-picker-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--fc-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fc-radius-sm);
    transition: all 0.15s ease;
}

.basemap-picker-close:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.basemap-picker-body {
    padding: 8px;
}

.basemap-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: var(--fc-radius-md);
    transition: all 0.15s ease;
    color: var(--fc-text-secondary);
}

.basemap-option-item:hover {
    background: var(--fc-bg-hover);
    color: var(--fc-text-primary);
}

.basemap-option-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--fc-text-primary);
}

.basemap-option-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.basemap-option-item span {
    flex: 1;
    font-size: 13px;
}

.basemap-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--fc-text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.basemap-check i {
    font-size: 9px;
    opacity: 0;
    color: white;
}

.basemap-check.checked {
    background: var(--fc-accent);
    border-color: var(--fc-accent);
}

.basemap-check.checked i {
    opacity: 1;
}
