/* Climate Curves — Leaflet Dark Theme Overrides & Weather Map Styles */

/* ── 1. Map container ─────────────────────────────────────────────────────── */

.leaflet-container {
    background: #111827 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

/* ── 2. Layer control panel ───────────────────────────────────────────────── */

.leaflet-control-layers {
    background-color: #1f2937 !important;
    color: #d1d5db !important;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    padding: 8px 12px !important;
}

.leaflet-control-layers-expanded {
    padding: 10px 14px !important;
}

/* ── 3. Layer control labels & text ───────────────────────────────────────── */

.leaflet-control-layers label {
    color: #e5e7eb !important;
    font-size: 13px;
    margin-bottom: 4px;
}

.leaflet-control-layers label span {
    color: #d1d5db !important;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
    color: #e5e7eb !important;
}

/* ── 4. Layer control separator ───────────────────────────────────────────── */

.leaflet-control-layers-separator {
    border-top: 1px solid #374151 !important;
    margin: 6px 0 !important;
}

/* ── 5. Attribution ───────────────────────────────────────────────────────── */

.leaflet-control-attribution {
    background-color: rgba(31, 41, 55, 0.85) !important;
    color: #6b7280 !important;
    font-size: 10px !important;
    border-radius: 4px 0 0 0;
    padding: 2px 8px !important;
}

/* ── 6. Attribution links ─────────────────────────────────────────────────── */

.leaflet-control-attribution a {
    color: #3b82f6 !important;
    text-decoration: none;
}

.leaflet-control-attribution a:hover {
    color: #60a5fa !important;
    text-decoration: underline;
}

/* ── 7. Tooltips ──────────────────────────────────────────────────────────── */

.leaflet-tooltip {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── 8. Tooltip arrows ────────────────────────────────────────────────────── */

.leaflet-tooltip-top::before {
    border-top-color: #374151 !important;
}

.leaflet-tooltip-bottom::before {
    border-bottom-color: #374151 !important;
}

.leaflet-tooltip-left::before {
    border-left-color: #374151 !important;
}

.leaflet-tooltip-right::before {
    border-right-color: #374151 !important;
}

/* ── 9. Popup content wrapper ─────────────────────────────────────────────── */

.leaflet-popup-content-wrapper {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid #374151;
}

.leaflet-popup-content {
    color: #d1d5db !important;
    font-size: 13px;
    line-height: 1.5;
    margin: 12px 16px !important;
}

.leaflet-popup-content a {
    color: #3b82f6;
    text-decoration: none;
}

.leaflet-popup-content a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* ── 10. Popup tip (the triangle arrow) ───────────────────────────────────── */

.leaflet-popup-tip {
    background-color: #1f2937 !important;
    border: 1px solid #374151;
    box-shadow: none !important;
}

/* ── 11. Popup close button ───────────────────────────────────────────────── */

.leaflet-popup-close-button {
    color: #9ca3af !important;
    font-size: 18px !important;
    padding: 6px 8px 0 0 !important;
}

.leaflet-popup-close-button:hover {
    color: #e5e7eb !important;
    background: transparent !important;
}

/* ── 12. Zoom controls ────────────────────────────────────────────────────── */

.leaflet-control-zoom a {
    background-color: #1f2937 !important;
    color: #d1d5db !important;
    border-color: #374151 !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom {
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a:first-child {
    border-bottom: 1px solid #374151 !important;
    border-radius: 7px 7px 0 0 !important;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 7px 7px !important;
}

/* ── 13. Zoom hover state ─────────────────────────────────────────────────── */

.leaflet-control-zoom a:hover {
    background-color: #374151 !important;
    color: #e5e7eb !important;
}

.leaflet-control-zoom a:active {
    background-color: #4b5563 !important;
}

.leaflet-control-zoom-disabled,
.leaflet-control-zoom-disabled:hover {
    background-color: #1f2937 !important;
    color: #4b5563 !important;
    cursor: default;
}

/* ── 14. Radar controls bar ───────────────────────────────────────────────── */

.radar-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background-color: #1e293b;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 10px 16px;
    margin-top: 8px;
}

/* ── 15. Radar play button ────────────────────────────────────────────────── */

.radar-play-btn {
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.radar-play-btn:hover {
    background-color: #2563eb;
}

.radar-play-btn:active {
    background-color: #1d4ed8;
}

.radar-play-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.radar-play-btn:disabled {
    background-color: #374151;
    color: #6b7280;
    cursor: not-allowed;
}

/* ── 16. Radar timestamp display ──────────────────────────────────────────── */

.radar-timestamp {
    color: #9ca3af;
    font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
        "Courier New", monospace;
    font-size: 13px;
    letter-spacing: 0.02em;
    padding: 4px 8px;
    background-color: rgba(17, 24, 39, 0.5);
    border-radius: 4px;
    white-space: nowrap;
}

/* ── 17. Weather legend ───────────────────────────────────────────────────── */

.weather-legend {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.weather-legend-title {
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    margin-bottom: 2px;
}

/* ── 18. Weather legend items ─────────────────────────────────────────────── */

.weather-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #d1d5db;
    font-size: 12px;
    white-space: nowrap;
}

.weather-legend-item .legend-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.weather-legend-item .legend-line {
    width: 18px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── 19. SNOTEL station detail panel ──────────────────────────────────────── */

.snotel-detail-panel {
    background-color: #1e293b;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.snotel-detail-panel h4 {
    color: #e5e7eb;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #374151;
}

.snotel-detail-panel p {
    color: #d1d5db;
    font-size: 13px;
    line-height: 1.6;
    margin: 4px 0;
}

.snotel-detail-panel .detail-label {
    color: #9ca3af;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.snotel-detail-panel .detail-value {
    color: #e5e7eb;
    font-size: 20px;
    font-weight: 700;
}

.snotel-detail-panel .detail-unit {
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
    margin-left: 4px;
}

/* ── 20. Mobile responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Shrink map height on small screens */
    .leaflet-container {
        height: 400px !important;
        min-height: 300px;
    }

    /* Stack radar controls vertically */
    .radar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px 12px;
    }

    .radar-play-btn {
        width: 100%;
        text-align: center;
    }

    .radar-timestamp {
        text-align: center;
    }

    /* Stack legend items vertically */
    .weather-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* Full-width detail panel */
    .snotel-detail-panel {
        padding: 12px 14px;
    }

    .snotel-detail-panel .detail-value {
        font-size: 18px;
    }

    /* Ensure layer control does not overflow */
    .leaflet-control-layers-expanded {
        max-width: calc(100vw - 80px);
    }

    .dark-date-picker .DateInput_input {
        width: 100px;
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ── 21. Snow cover date picker (dark theme) ─────────────────────────────── */

.dark-date-picker .DateInput_input {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
    border: 1px solid #374151 !important;
    border-radius: 6px !important;
    font-size: 0.85rem;
    padding: 6px 10px;
    width: 120px;
}

.dark-date-picker .DateInput_input__focused {
    border-color: #3b82f6 !important;
}

.dark-date-picker .SingleDatePickerInput,
.dark-date-picker .SingleDatePickerInput__withBorder {
    background-color: transparent !important;
    border: none !important;
}

.dark-date-picker .DateInput {
    background-color: transparent !important;
}

/* Calendar popup dark theme */
.DayPicker {
    background-color: #1f2937 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.CalendarMonth {
    background-color: #1f2937 !important;
}

.CalendarMonth_caption {
    color: #f9fafb !important;
}

.CalendarDay__default {
    background-color: #1f2937 !important;
    color: #d1d5db !important;
    border: 1px solid #374151 !important;
}

.CalendarDay__default:hover {
    background-color: #374151 !important;
    color: #f9fafb !important;
}

.CalendarDay__selected,
.CalendarDay__selected:hover {
    background-color: #3b82f6 !important;
    color: #f9fafb !important;
}

.CalendarDay__blocked_out_of_range {
    color: #4b5563 !important;
}

.DayPickerNavigation_button__default {
    background-color: #1f2937 !important;
    border: 1px solid #374151 !important;
}

.DayPickerNavigation_svg__horizontal {
    fill: #9ca3af !important;
}

.DayPickerKeyboardShortcuts_buttonReset {
    display: none;
}

/* ── 22. QPF period dropdown (dark theme) ─────────────────────────────────── */

.dark-dropdown .Select-control {
    background-color: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 6px !important;
    color: #f9fafb !important;
}

.dark-dropdown .Select-value-label,
.dark-dropdown .Select-placeholder {
    color: #d1d5db !important;
}

.dark-dropdown .Select-menu-outer {
    background-color: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.dark-dropdown .VirtualizedSelectOption {
    background-color: #1f2937 !important;
    color: #d1d5db !important;
}

.dark-dropdown .VirtualizedSelectFocusedOption {
    background-color: #374151 !important;
    color: #f9fafb !important;
}

.dark-dropdown .Select-arrow {
    border-color: #9ca3af transparent transparent !important;
}

.dark-dropdown .Select-clear-zone {
    color: #9ca3af !important;
}
