.map-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

#mapViewer {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Botones flotantes izquierda */
.floating-buttons {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 480px) {
    .floating-buttons {
        top: 10px;
        left: 10px;
        gap: 6px;
    }
}

.button-group {
    position: relative;
    display: flex;
}

.control-btn {
    padding: 10px 15px;
    background: #F2F2F2;
    color: #333333 !important;
    border: 1px solid #ddd;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    width: 100%;
    text-align: start;
    min-height: 40px;
}

@media (max-width: 768px) {
    .control-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        font-size: 11px;
        padding: 8px 10px;
        min-height: 36px;
    }
}

.control-btn:hover {
    background: #f8f9fa !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    color: #333;
}

.control-btn.active, .control-boton:active, .control-boton:focus {
    background: #0F69C4 !important;
    color: white !important;
    border-color: #0F69C4 !important;
}

/* Paneles de herramientas - OCULTOS POR DEFECTO */
.tool-panel {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 0;
    min-width: 340px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001;
}

@media (max-width: 1024px) {
    .tool-panel {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .tool-panel {
        position: fixed;
        left: auto;
        right: 0;
        top: 0;
        bottom: 0;
        margin-left: 0;
        min-width: 100%;
        max-width: 85%;
        border-radius: 6px 0 0 6px;
        max-height: 100%;
    }
}

@media (max-width: 480px) {
    .tool-panel {
        min-width: 100%;
        max-width: 100%;
    }
}

.tool-panel.active {
    display: block;
}

/* Encabezado del panel con X de cerrar */
.panel-header {
    padding: 8px 16px;
    border-bottom: 1px solid #CCCCCC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F2F2F2;
    flex-shrink: 0;
}

.panel-header h4 {
    margin: 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    word-break: break-word;
    flex: 1;
}

@media (max-width: 768px) {
    .panel-header {
        padding: 12px;
    }
    
    .panel-header h4 {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .panel-header {
        padding: 10px;
    }
    
    .panel-header h4 {
        font-size: 12px;
    }
}

.close-panel-x {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #000;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-panel-x:hover {
    background-color: #e5e5e5;
    color: #333;
}

.close-panel-x:focus, .close-panel-x:active {
    background-color: #e5e5e5;
    color: #333;
}

/* Contenido del panel */
.panel-content {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

@media (max-width: 768px) {
    .panel-content {
        max-height: calc(100vh - 60px);
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .panel-content {
        padding: 10px;
    }
}

.panel-content p {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 13px;
}

.panel-content hr {
    margin-top: 0;
    margin-bottom: 15px;
    background-color: #E6E6E6;
}

.panel-description {
    color: #666666;
    font-size: 13px;
    margin-bottom: 15px;    
}

/* Estilos para los filtros de territorio */
.filter-group {
    margin-bottom: 15px;
    /* background-color: #d9d9d9;
    padding: 10px;
    border-radius: 4px; */
}

.filter-group label {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    margin-bottom: 5px;
    word-break: break-word;
}

.filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    transition: all 0.3s ease;
    background: white;
    min-height: 44px;
}

@media (max-width: 480px) {
    .filter-group {
        padding: 8px;
    }
    
    .filter-group label {
        font-size: 12px;
    }
    
    .filter-select {
        font-size: 12px;
        padding: 6px 10px;
    }
}

.filter-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Botones de acción de filtros */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 100px;
}

@media (max-width: 480px) {
    .filter-actions {
        gap: 8px;
        flex-direction: column;
    }
    
    .filter-btn {
        flex: 1 1 100%;
        padding: 8px;
        font-size: 12px;
    }
}

.search-btn, .search-btn:active, .search-btn:focus {
    background: #0051A8 !important;
    color: white !important;
}

.search-btn:hover {
    background: #005a87 !important;
}

.clear-btn {
    background: #6c757d;
    color: white;
}

.clear-btn:hover {
    background: #545b62;
}

/* Controles mapa derecha */
.map-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.map-controls button {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* asegurar centrado exacto */
}

@media (max-width: 480px) {
    .map-controls {
        top: 10px;
        right: 10px;
        gap: 3px;
    }
    
    .map-controls button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

.map-controls button:hover {
    background: #f8f9fa;
}

.map-controls button svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Sidebar meteorológico - OCULTO POR DEFECTO */
.weather-sidebar {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    max-height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1002;
    border-left: 1px solid #ddd;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .weather-sidebar {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .weather-sidebar {
        position: fixed;
        width: 85%;
        max-width: 85vw;
        left: 0;
        right: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        border-left: none;
        border-right: 1px solid #ddd;
    }
}

@media (max-width: 480px) {
    .weather-sidebar {
        width: 100%;
        max-width: 100%;
    }
}

.weather-sidebar.active {
    display: flex;
}

.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: transparent;
    cursor: col-resize;
    transition: background-color 0.2s ease;
}

.sidebar-resize-handle:hover {
    background-color: #007cba;
    box-shadow: inset 0 0 10px rgba(0, 124, 186, 0.3);
}

.sidebar-header {
    padding: 8px 16px;
    border-bottom: 1px solid #CCCCCC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F2F2F2;
    flex-shrink: 0;
}

.sidebar-header h4 {
    margin: 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #000;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-sidebar:hover {
    background-color: #e5e5e5;
    color: #333;
}

.sidebar-content {
    padding: 0;
    color: #333;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .sidebar-content {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .sidebar-content {
        padding: 10px;
    }
}

/* Asegurar que el mapa esté detrás de los controles */
.maplibre-gl-canvas {
    z-index: 1;
}

/* Estilos para el sistema de tabs */
.tabs-container {
    width: 100%;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 2px;
}

.tab-button {
    flex: 1;
    padding: 8px 5px;
    background: #f8f9fa;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 4px 4px 0 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .tab-button {
        padding: 8px 4px;
        font-size: 10px;
    }
}

.tab-button:hover {
    background: #e9ecef;
    color: #333;
}

.tab-button.active {
    background: #007cba;
    color: white;
    border-bottom-color: #007cba;
}

.tabs-content {
    margin-top: 10px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

.tab-pane h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Contenido de los tabs */
.tab-content-group {
    margin-bottom: 1px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
}

.tab-content-group label {
    display: block;
    font-weight: 500;
    color: #333;
    font-size: 12px;
    margin-bottom: 5px;
    word-break: break-word;
}

.tab-select, .tab-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    transition: all 0.3s ease;
    background: white;
    min-height: 40px;
}

@media (max-width: 480px) {
    .tab-content-group {
        padding: 8px;
    }
    
    .tab-content-group label {
        font-size: 11px;
    }
    
    .tab-select, .tab-input {
        font-size: 13px;
        padding: 8px 10px;
        min-height: 44px;
    }
}

.tab-select:focus, .tab-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Range input */
.tab-range {
    width: 100%;
    margin: 5px 0;
}

.range-value {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

/* Checkboxes */
.tab-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.tab-checkbox {
    margin: 0;
}

/* Botones de acción en tabs */
.tab-action-btn {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 10px;
    min-height: 44px;
}

@media (max-width: 480px) {
    .tab-action-btn {
        padding: 8px;
        font-size: 13px;
    }
}

.tab-action-btn:hover {
    background: #218838;
}

/* Animación */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Ajustar el ancho del panel para los tabs */
#vmeteo-panel {
    min-width: 420px;
}

@media (max-width: 1024px) {
    #vmeteo-panel {
        min-width: 380px;
    }
}

@media (max-width: 768px) {
    #vmeteo-panel {
        min-width: 100%;
        max-width: 85vw;
    }
}

@media (max-width: 480px) {
    #vmeteo-panel {
        min-width: 100%;
        max-width: 100%;
    }
}

/* Estilos para los popups de estaciones */
.station-popup {
    min-width: 200px;
}

.station-popup h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.station-info p {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
}

.station-info strong {
    color: #333;
}

.color-indicator {
    margin-top: 8px;
    border: 1px solid #ddd;
}

/* Leyenda de colores */
.map-legend {
    position: absolute;
    bottom: 80px;
    right: 15px;
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 200px;
}

@media (max-width: 480px) {
    .map-legend {
        bottom: 60px;
        right: 10px;
        max-width: 150px;
        padding: 8px;
    }
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 2px;
    border: 1px solid #ddd;
}

.legend-label {
    color: #666;
}

/* Estilos para chips horizontales compactos */
.chip-horizontal-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
}

.chip-horizontal-option {
    position: relative;
    flex: 1;
    min-width: 0; /* Permite que los chips se ajusten */
}

.chip-horizontal-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chip-horizontal-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-weight: 500;
    color: #555;
    user-select: none;
    text-align: center;
    height: 48px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-width: 70px;
}

.chip-horizontal-label:hover {
    border-color: #007cba;
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chip-horizontal-input:checked + .chip-horizontal-label {
    background: #e8f4fd;
    border-color: #007cba;
    color: #007cba;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
    transform: translateY(0);
}

.chip-horizontal-input:focus + .chip-horizontal-label {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.chip-horizontal-icon {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.chip-horizontal-text {
    font-size: 10px;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Indicador de selección más sutil */
.chip-horizontal-input:checked + .chip-horizontal-label::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #007cba;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Variante con colores diferentes para cada opción */
.chip-horizontal-option:nth-child(1) .chip-horizontal-input:checked + .chip-horizontal-label {
    background: #e8f6ef;
    border-color: #28a745;
    color: #28a745;
}

.chip-horizontal-option:nth-child(1) .chip-horizontal-input:checked + .chip-horizontal-label::after {
    background: #28a745;
}

.chip-horizontal-option:nth-child(2) .chip-horizontal-input:checked + .chip-horizontal-label {
    background: #fff3e6;
    border-color: #fd7e14;
    color: #fd7e14;
}

.chip-horizontal-option:nth-child(2) .chip-horizontal-input:checked + .chip-horizontal-label::after {
    background: #fd7e14;
}

.chip-horizontal-option:nth-child(3) .chip-horizontal-input:checked + .chip-horizontal-label {
    background: #f0e6ff;
    border-color: #6f42c1;
    color: #6f42c1;
}

.chip-horizontal-option:nth-child(3) .chip-horizontal-input:checked + .chip-horizontal-label::after {
    background: #6f42c1;
}

/* Estado activo para mejorar feedback táctil */
.chip-horizontal-label:active {
    transform: scale(0.96);
}

/* Estilos responsivos para pantallas pequeñas */
@media (max-width: 480px) {
    .chip-horizontal-group {
        gap: 6px;
    }
    
    .chip-horizontal-label {
        padding: 5px 8px;
        height: 44px;
        min-width: 60px;
        font-size: 10px;
    }
    
    .chip-horizontal-icon {
        font-size: 12px;
        width: 16px;
        height: 16px;
    }
    
    .chip-horizontal-text {
        font-size: 9px;
    }
}

/* Para asegurar que el contenedor no se desborde en paneles pequeños */
.tab-pane {
    overflow-x: hidden;
}

/* Estilos para chips ultra compactos */
.chip-ultra-compact-group, .date-control-group {
    display: flex;
    gap: 6px;
    /* margin-bottom: 10px; */
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
}

.chip-ultra-compact-option {
    position: relative;
    flex: 1;
    min-width: 100px;
}

@media (max-width: 768px) {
    .chip-ultra-compact-group, .date-control-group {
        gap: 4px;
    }
    
    .chip-ultra-compact-option {
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .chip-ultra-compact-group, .date-control-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .chip-ultra-compact-option {
        width: 100%;
        min-width: unset;
    }
}

.chip-ultra-compact-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chip-ultra-compact-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 8px;
    background: #ffffff;
    border: 1px solid #0F69C4;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    font-weight: 500;
    color: #0F69C4;
    user-select: none;
    height: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    min-width: 0;
    word-break: break-word;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .chip-ultra-compact-label {
        padding: 6px 10px;
        height: auto;
        min-height: 40px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .chip-ultra-compact-label {
        padding: 8px 12px;
        min-height: 44px;
        font-size: 12px;
    }
}

.chip-ultra-compact-label:hover {
    border-color: #0F69C4;
    background: #0F69C4;
    color: #ffffff;
    transform: translateY(-1px);
}

.chip-ultra-compact-input:checked + .chip-ultra-compact-label {
    background: #0F69C4;
    border-color: #0F69C4;
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(15, 105, 196, 0.2);
}

.chip-ultra-compact-icon {
    font-size: 12px;
    line-height: 1;
}

.chip-ultra-compact-text {
    font-size: 9px;
    line-height: 1.1;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 768px) {
    .chip-ultra-compact-text {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .chip-ultra-compact-text {
        font-size: 11px;
    }
}

/* Indicador de selección mínimo */
.chip-ultra-compact-input:checked + .chip-ultra-compact-label::before {
    content: "•";
    position: absolute;
    top: -3px;
    right: -3px;
    font-size: 8px;
    color: #0F69C4;
    background: white;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Contenedor principal del rango de fechas */
.date-range-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .date-range-container {
        padding: 12px;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .date-range-container {
        padding: 10px;
        border-radius: 4px;
    }
}

.date-range-header {
    margin-bottom: 12px;
    text-align: center;
}

.date-range-header h6 {
    margin: 0;
    color: #495057;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grupo de inputs de fecha */
.date-input-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .date-input-group {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .date-input-group {
        gap: 10px;
    }
}

/* Contenedor individual de cada input */
.date-input-wrapper {
    flex: 1;
    position: relative;
}

.date-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    flex-wrap: wrap;
}

.date-label-icon {
    font-size: 12px;
}

.date-label-text {
    font-size: 11px;
    font-weight: 500;
    word-break: break-word;
}

@media (max-width: 480px) {
    .date-label {
        font-size: 10px;
    }
    
    .date-label-text {
        font-size: 10px;
    }
}

/* Contenedor del input con icono */
.date-input-container {
    position: relative;
    width: 100%;
}

.styled-date-input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    background: #ffffff;
    border: 1.5px solid #dee2e6;
    border-radius: 6px;
    font-size: 12px;
    color: #495057;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: 1.4;
    min-height: 40px;
}

@media (max-width: 480px) {
    .styled-date-input {
        font-size: 13px;
        padding: 10px 30px 10px 10px;
        min-height: 44px;
    }
}

.styled-date-input:focus {
    outline: none;
    border-color: #0F69C4;
    box-shadow: 0 0 0 3px rgba(15, 105, 196, 0.1);
    background-color: #fff;
}

.styled-date-input:hover {
    border-color: #adb5bd;
}

/* Icono de calendario personalizado */
.date-input-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #6c757d;
    pointer-events: none;
    transition: color 0.2s ease;
}

.styled-date-input:focus + .date-input-icon {
    color: #007cba;
}

/* Separador entre fechas */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
    min-width: 30px;
}

.separator-line {
    color: #adb5bd;
    font-size: 14px;
    font-weight: bold;
}

/* Botones de presets de fecha */
.date-presets {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.date-preset-btn {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 32px;
}

.date-preset-btn:focus, .date-preset-btn:active {
    background-color: #0F69C4;
    color: #ffffff;
}

@media (max-width: 480px) {
    .date-preset-btn {
        flex: 1 1 calc(50% - 4px);
        padding: 8px 10px;
        font-size: 11px;
        min-height: 38px;
    }
}

.date-preset-btn:hover {
    background: #f8f9fa;
    border-color: #007cba;
    color: #007cba;
    transform: translateY(-1px);
}

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

/* Estilos para navegadores Webkit (Chrome, Safari, Edge) */
.styled-date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    color: transparent;
    background: transparent;
    cursor: pointer;
}

.styled-date-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.styled-date-input::-webkit-datetime-edit {
    color: #495057;
    font-size: 12px;
}

.styled-date-input::-webkit-datetime-edit-year-field,
.styled-date-input::-webkit-datetime-edit-month-field,
.styled-date-input::-webkit-datetime-edit-day-field {
    padding: 0;
}

/* Estilos para Firefox */
.styled-date-input::-moz-focus-inner {
    border: 0;
}

.styled-date-input {
    /* Firefox muestra un icono nativo que no podemos personalizar completamente */
}

/* Estados de validación */
.styled-date-input.invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.styled-date-input.invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Indicador de fecha actual */
.today-indicator {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: #007cba;
    color: white;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .date-input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .date-separator {
        padding: 0;
        transform: rotate(90deg);
        min-width: auto;
        height: 20px;
    }
    
    .date-presets {
        justify-content: flex-start;
    }
}

/* Animación sutil al cambiar fechas */
@keyframes dateChange {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

.date-input-container.changed .styled-date-input {
    animation: dateChange 0.3s ease;
}

/* Mejoras específicas para navegadores */
.styled-date-input::-webkit-inner-spin-button,
.styled-date-input::-webkit-clear-button {
    display: none;
}

.styled-date-input::-webkit-calendar-picker-indicator {
    opacity: 0;
    z-index: 100;
    cursor: pointer;
}

/* Para Firefox, ocultar el spinner */
.styled-date-input[type="date"] {
    -moz-appearance: textfield;
}

.styled-date-input[type="date"]::-moz-inner-spin-button,
.styled-date-input[type="date"]::-moz-clear-button {
    display: none;
}

/* Para Edge */
.styled-date-input::-ms-clear {
    display: none;
}

.styled-date-input::-ms-expand {
    display: none;
}

/* Estados de validación para inputs */
.styled-date-input.invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.styled-date-input.invalid:focus {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* Feedback visual para cambios inválidos */
.date-input-container.invalid-input .styled-date-input {
    border-color: #dc3545;
    animation: shake 0.5s ease-in-out;
}

/* Animación de shake para errores */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Estilo para presets activos */
.date-preset-btn.active {
    background-color: #e8f4fd !important;
    border-color: #0F69C4 !important;
    color: #0F69C4 !important;
    font-weight: 600 !important;
}

/* Mejorar el feedback de hover */
.date-preset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.vvm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(3px);
}

body.vvm-loading-active {
    overflow: hidden;
}

.vvm-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.vvm-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-radius: 50%;
    position: relative;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.15);
}

.vvm-loading-spinner::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #007cba 0%,
        #00a8ff 25%,
        #3288bd 50%,
        #66c2a5 75%,
        #007cba 100%
    );
    animation: vvm-spin-rotate 1.2s linear infinite;
    mask: linear-gradient(#fff 0 0) content-box, 
          linear-gradient(#fff 0 0);
    mask-composite: exclude;
    padding: 3px;
}

.vvm-loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Animación de giro fluido */
@keyframes vvm-spin-rotate {
    0% { 
        transform: rotate(0deg);
        filter: hue-rotate(0deg) saturate(1);
    }
    100% { 
        transform: rotate(360deg);
        filter: hue-rotate(360deg) saturate(1.2);
    }
}

/* Efecto de pulso para el spinner */
@keyframes vvm-spin-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 124, 186, 0.15);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(0, 124, 186, 0.25);
    }
}

/* Aplicar ambas animaciones */
.vvm-loading-spinner {
    animation: vvm-spin-pulse 2s ease-in-out infinite;
}

.vvm-loading-text {
    color: #333;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: vvm-pulse 1.5s ease-in-out infinite;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
}

.vvm-loading-subtext {
    color: #666;
    font-size: 12px;
    margin-top: 8px;
    font-weight: 400;
    opacity: 0.8;
}

@keyframes vvm-spin {
    0% { 
        transform: rotate(0deg) scale(0.95);
        border-top-color: #007cba;
    }
    50% { 
        transform: rotate(180deg) scale(1.05);
        border-top-color: #00a8ff;
    }
    100% { 
        transform: rotate(360deg) scale(0.95);
        border-top-color: #007cba;
    }
}

@keyframes vvm-pulse {
    0%, 100% { 
        opacity: 1;
        transform: translateY(0);
    }
    50% { 
        opacity: 0.7;
        transform: translateY(-2px);
    }
}

@keyframes vvm-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes vvm-fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
}

/* Efecto de partículas sutil */
.vvm-loading-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.vvm-loading-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(0, 124, 186, 0.3);
    border-radius: 50%;
    animation: vvm-particle-float 3s ease-in-out infinite;
}

@keyframes vvm-particle-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    50% {
        transform: translate(var(--tx, 20px), var(--ty, -20px)) scale(1.5);
        opacity: 0.5;
    }
}

/* Contenedor principal de la leyenda */
.vvm-map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 12px 14px;
    width: auto;
    max-width: 600px;
    z-index: 999;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Encabezado de la leyenda */
.vvm-legend-header {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vvm-legend-title {
    font-weight: 500;
    font-size: 11px;
    color: #2d3748;
    letter-spacing: 0.3px;
}

.vvm-legend-subtitle {
    font-size: 10px;
    color: #718096;
    font-weight: 400;
}

/* Contenedor del gradiente */
.vvm-legend-gradient-container {
    position: relative;
}

/* Barra de gradiente */
.vvm-legend-gradient {
    display: flex;
    max-height: 470px;
    min-height: 16px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.vvm-gradient-segment {
    flex: 1;
    height: auto;
    transition: filter 0.2s ease;
    cursor: help;
}

.vvm-gradient-segment:hover {
    filter: brightness(1.1);
}

/* Etiquetas de valores */
.vvm-legend-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 6px;
    padding: 0 2px;
    gap: 4px;
}

.vvm-legend-label {
    flex: 1;
    text-align: center;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.vvm-label-text {
    font-size: 10px;
    color: #5a6c7d;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
    padding: 0 2px;
    overflow: hidden;
    /* text-overflow: ellipsis; */
}

@media (max-width: 480px) {
    .vvm-label-text {
        font-size: 9px;
    }
}

/* Versión móvil (lista) */
.vvm-legend-mobile {
    display: none;
}

.vvm-legend-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #4a5568;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.vvm-legend-toggle:hover {
    background: #edf2f7;
    color: #2d3748;
}

.vvm-legend-toggle svg {
    transition: transform 0.2s ease;
}

.vvm-legend-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.vvm-legend-items.expanded {
    max-height: 200px;
}

.vvm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.vvm-color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.vvm-range-text {
    font-size: 11px;
    color: #4a5568;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .vvm-legend-rose {
        display:none;
    }

    .vvm-map-legend {
        left: 10px;
        right: 10px;
        bottom: 10px;
        min-width: auto;
        max-width: none;
        width: auto;
    }
    
    .vvm-legend-gradient {
        min-height: 20px;
        max-height: 40px;
    }
    
    .vvm-legend-gradient-container {
        display: block;
    }
    
    .vvm-legend-mobile {
        display: none;
    }
}

@media (max-width: 480px) {
    .vvm-legend-rose {
        display:none;
    }

    .vvm-map-legend {
        left: 8px;
        right: 8px;
        bottom: 40px;
        padding: 10px 12px;
        max-width: calc(100% - 16px);
    }
    
    .vvm-legend-header {
        margin-bottom: 6px;
    }
    
    .vvm-legend-title {
        font-size: 10px;
    }
    
    .vvm-legend-subtitle {
        font-size: 9px;
    }
    
    .vvm-legend-gradient {
        min-height: 18px;
        max-height: 30px;
    }
    
    .vvm-legend-labels {
        margin-top: 4px;
    }
}

/* Animación para mostrar/ocultar leyenda */
.vvm-legend-enter {
    animation: legendSlideIn 0.3s ease-out;
}

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

/* ========== SIDEBAR TABS STYLES ========== */

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 15px;
}

.tabs-header button:hover{
    background-color: #ccc;
}

.tab-btn {
    flex: 1;
    padding: 7px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #999;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 16px;
    position: relative;
}

.tab-btn.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
    background-color: #f0f4f8;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    padding: 10px;
}

/* Descriptor box styles */
#sidebar-descriptor {
    padding: 10px 15px;
    background-color: #f0f4f8;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #555;
}

#descriptor-text {
    margin: 0;
}

/* Chart container */
#sidebar-chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Loading and error states */
#sidebar-loading,
#sidebar-error {
    text-align: center;
    padding: 20px;
    display: none;
}

#sidebar-error {
    color: #d32f2f;
}

/* Alerts container */
#sidebar-alerts-container {
    padding: 15px;
}

/* Alert item styles */
.alert-item {
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.alert-type-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-item-title {
    margin: 0;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.alert-item-description {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.alert-placeholder {
    text-align: center;
    color: #4caf50;
    font-size: 14px;
    padding: 30px 20px;
    background-color: #f1f8f4;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    font-weight: 500;
}

/* Alert badge for tabs */
.alert-badge {
    position: absolute;
    top: 11px;
    right: 40px;
    width: 16px;
    height: 16px;
    background-color: #d32f2f;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: block;
    animation: alertPulse 2s infinite;
}

@keyframes alertPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(211, 47, 47, 0);
    }
}