/* =====================================================
   Historical ERA5 Viewer Styles
   ===================================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
}

/* =====================================================
   Header Styles
   ===================================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    border-bottom: 1px solid #0f3460;
    height: 60px;
    z-index: 1000;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #4cc9f0;
    white-space: nowrap;
}

.legal-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #4cc9f0;
    color: #4cc9f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.legal-btn:hover {
    background: rgba(76, 201, 240, 0.1);
}

.data-lag-notice {
    font-size: 0.8rem;
    color: #ffcc00;
    background: rgba(255, 204, 0, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 204, 0, 0.3);
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    color: #a0a0a0;
    white-space: nowrap;
}

.control-group input[type="date"],
.control-group select {
    padding: 6px 10px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.control-group input[type="date"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #4cc9f0;
}

#fetch-data-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #4cc9f0 0%, #3a9fd8 100%);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#fetch-data-btn:hover {
    background: linear-gradient(135deg, #5dd8ff 0%, #4cc9f0 100%);
    transform: translateY(-1px);
}

#fetch-data-btn:active {
    transform: translateY(0);
}

#status-message {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 150px;
}

#status-message.status-loading {
    color: #ffd93d;
}

#status-message.status-success {
    color: #6bcb77;
}

#status-message.status-error {
    color: #ff6b6b;
}

/* =====================================================
   Dropdown Styles
   ===================================================== */

.dropdown-container {
    position: relative;
}

.dropdown-btn {
    padding: 6px 14px;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dropdown-btn:hover {
    border-color: #4cc9f0;
    background: #1a2744;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    min-width: 180px;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #1a2744;
}

.dropdown-item input[type="radio"] {
    accent-color: #4cc9f0;
}

/* Options Dropdown */
.options-dropdown {
    min-width: 200px;
    padding: 8px 0;
}

.options-item {
    padding: 8px 12px;
}

.options-item .setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.options-item input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.options-item input[type="checkbox"] {
    accent-color: #4cc9f0;
}

/* Opacity Dropdown */
.opacity-dropdown {
    min-width: 200px;
    padding: 12px;
}

.opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.opacity-slider-container input[type="range"] {
    flex: 1;
    accent-color: #4cc9f0;
}

.opacity-slider-container span {
    min-width: 40px;
    text-align: right;
    font-size: 0.85rem;
}

/* Overlay Dropdown */
.overlay-dropdown {
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
}

.overlay-item {
    padding: 6px 12px;
    border-bottom: 1px solid #0f3460;
}

.overlay-item:last-child {
    border-bottom: none;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overlay-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.overlay-checkbox input[type="checkbox"] {
    accent-color: #4cc9f0;
}

.overlay-settings-btn {
    background: transparent;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: color 0.2s;
}

.overlay-settings-btn:hover {
    color: #4cc9f0;
}

.overlay-settings {
    margin-top: 8px;
    padding: 8px;
    background: #1a1a2e;
    border-radius: 4px;
}

.overlay-settings .setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.overlay-settings .setting-row:last-child {
    margin-bottom: 0;
}

.overlay-settings input[type="range"] {
    flex: 1;
    accent-color: #4cc9f0;
}

.overlay-settings input[type="color"] {
    width: 30px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.overlay-settings .setting-value {
    min-width: 35px;
    text-align: right;
    font-size: 0.8rem;
    color: #a0a0a0;
}

/* =====================================================
   Main Content Layout
   ===================================================== */

#main-content {
    display: flex;
    height: calc(100vh - 60px);
    position: relative;
}

/* =====================================================
   Parameter Sidebar
   ===================================================== */

#parameter-sidebar {
    width: 240px;
    background: #16213e;
    border-right: 1px solid #0f3460;
    overflow-y: auto;
    flex-shrink: 0;
}

#parameter-sidebar h3 {
    padding: 12px 15px;
    font-size: 1rem;
    font-weight: 600;
    color: #4cc9f0;
    border-bottom: 1px solid #0f3460;
}

.param-section {
    border-bottom: 1px solid #0f3460;
}

.param-section-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 8px;
}

.param-section-header:hover {
    background: #1a2744;
}

.param-section-header input[type="radio"] {
    accent-color: #4cc9f0;
}

.param-section-header label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.section-arrow {
    font-size: 0.7rem;
    color: #a0a0a0;
    transition: transform 0.2s;
}

.param-section.collapsed .section-arrow {
    transform: rotate(-90deg);
}

.param-section-content {
    padding: 8px 10px;
    display: block;
}

.param-section.collapsed .param-section-content {
    display: none;
}

/* Pressure Level Selector */
.pressure-level-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    margin-bottom: 8px;
    background: #1a1a2e;
    border-radius: 4px;
}

.pressure-level-selector label {
    font-size: 0.85rem;
    color: #a0a0a0;
}

.pressure-level-selector select {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85rem;
}

/* Parameter Button Wrapper */
.param-btn-wrapper {
    display: flex;
    align-items: stretch;
    margin-bottom: 4px;
    position: relative;
}

.param-btn {
    flex: 1;
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px 0 0 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.param-btn:hover:not(:disabled) {
    background: #1a2744;
    border-color: #4cc9f0;
}

.param-btn.active {
    background: #0f3460;
    border-color: #4cc9f0;
    color: #4cc9f0;
}

.param-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.param-options-btn {
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.2s;
}

.param-options-btn:hover:not(:disabled) {
    background: #1a2744;
    color: #4cc9f0;
}

.param-options-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Parameter Options Dropdown */
.param-options-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    z-index: 100;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.param-options-dropdown.show {
    display: block;
}

.option-group {
    padding: 8px;
}

.option-label {
    font-size: 0.8rem;
    color: #a0a0a0;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.option-item input[type="checkbox"] {
    accent-color: #4cc9f0;
}

.option-settings-btn {
    background: transparent;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.9rem;
}

.option-settings-btn:hover {
    color: #4cc9f0;
}

.option-settings {
    display: none;
    padding: 8px;
    margin-top: 4px;
    background: #1a1a2e;
    border-radius: 4px;
}

.option-settings.show {
    display: block;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.settings-row label {
    min-width: 60px;
    color: #a0a0a0;
}

.settings-row input[type="number"] {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.settings-row select {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.settings-reset-btn {
    width: 100%;
    padding: 6px;
    margin-top: 4px;
    background: #0f3460;
    border: none;
    border-radius: 4px;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.settings-reset-btn:hover {
    background: #1a2744;
    color: #4cc9f0;
}

/* =====================================================
   Map Container
   ===================================================== */

#map {
    flex: 1;
    background: #1a1a2e;
}

/* Leaflet Customization */
.leaflet-container {
    background: #1a1a2e;
    font-family: inherit;
}

.leaflet-control-attribution {
    background: rgba(22, 33, 62, 0.9) !important;
    color: #a0a0a0 !important;
    font-size: 0.75rem;
}

.leaflet-control-attribution a {
    color: #4cc9f0 !important;
}

/* Grid Labels */
.grid-label {
    background: transparent;
    border: none;
    font-size: 11px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* =====================================================
   Timestamp Display
   ===================================================== */

#timestamp-display {
    position: absolute;
    top: 20px;
    left: calc(50% + 125px);  /* Account for 250px sidebar */
    transform: translateX(-50%);
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 10px 20px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#timestamp-display.hidden {
    display: none;
}

.timestamp-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4cc9f0;
}

.timestamp-time {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
}

/* =====================================================
   Legend
   ===================================================== */

#legend {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 12px;
    min-width: 80px;
    z-index: 500;
}

#legend.hidden {
    display: none;
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4cc9f0;
    margin-bottom: 10px;
    text-align: center;
}

.legend-gradient {
    width: 20px;
    height: 180px;
    margin: 0 auto;
    border-radius: 2px;
    background: linear-gradient(to top, #00007F, #0000FF, #007FFF, #00FFFF, #7FFF7F, #FFFF00, #FF7F00, #FF0000, #7F0000);
}

.legend-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    margin-left: 8px;
    position: absolute;
    right: 12px;
    top: 42px;
}

.legend-labels span {
    font-size: 0.75rem;
    color: #a0a0a0;
}

/* =====================================================
   Value Display
   ===================================================== */

#value-display {
    position: absolute;
    top: 20px;
    left: 260px;
    display: flex;
    gap: 15px;
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 0.9rem;
    z-index: 500;
}

.value-coords {
    color: #a0a0a0;
}

.value-data {
    color: #4cc9f0;
    font-weight: 500;
}

/* =====================================================
   Flyout Popup
   ===================================================== */

#param-flyout {
    position: absolute;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    min-width: 220px;
    z-index: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#param-flyout.hidden {
    display: none;
}

.flyout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #0f3460;
    border-radius: 5px 5px 0 0;
}

.flyout-title {
    font-weight: 600;
    color: #4cc9f0;
    font-size: 0.95rem;
}

.flyout-close {
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.flyout-close:hover {
    color: #ff6b6b;
}

.flyout-content {
    padding: 12px;
}

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

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

.flyout-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.flyout-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.flyout-option input[type="checkbox"] {
    accent-color: #4cc9f0;
}

.flyout-settings-toggle {
    background: transparent;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.flyout-settings-toggle:hover,
.flyout-settings-toggle.active {
    color: #4cc9f0;
}

.flyout-settings {
    display: none;
    padding: 10px;
    margin-top: 6px;
    background: #1a1a2e;
    border-radius: 4px;
}

.flyout-settings.show {
    display: block;
}

.flyout-settings .settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.flyout-settings .settings-row:last-of-type {
    margin-bottom: 8px;
}

.flyout-settings .settings-row label {
    min-width: 70px;
    color: #a0a0a0;
}

.flyout-settings input[type="number"],
.flyout-settings select {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.flyout-settings input[type="checkbox"] {
    accent-color: #4cc9f0;
}

/* =====================================================
   Modal Styles
   ===================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 24px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #ff6b6b;
}

.modal-content h2 {
    color: #4cc9f0;
    margin-bottom: 16px;
    padding-right: 30px;
}

.legal-content h3 {
    color: #e0e0e0;
    margin: 16px 0 8px;
    font-size: 1rem;
}

.legal-content p {
    color: #a0a0a0;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.legal-content a {
    color: #4cc9f0;
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* =====================================================
   Loading Overlay
   ===================================================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
}

#loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #0f3460;
    border-top-color: #4cc9f0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4cc9f0;
    margin-bottom: 10px;
}

.loading-subtitle {
    font-size: 0.95rem;
    color: #a0a0a0;
}

.loading-hint {
    font-size: 0.85rem;
    color: #6dd5ed;
    margin-top: 20px;
    padding: 12px 20px;
    background: rgba(77, 201, 240, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(77, 201, 240, 0.3);
    max-width: 350px;
}

/* =====================================================
   Active Layers Panel
   ===================================================== */

#active-layers-panel {
    position: fixed;
    bottom: 0;
    left: 250px;
    right: 0;
    max-height: 50vh;
    background: linear-gradient(to top, rgba(22, 33, 62, 0.98), rgba(22, 33, 62, 0.95));
    border-top: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    z-index: 1400;
    backdrop-filter: blur(8px);
    transition: bottom 0.2s ease;
    overflow: hidden;
}

#active-layers-panel.hidden {
    display: none;
}

/* When scrubber is visible, move active layers panel up */
#main-content:has(#time-scrubber:not(.hidden)) #active-layers-panel {
    bottom: 150px;
}

.active-layers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(15, 52, 96, 0.5);
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.active-layers-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4cc9f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#layer-count {
    color: #a0a0a0;
    font-weight: normal;
}

.clear-all-btn {
    padding: 4px 12px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    border-radius: 4px;
    color: #ff6b6b;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-all-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    color: #ff8888;
}

.active-layers-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px;
    gap: 8px;
}

.no-layers-message {
    color: #a0a0a0;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Active Layer Item */
.active-layer-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(15, 52, 96, 0.6);
    border: 1px solid #1a4a7a;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s;
}

.active-layer-item:hover {
    border-color: #4cc9f0;
}

.active-layer-item.dragging {
    opacity: 0.5;
}

.active-layer-item.drag-over {
    border-color: #f0a04b;
    background: rgba(240, 160, 75, 0.1);
}

.layer-drag-handle {
    cursor: grab;
    color: #a0a0a0;
    font-size: 1rem;
    padding: 4px;
    user-select: none;
}

.layer-drag-handle:hover {
    color: #4cc9f0;
}

.layer-drag-handle:active {
    cursor: grabbing;
}

.layer-visibility-checkbox {
    margin-top: 4px;
    accent-color: #4cc9f0;
}

.layer-info {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    gap: 2px;
}

.layer-name {
    color: #e0e0e0;
    font-weight: 600;
    font-size: 0.9rem;
}

.layer-level {
    color: #a0a0a0;
    font-size: 0.75rem;
}

/* Layer Controls */
.layer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1;
    align-items: center;
}

.layer-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.layer-control-group label {
    color: #a0a0a0;
    white-space: nowrap;
}

.layer-control-group select,
.layer-control-group input[type="number"] {
    padding: 4px 8px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.layer-control-group select:focus,
.layer-control-group input[type="number"]:focus {
    outline: none;
    border-color: #4cc9f0;
}

.layer-control-group input[type="number"] {
    width: 70px;
}

.layer-control-group input[type="range"] {
    width: 80px;
    accent-color: #4cc9f0;
}

/* Colorbar display */
.layer-colorbar {
    display: flex;
    align-items: center;
}

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

.colorbar-min,
.colorbar-max {
    font-size: 0.75rem;
    color: #a0a0a0;
    min-width: 40px;
}

.colorbar-min {
    text-align: right;
}

.colorbar-gradient {
    width: 80px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #0f3460;
}

/* Colormap gradients */
.colorbar-gradient.jet {
    background: linear-gradient(90deg, #00007F, #0000FF, #00FFFF, #FFFF00, #FF0000, #7F0000);
}

.colorbar-gradient.viridis {
    background: linear-gradient(90deg, #440154, #3E4A89, #1F9E89, #6DCD59, #FDE725);
}

.colorbar-gradient.plasma {
    background: linear-gradient(90deg, #0D0887, #7201A8, #ED7953, #FDC328);
}

.colorbar-gradient.cividis {
    background: linear-gradient(90deg, #00224E, #575D6D, #A59C74, #FDEA45);
}

.colorbar-gradient.seismic {
    background: linear-gradient(90deg, #00004C, #0000FF, #FFFFFF, #FF0000, #4C0000);
}

.colorbar-gradient.cubehelix {
    background: linear-gradient(90deg, #000000, #2B6A5D, #ECC846, #FFFFFF);
}

/* Render mode toggle */
.layer-render-toggle {
    display: flex;
    border: 1px solid #0f3460;
    border-radius: 4px;
    overflow: hidden;
}

.render-btn {
    padding: 4px 10px;
    background: #1a1a2e;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.render-btn:first-child {
    border-right: 1px solid #0f3460;
}

.render-btn:hover {
    background: #1a2744;
}

.render-btn.active {
    background: #0f3460;
    color: #4cc9f0;
}

/* Labels checkbox */
.layer-labels-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.layer-labels-checkbox input[type="checkbox"] {
    accent-color: #4cc9f0;
}

/* Hidden groups */
.layer-interval-group.hidden,
.layer-labels-group.hidden {
    display: none;
}

/* Opacity display */
.layer-opacity-group {
    min-width: 150px;
}

.layer-opacity-value {
    font-size: 0.8rem;
    color: #a0a0a0;
    min-width: 35px;
    text-align: right;
}

/* Interval input */
.layer-interval {
    width: 60px;
    text-align: center;
}

/* Remove button */
.layer-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.layer-remove-btn:hover {
    color: #ff6b6b;
}

/* Station count for ASOS-style layers */
.layer-station-count {
    font-size: 0.75rem;
    color: #6dd5ed;
}


/* =====================================================
   Time Scrubber Bar
   ===================================================== */

#time-scrubber {
    position: fixed;
    bottom: 0;
    left: 250px;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, rgba(26, 26, 46, 0.98), rgba(26, 26, 46, 0.95));
    border-top: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    padding: 12px 20px;
    z-index: 1500;
    backdrop-filter: blur(8px);
}

#time-scrubber.hidden {
    display: none;
}

.scrubber-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.scrubber-controls button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #0f3460;
    color: #4cc9f0;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.scrubber-controls button:hover {
    background: #1a4a7a;
    transform: scale(1.05);
}

.scrubber-controls button:active {
    transform: scale(0.95);
}

#scrubber-play {
    width: 40px;
    height: 40px;
    font-size: 16px;
    background: linear-gradient(135deg, #4cc9f0, #0f3460);
}

#scrubber-play.playing {
    background: linear-gradient(135deg, #f0544c, #0f3460);
}

#scrubber-next {
    transform: scaleX(1);
}

.scrubber-speed {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 15px;
    color: #a0a0a0;
    font-size: 0.85rem;
}

.scrubber-speed input[type="number"] {
    background: #0f3460;
    border: 1px solid #1a4a7a;
    color: #e0e0e0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    width: 60px;
    text-align: center;
}

.scrubber-speed input[type="number"]:focus {
    outline: none;
    border-color: #4cc9f0;
}

.scrubber-preload-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    padding: 6px 12px;
    background: rgba(77, 201, 240, 0.15);
    border: 1px solid rgba(77, 201, 240, 0.3);
    border-radius: 6px;
    color: #4cc9f0;
    font-size: 0.85rem;
}

.scrubber-preload-status.hidden {
    display: none;
}

.preload-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #0f3460;
    border-top-color: #4cc9f0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.preload-text {
    color: #6dd5ed;
}

.preload-progress {
    color: #ffffff;
    font-weight: 600;
}

.scrubber-timeline {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scrubber-track {
    position: relative;
    height: 8px;
    background: #0f3460;
    border-radius: 4px;
    cursor: pointer;
}

.scrubber-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(76, 201, 240, 0.15), rgba(109, 213, 237, 0.25));
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s;
}

.scrubber-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #4cc9f0;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
    left: 0%;
    transition: left 0.1s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.scrubber-thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.scrubber-range-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(240, 160, 75, 0.25);
    border: 1px solid rgba(240, 160, 75, 0.5);
    border-radius: 4px;
    pointer-events: none;
}

.scrubber-range-start,
.scrubber-range-end {
    position: absolute;
    top: -8px;
    width: 16px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    color: #f0a04b;
    font-size: 10px;
    z-index: 10;
    user-select: none;
}

.scrubber-range-start {
    transform: translateX(-50%);
    left: 0%;
}

.scrubber-range-end {
    transform: translateX(-50%);
    left: 100%;
}

.scrubber-range-start:hover,
.scrubber-range-end:hover {
    color: #ffc107;
    transform: translateX(-50%) scale(1.2);
}

.scrubber-range-label {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #f0a04b;
    white-space: nowrap;
    pointer-events: none;
    background: rgba(26, 26, 46, 0.9);
    padding: 2px 4px;
    border-radius: 3px;
}

.scrubber-loop-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #f0a04b;
    font-size: 0.85rem;
}

.loop-label {
    color: #f0a04b;
    font-weight: 500;
}

.loop-input {
    background: #0f3460;
    border: 1px solid #f0a04b;
    color: #f0a04b;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.85rem;
}

.loop-input:focus {
    outline: none;
    border-color: #ffc107;
    background: #1a4a7a;
}

.loop-day {
    width: 50px;
    text-align: center;
}

.loop-hour {
    width: 60px;
}

.loop-arrow {
    color: #f0a04b;
    font-size: 1rem;
    margin: 0 4px;
}

.loop-frame-count {
    color: #a0a0a0;
    font-size: 0.8rem;
    margin-left: 8px;
}

.scrubber-ticks {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px 0 8px;
    font-size: 0.85rem;
    color: #8888aa;
    overflow: hidden;
    margin-top: 8px;
}

.scrubber-ticks span {
    white-space: nowrap;
}

.scrubber-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-top: 8px;
}

.scrubber-current-time {
    color: #4cc9f0;
    font-weight: 600;
    font-size: 1rem;
}

.scrubber-range {
    color: #a0a0a0;
}

/* =====================================================
   Hidden Utility Class
   ===================================================== */

.hidden {
    display: none !important;
}

/* =====================================================
   Responsive Styles
   ===================================================== */

@media (max-width: 1024px) {
    header {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 15px;
    }

    .header-title {
        width: 100%;
        margin-bottom: 10px;
    }

    .controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    #parameter-sidebar {
        width: 200px;
    }

    #value-display {
        left: 220px;
    }

    #active-layers-panel {
        left: 200px;
    }

    .layer-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .layer-info {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    #parameter-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 800;
    }

    #parameter-sidebar.open {
        transform: translateX(0);
    }

    #value-display {
        left: 20px;
        top: 80px;
    }

    #legend {
        right: 10px;
        padding: 8px;
    }

    .legend-gradient {
        height: 120px;
    }

    .legend-labels {
        height: 120px;
    }

    #active-layers-panel {
        left: 0;
        max-height: 40vh;
    }

    .active-layer-item {
        flex-wrap: wrap;
    }

    .layer-controls {
        width: 100%;
        padding-top: 8px;
    }

    .layer-remove-btn {
        top: 4px;
        right: 4px;
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-group {
        width: 100%;
    }

    #fetch-data-btn {
        width: 100%;
    }

    .modal-content {
        margin: 20px;
        padding: 16px;
    }
}

/* =====================================================
   Scrollbar Styles
   ===================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4cc9f0;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #0f3460 #1a1a2e;
}
