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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    background: #1a1a1a;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

#header {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 900;
    pointer-events: all;
}


#app-title h1,
#app-title-text {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    color: rgb(222, 231, 247);
    gap: 8px;
}

.glass-panel {
    background: rgba(30, 30, 30, 0.60);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    color: #ffffff;

    background: rgba(31, 41, 55, 0.70);
    border-color: rgba(255, 255, 255, 0.1);
}

#app-title {
    position: fixed;
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    background: rgba(31, 41, 55, 0.40);
}

.loading {
    display: none;
    text-align: center;
    padding: 10px;
    color: #666;
    font-size: 13px;
}

.loading.active {
    display: block;
}

#loading-radar {
    width: auto;
    /* Important */
    display: flex;
    /* Manté el teu layout */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    /* Ara sí que funciona */
}


/********************************************/
/*              SIDEBAR TOGGLES
/********************************************/

#sidebar-toggles {
    position: fixed;
    top: 70px;
    left: 10px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-toggle-btn {
    width: 40px;
    height: 40px;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.6);


    background: rgba(4, 23, 62, 0.5);
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    transform: scale(1.10);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    background: rgba(2, 13, 36, 0.5);
    color: white;
}

.sidebar-toggle-btn.active {
    transform: scale(0.95);
    background: rgba(37, 99, 235, 0.3);
    background: rgba(0, 6, 17, 0.7);

    border-color: rgba(37, 99, 235, 0.5);
    color: #2a60a1;
    color: white;
    background: rgba(41, 94, 192, 0.7);
}

.sidebar-toggle-btn svg {
    width: 20px;
    height: 20px;
}

#zoom-menu-btn {
    margin-top: auto;
}

/*
#toggle-forecast {
    margin-top: 20px;
}

#toggle-reports {
    margin-top: 20px;
}*/

/*#toggle-radar, #toggle-layers {
    background: #1f2937;
}*/
/*#toggle-radar:not(.active),
#toggle-layers:not(.active) {
    background: #314663;
}*/
/*#toggle-radar.active,
#toggle-layers.active {
    background: none;
}*/

/*#toggle-reports:not(.active) {
    background: #093a7f;
}*/
/*
#toggle-config:not(.active) {
    background: #765454;
}*/

/********************************************/
/*              SIDEBARS
/********************************************/

.sidebar {
    position: fixed;
    top: 69px;
    right: -320px;
    width: 280px;
    max-height: calc(100vh - 150px);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 901;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: -15px;
}

/* Header del sidebar */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    padding-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: 2px;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}


/********************************************/
/*              RADAR SIDEBAR
/********************************************/

#radar-layers-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    margin-right: 10px;
}

.radar-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.radar-layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.radar-layer-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

.radar-layer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radar-layer-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.radar-layer-name {
    font-size: 12px;
    color: white;
}

.time-control-compact {
    /*display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;*/
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-bottom: 2px;
    /*padding: 8px 12px;*/
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.time-control-compact_inside {
    display: flex;
    flex-direction: row;
    /* Botons en horitzontal */
    align-items: center;
    gap: 8px;

}

.play-btn-minimal {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.play-btn-minimal:hover {
    background: rgba(37, 99, 235, 0.3);
    border-color: rgba(37, 99, 235, 0.5);
}


.edit-forecast-locations {
    width: 100%;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.edit-forecast-locations:hover {
    background: rgba(37, 99, 235, 0.3);
    border-color: rgba(37, 99, 235, 0.5);
}


.time-btn-minimal {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;

    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-weight: bold;
    font-size: 20px;
}

.time-btn-minimal:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

#time-display {
    font-size: 13px;
    font-weight: 600;
    color: white;
    min-width: 50px;
    text-align: center;
}



/* ========================================
   SLIDER DE TEMPS
   ======================================== */
.time-slider-container-compact {
    width: 70%;
    padding-top: 4px;
    padding-bottom: 0;
    padding-right: 10px;
    margin-bottom: 12px;
}

#time-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    #time-slider {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* Thumb del slider - Chrome, Safari, Opera */
#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Thumb del slider - Firefox */
#time-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #2196F3;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#time-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Track del slider - Firefox */
#time-slider::-moz-range-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

@media (prefers-color-scheme: dark) {
    #time-slider::-moz-range-track {
        background: rgba(255, 255, 255, 0.15);
    }
}


/********************************************/
/*              FORECAST SIDEBAR
/********************************************/

/* Navegació compacta */
.forecast-nav-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 8px;
}

.forecast-nav-btn-minimal {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 26px;
    font-weight: bold;
}

.forecast-nav-btn-minimal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.forecast-nav-btn-minimal:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#forecast-day-display_BAK {
    font-size: 13px;
    font-weight: 600;
    color: white;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.forecast-content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 2px;
    padding-right: 6px;
}

.forecast-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.forecast-location {
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.forecast-temp {
    font-size: 14px;
    font-weight: 600;
    color: #60a5fa;
}

.forecast-rain {
    font-size: 12px;
    color: #3b82f6;
    margin-left: 8px;
}

.forecast-values {
    display: flex;
    align-items: center;
}

.forecast-condition {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.forecast-locations-config {
    margin-top: 0px;
    margin-bottom: 0px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.forecast-locations-config .control-btn {
    width: 100%;
    margin-top: 0px;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px;
    padding-top: 0px;
}


.section-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-drag-handle {
    position: absolute;
    left: -20px;
    top: 12px;
    width: 16px;
    height: 100%;
    cursor: move;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.layer-drag-handle::before {
    content: '⋮⋮';
    color: white;
    font-size: 14px;
    line-height: 1;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    /* abans era 12px */
    /*    background: rgba(255, 255, 255, 0.05);*/
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.layer-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.layer-icon {
    width: 28px;
    /* abans era 32px */
    height: 28px;
    font-size: 16px;
    /* abans era 18px */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.layer-text {
    flex: 1;
}

.layer-label {
    font-size: 12px;
    /* abans era 13px */
    color: #ffffff;
    font-weight: 500;
}

.layer-count {
    font-size: 10px;
    /* abans era 11px */
    color: rgba(255, 255, 255, 0.5);
}


/************** TOGGLES **************/

.toggle-switch {
    position: relative;
    width: 40px;
    /* abans era 44px */
    height: 22px;
    /* abans era 24px */
}

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

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

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

input:checked+.toggle-slider {
    background-color: #2563eb;
}

input:checked+.toggle-slider:before {
    transform: translateX(18px);
}


/************** Layer OPTIONS **************/

.layer-options {
    margin-top: 0px;
    padding-left: 16px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.layer-options.expanded {
    max-height: 300px;
    margin-bottom: 0px;
}

.layer-options {
    padding-top: 0px;
    /* abans era 8px */
    padding-left: 12px;
    /* abans era 16px */
    padding-bottom: 4px;
}

.layer-option label {
    font-size: 11px;
    /* abans era 12px */
}

.layer-option {
    padding: 6px 0;
}

.layer-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.layer-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2563eb;
}


/************** ZOOM **************/

.zoom-menu-item {
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    border: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
}

.zoom-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

#zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 16px;
    z-index: 700;
    display: none;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    padding: 10px 16px;
    font-size: 12px;
    white-space: nowrap;
}


/************** SEARCH **************/

#search-container {
    margin-bottom: 2px;
}

#search-box {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    outline: none;
}

#search-box:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(37, 99, 235, 0.5);
}

#search-box::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#search-results {
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

#search-results.visible {
    display: block;
}

.search-result-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.search-result-name {
    font-weight: 500;
    color: #ffffff;
}

.search-result-type {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}


/************** MAP Controls & Legend **************/

#map-controls {
    position: fixed;
    bottom: 0px;
    left: 0px;
    z-index: 700;
    display: flex;
    gap: 0px;
}

/* SELECTOR DE MAPA BASE */
.select-container {
    position: relative;
    margin-bottom: 16px;
}

.select-container select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding: 8px 32px 8px 10px;
    color: white;
}

.select-container select:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.select-container select option {
    background: #1a1a1a;
    color: white;
}

/*
#legend {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 10px;
    z-index: 600;
    max-width: 200px;

    background: rgba(30, 30, 30, 0.20);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    color: #ffffff;
}*/

#legend h3 {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}


/************** MAPLIBRE PopUp **************/

.maplibregl-popup-content {
    padding: 12px;
    border-radius: 8px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.maplibregl-popup-close-button {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 28px;
    color: white;
}

.popup-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-right: 20px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-stat {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
    font-size: 12px;
}

.popup-stat-label {
    color: rgba(255, 255, 255, 0.6);
    margin-right: 12px;
}

.popup-stat-value {
    color: #ffffff;
    font-weight: 500;
}

.popup-alert {
    margin-top: 10px;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
}


/************** MESSAGES **************/

#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
    gap: 20px;
}

#loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#error {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    color: #fca5a5;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    z-index: 10001;
    display: none;
    max-width: 500px;
}

#error.visible {
    display: block;
}

/************** LLISTA DE CAPES **************/

.layer-item-container {
    margin-top: 0px;
    /* abans era 12px */
    margin-bottom: 0px;
    /* abans era 12px */
    padding: 0;
    position: relative;
}

.layer-item-container:hover .layer-drag-handle {
    opacity: 0.6;
}


/************** GRUPS DE CAPES **************/


.layers-container {
    margin-bottom: 10px;
}

.layer-group {
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px 8px 0 0;
    /* top-left, top-right, bottom-right, bottom-left */
    padding: 0;
    overflow: hidden;
}

.layer-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.2s;
}

.layer-group-header:hover {
    background: rgba(255, 255, 255, 0.12);
}

.layer-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-group-toggle {
    font-size: 18px;
    transition: transform 0.3s;
    opacity: 0.6;
}

.layer-group.collapsed .layer-group-toggle {
    transform: rotate(-90deg);
}

.layer-group-actions {
    display: flex;
    gap: 6px;
}

.layer-group-btn {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #2563eb;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    margin-right: 6px;
}

.layer-group-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.eye-btn {
    padding: 4px;
}

.eye-icon {
    width: 20px;
    height: 20px;
    color: #aaa;
}

.eye-icon.eye-visible {
    color: #2563eb;
}

.layer-group-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-bottom: 0px;
}

.layer-group.collapsed .layer-group-content {
    max-height: 0;
    padding: 0 2px;
}




/*
@media (max-width: 768px) {
    #sidebar {
        width: calc(100vw - 80px);
        max-width: 320px;
        top: 70px;
        right: 12px;
    }

    #header {
        top: 12px;
        left: 12px;
    }

    #app-title h1 {
        font-size: 14px;
    }

    #zoom-menu-btn {
        top: 60px;
        left: 12px;
    }

    #zoom-menu {
        top: 60px;
        left: 60px;
    }

    #legend {
        display: none;
    }

    .control-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    #sidebar {
        width: calc(100vw - 80px);
        max-width: 280px;
        right: 12px;
    }

    #sidebar.collapsed {
        transform: translateX(calc(100% + 60px));
    }
}*/
/* =========================================================================================
   LEGEND STYLES (UNIFIED)
   ========================================================================================= */

/* Base Legend Container (Desktop Default) */
/*
#legend {
    position: absolute;
    bottom: 30px;
    left: 20px;
    z-index: 1000;
    min-width: 280px;
    max-width: 320px;
    border-radius: 12px;
    padding: 12px 16px;
    background: rgba(20, 25, 30, 0.85);
    background: var(--sidebar-bg, rgba(20, 25, 30, 0.85));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: #ffffff;
    transition: all 0.3s ease;
}*/

/* Legend Content Layout */
.legend-content {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 0px;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 12px;
}

.legend-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.3px;
}

.legend-bar-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-values {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0px;

    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    padding-bottom: 1px;
}

.legend-gradient {
    height: 8px;
    width: 100%;
    border-radius: 5px;
    /* Default gradient, will be overridden by JS */
    background: linear-gradient(to right, #ef4444, #f97316, #eab308, #22c55e, #3b82f6);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =========================================================================================
   MOBILE OVERRIDES
   ========================================================================================= */



/*@media (max-width: 768px) {*/
#legend {
    bottom: 0px !important;
    /* Exact height of nav bar */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
    padding-left: 6px;
    padding-right: 6px;

    /* Seamless integration with bottom nav */
    /*background: var(--sidebar-bg, rgba(20, 25, 30, 0.95)) !important;*/
    background: rgba(30, 30, 30, 0.30);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
    margin: 0 !important;
}

@media (min-width: 768px) {
    #legend {
        padding-left: 80px !important;
    }
}

/* Adjust inner spacing for mobile if needed */
.legend-content {
    flex-direction: row;
    /* Optional: put title next to bar on very wide mobile? No, stick to column for now or flex row */
    align-items: center;
    /*        gap: 16px;*/
}

.legend-header {
    margin-bottom: 0 !important;
    min-width: 90px;
}

.legend-bar-container {
    flex: 1;
}

/*}*/