#sidebarNav .list-group-item {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #1a7365;
    border-left: none;
    border-right: none;
    border-radius: 0;
}

#sidebarNav .list-group-item-action:hover,
#sidebarNav .list-group-item-action:focus {
    background-color: #e9ecef;
    color: #1a7365;
}

#sidebarNav .list-group-item-action.active {
    background-color: #e9ecef;
    color: #1a7365;
    border-color: #dee2e6;
}

body {
    font-family: sans-serif;
}

#map {
    height: 450px;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #ccc;
}

.leaflet-tooltip.commune-label {
    background-color: transparent;
    border: none;
    box-shadow: none;
    font-weight: bold;
    font-size: 9px;
    color: #333;
    text-shadow: 1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff;
    white-space: nowrap;
    pointer-events: none;
}

.bg-cabezera {
    background-color: #0056b3;
}

.main-container {
    margin-top: 15px;
}

.map-section {
    margin-bottom: 20px;
}

.content-section {
    display: none;
    margin-top: 15px;
}

.content-section.active {
    display: block;
}

.chart-container {
    width: 100%;
    height: 350px;
    margin-bottom: 5px;
}

h5 {
    text-align: start;
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: bold;
}

.legend {
    padding: 6px 8px;
    font: 12px Arial, Helvetica, sans-serif;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    line-height: 18px;
    color: #555;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.9;
    border: 1px solid #aaa;
}

.info-box {
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-top: 10px;
    min-height: 150px;
}

.info-box h6 {
    margin-top: 0;
    font-weight: bold;
}

#regional-avg-table td,
#comuna-detail-table td {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
}

#serie-tiempo-placeholder,
#persistencia-placeholder {
    text-align: center;
    padding: 20px;
    background: #eee;
    border-radius: 4px;
    margin-top: 10px;
    font-style: italic;
    color: #666;
}

.small-map-placeholder {
    width: 18%;
    display: inline-block;
    background: #ddd;
    height: 100px;
    margin: 0 1%;
    text-align: center;
    line-height: 100px;
    font-size: 0.8em;
    border-radius: 3px;
}

.card-header.bg-cabezera {
    background-color: #0056b3;
}

.table-legend td {
    padding: 0.1rem 0.4rem !important;
    font-size: 0.75rem;
}

.table-legend .color-box {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border: 1px solid #ccc;
    vertical-align: middle;
}

.persistencia-map-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    gap: 10px;
}

.persistencia-map-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 15px;
}

.persistencia-map-item {
    text-align: center;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    background-color: #f9f9f9;
    width: calc(20% - 15px);
    min-width: 150px;
    box-sizing: border-box;
    cursor: pointer;
}

.persistencia-map-item p {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.small-leaflet-map {
    width: 100%;
    height: 150px;
    border: 1px solid #ccc;
}


/* Estilos para la leyenda de colores de los índices de sequía - Versión Vertical */
.chart-with-legend {
    display: flex;
    align-items: stretch;
    gap: 15px;
}

.chart-content {
    flex: 1;
    min-width: 0;
}

.indicator-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    margin-top: -39px;
}

.color-bar {
    width: 15px;
    height: 200px;
    position: relative;
    border: 2px solid #333;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1); /* Sombra interna para mejor definición */
    background: linear-gradient(0deg,
        #4A0E0E 0%,     /* < -3.0 - Café/rojo muy oscuro */
        #8B0000 7.69%,  /* -2.5 a -3.0 - Tonos rojos oscuros a café/rojo oscuro */
        #DC143C 15.38%, /* -2.0 a -2.5 - Tonos rojos */
        #FF4500 23.08%, /* -1.5 a -2.0 - Tonos naranjos */
        #FFA500 30.77%, /* -1.0 a -1.5 - Tonos amarillo fuerte a naranjos claro */
        #FFFF00 38.46%, /* -0.4 a -1.0 - Tonos amarillos */
        #F5F5F5 46.15%, /* -0.4 a +0.4 - Gris claro o blanco */
        #F5F5F5 53.85%, /* -0.4 a +0.4 - Gris claro o blanco */
        #90EE90 61.54%, /* 0.4 a 1.0 - Tonos verdes */
        #006400 69.23%, /* 1.0 a 1.5 - Tonos verde oscuro a azul claro */
        #4169E1 76.92%, /* 1.5 a 2.0 - Tonos azul oscuro a violeta */
        #8A2BE2 84.62%, /* 2.0 a 2.5 - Tonos violeta oscuro a magenta oscuro */
        #FF00FF 92.31%, /* 2.5 a 3.0 - Tonos magenta oscuro a magenta claro */
        #FF69B4 100%    /* > 3.0 - Tono magenta */
    );
}

.scale-labels {
    display: flex;
    flex-direction: column;
    height: 200px;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 10px;
    color: #333;
    padding-left: 5px;
}

.scale-labels span {
    line-height: 1;
    font-weight: 500;
}

/* Marcador central opcional en la barra */
.color-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 1px;
    background-color: #000;
    z-index: 1;
}

/* Responsive para la leyenda */
@media (max-width: 768px) {
    .chart-with-legend {
        flex-direction: column;
        gap: 10px;
    }
    
    .indicator-container {
        justify-content: center;
        margin: 10px 0;
    }
    
    .color-bar {
        width: 200px;
        height: 15px;
        background: linear-gradient(90deg,
            #8B0000 0%,     /* -3.0 - Rojo oscuro */
            #FF0000 7.69%,  /* -2.5 - Rojo */
            #FF4500 15.38%, /* -2.0 - Rojo-naranja */
            #FF8C00 23.08%, /* -1.5 - Naranja oscuro */
            #FFA500 30.77%, /* -1.0 - Naranja */
            #FFD700 38.46%, /* -0.5 - Dorado */
            #F5F5F5 46.15%, /* 0.0 - Gris muy claro (casi blanco) */
            #00FF00 53.85%, /* 0.5 - Verde */
            #00FF00 61.54%, /* 1.0 - Verde */
            #00CED1 69.23%, /* 1.5 - Turquesa */
            #0000FF 76.92%, /* 2.0 - Azul */
            #4169E1 84.62%, /* 2.5 - Azul real */
            #8A2BE2 100%    /* 3.0 - Violeta */
        );
    }
    
    .color-bar::before {
        left: 50%;
        top: -5px;
        bottom: -5px;
        width: 1px;
        height: auto;
        right: auto;
    }
    
    .scale-labels {
        flex-direction: row;
        justify-content: space-between;
        width: 200px;
        height: auto;
        margin-top: 5px;
        padding-left: 0;
        font-size: 8px;
    }
}
  
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-style: italic;
}

.export-button-container {
    text-align: right;
    margin-bottom: 20px;
}

.global-export-button-container {
    margin-top: 15px;
    margin-bottom: 25px;
    text-align: center;
}

#station-map-highcharts-container,
#climogram-chart-container-fijo {
    height: 420px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

#climogram-chart-container-dinamico {
    height: 380px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.map-loading-placeholder,
.chart-loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 150px;
    color: #888;
    font-style: italic;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

#select-station-prompt {
    height: 420px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 10px;
}

h1,
h5,
h6 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.subtitle-note {
    font-size: 0.85em;
    color: #555;
    margin-top: 5px;
    margin-bottom: 10px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.chart-container {
    position: relative;
    min-height: 300px;
    border: 1px solid #eee;
    margin-bottom: 10px;
}

.loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 10;
    font-style: italic;
    color: #555;
}

.export-button-container {
    text-align: right;
    margin-top: 5px;
    margin-bottom: 15px;
}

.btn-primary {
    color: #fff;
    background-color: #2D4356;
    border-color: #84A7A1;
}

.btn-primary:hover {
    color: #fff;
    background-color: #2d3556;
    border-color: #84a0a7;
}

.map-modal {
    display: none;
    /* Oculto por defecto */
    position: fixed;
    z-index: 2000;
    /* Asegurar que esté por encima de otros elementos */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    /* Fondo oscuro semitransparente */
    padding-top: 30px;
    /* Espacio para que no pegue al borde superior */
}

.map-modal-content {
    background-color: #fefefe;
    margin: auto;
    /* Centrado horizontalmente */
    padding: 20px;
    border: 1px solid #888;
    width: 85%;
    /* Ancho del contenido del modal */
    max-width: 900px;
    /* Ancho máximo */
    border-radius: 8px;
    position: relative;
}

.map-modal-close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.map-modal-close-button:hover,
.map-modal-close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#modalMapTitle {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
}

/* Media query para dispositivos con ancho máximo de 768px (móviles y tablets pequeñas) */
@media (max-width: 768px) {

    /*
   * Seleccionamos el panel de información cuando está en la esquina superior derecha
   * y le añadimos un margen superior para que no tape el control de zoom (+/-).
  */
    .leaflet-top.leaflet-right .info-panel-comuna {
        margin-top: 10px;
        /* Ajusta este valor si necesitas más o menos espacio */

    }

    .info-panel-comuna {
        max-width: 250px !important;
    }
}

/* Contenedor principal que usa Flexbox en modo columna */
.mapa-con-leyenda-container {
    display: flex;
    flex-direction: column;
    height: 85vh;
    /* Ajusta la altura total del componente (mapa + leyendas) */
    width: 100%;
}

/* Hace que el contenedor del mapa ocupe todo el espacio vertical disponible */
#map-clima-region-highcharts {
    flex-grow: 1;
    min-height: 300px;
    /* Altura mínima para evitar que desaparezca */
}

/* Contenedor para las dos leyendas en la parte inferior */
.leyendas-container {
    flex-shrink: 0;
    /* Evita que las leyendas se encojan */
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Contenedor para hacer las tablas responsive y con scroll */
.table-responsive-container {
    max-height: 250px;
    /* Altura máxima de las tablas */
    overflow-y: auto;
    border: 1px solid #dee2e6;
}

/* Cabecera de tabla pegajosa para que no se pierda al hacer scroll */
.table-responsive-container thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.map-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.map-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    height: 80%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-modal-close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

#modalMapTitle {
    margin-bottom: 15px;
    text-align: center;
}

.info-panel-comuna {
    max-width: 280px;
    background: rgba(255, 255, 255, 0.9);
}

.persistencia-map-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 15px;
}

.persistencia-map-item {
    text-align: center;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    background-color: #f9f9f9;
    width: calc(20% - 15px);
    min-width: 150px;
    box-sizing: border-box;
    cursor: pointer;
}

.small-leaflet-map {
    width: 100%;
    height: 150px;
    border: 1px solid #ccc;
}

.persistencia-legend {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

@media (max-width: 1200px) {
    .persistencia-map-item {
        width: calc(33.333% - 15px);
    }
}

@media (max-width: 768px) {
    .persistencia-map-item {
        width: calc(50% - 15px);
    }
}

@media (max-width: 576px) {
    .persistencia-map-item {
        width: calc(100% - 15px);
    }
}


.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-family: Arial, sans-serif;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.chart-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: chartSpin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes chartSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

.loading-subtitle {
    font-size: 12px;
    color: #6c757d;
}

.logo-with-border {
    width: 6.5rem;
    height: 3.80rem;
    background-color: rgba(160, 160, 189, 0.355);
    filter: drop-shadow(0 2px 7px rgba(176, 177, 223, 0.548));
    padding: 0.4rem
}

