@font-face {
    font-family: 'DS-Digital';
    src: url('assets/fonts/DS-DIGII.TTF') format('truetype');
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden; 
    overflow-y: hidden; 
    align-items: center; 
}

header {
    position: relative;
    overflow: hidden;
    background-color: #004d99;
    color: white;
    padding: 0; 
    box-shadow: 0 5px 5px rgba(0,0,0,0.4);
    width: 100%;    
    min-height: 120px; 
    z-index: 10000;
}

/* Contenedor Normal (Logos y Relojes) */
.header-normal-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: #004d99;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* Contenedor de Notificación (Oculto abajo inicialmente) */
.header-notification-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #c20d00 0%, #ff4d4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    z-index: 101;
}

/* --- CLASE ACTIVA (EL EFECTO GARAGE) --- */
/* Cuando el header tiene la clase .alert-mode: */
header.alert-mode .header-normal-content {
    transform: translateY(-100%);
}

header.alert-mode .header-notification-overlay {
    transform: translateY(-100%);
}

/* --- TEXTO GIGANTE Y MARQUESINA --- */
.large-marquee-wrapper {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

#large-notification-text {
    display: inline-block;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 3.5em;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
    padding-left: 100%; 
}

/* Animación de desplazamiento */
@keyframes large-scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


header .logo-left,
header .logo-right {
    width: 180px; 
    display: flex;
    align-items: center; 
}

header .logo-left {
    justify-content: flex-start; 
}

header .logo-right {
    justify-content: flex-end; 
}

header .logo-left img,
header .logo-right img {
    height: 70px;
    max-width: 100%; 
    object-fit: contain;
}

/* Contenedor para el título principal y el banner de alerta */
.header-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    margin: 0 10px;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
    text-align: center;
}

/* --- ESTILOS PARA EL BANNER DE ALERTA DE CALIDAD DEL AIRE --- */
#header-alert-banner {
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    color: #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.5s ease-in-out;
}

#header-alert-banner.hidden {
    display: none;
}

/* Colores para los estados de alerta del banner */
#header-alert-banner.status-alerta { background-color: #ffee58; }
#header-alert-banner.status-preemergencia { background-color: #ff9800; }
#header-alert-banner.status-emergencia { background-color: #c20d00; }

/* Animación de parpadeo */
@keyframes pulse-animation {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}
.blinking-alert {
    animation: pulse-animation 1.5s infinite;
}

/* REGLA PARA EL CUADRO DE INFORMACIÓN FIJO */
.informe-header-fijo {
    background-color: #d7eaf8; 
    color: #333;
    padding: 10px 20px; 
    margin: 0 auto;
    width: 100%; 
    max-width: 1350px; 
    box-sizing: border-box; 
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 1.1em;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    align-items: center; 
}

.informe-header-fijo p {
    margin: 5px 10px; 
}

main {
    flex-grow: 1;
    padding: 20px;
    max-width: 1350px;
    width: 100%; 
    margin: 8px auto 20px auto;
    background-color: white;
    box-shadow:
    /*superior*/
    0px -1px 1px rgba(0,0,0,0.2),
    /*inferior*/
    0px 1px 3px rgba(0,0,0,0.4),
    /*izquierda*/
    -1px 0px 3px rgba(0,0,0,0.4),
    /*derecha*/
    1px 0px 3px rgba(0,0,0,0.4),
    /*interior*/
    inset 1px 1px 3px rgba(0,0,0,0.4); 
    border-radius: 8px;
    position: relative;
    min-height: 60vh;
    display: block;
    box-sizing: border-box; 
    border-left: 2px solid #007bff; 
    border-right: 2px solid #007bff;
}

.slide {
    padding: 0; 
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden; 
    -webkit-overflow-scrolling: touch;

    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
    visibility: hidden;

    /* --- Contenedor Flexbox para centrar contenido --- */
    display: flex;
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
}

.slide.active {
    display: flex; /* También debe ser flex cuando está activo */
    opacity: 1;
    pointer-events: auto;
    position: relative;
    visibility: visible;
}

/* --- Contenedores internos de los slides (para darles padding y centrar texto) --- */
/* Se aplica a todos los hijos directos de .slide para que hereden el centrado de .slide */
.slide > h2,
.slide > table,
/* .slide > .informe-header, <-- Esta regla ya no necesita el .informe-header */
.slide > .uv-info,
.slide > .image-slide-content,
.slide > p {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: left;
}

.informe-header {
    background-color: #e0f2f7;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 1.1em;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    padding: 10px 0;
}

h2 {
    color: #004d99;
    border-bottom: 2px solid #004d99;
    padding-bottom: 8px;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 1.6em;
    /* text-align: center; /* Ya lo maneja el selector .slide > h2 */
}

table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-bottom: 15px;
}

th {
    background-color: #f2f2f2;
    color: #555;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* --- AJUSTAR ANCHO DE COLUMNAS SEGÚN CONTENIDO --- */
.table-layout-auto {
    table-layout: auto;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    vertical-align: top;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

/* justificar el texto en párrafos largos */
.text-justify {
    text-align: justify;
}

/* centrar contenido tanto vertical como horizontalmente */
.v-align-middle {
    vertical-align: middle;
    text-align: center;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #eef;
}

#table-emergencias th:nth-child(4),
#table-emergencias td:nth-child(4) {
    width: 40%;
}
#table-alertas th:nth-child(2),
#table-alertas td:nth-child(2) {
    width: 30%;
}

#table-alertas tbody tr td:first-child {
    font-weight: bold;
    text-align: center;
}

.alerta-temprana-preventiva {
    background-color: #d4edda;
    color: #155724;
}

.alerta-amarilla {
    background-color: #fff3cd;
    color: #856404;
}

.alerta-roja {
    background-color: #f8d7da;
    color: #721c24;
}

.uv-info {
    margin-top: 15px;
    margin-bottom: 25px;
    padding: 15px 20px;
    background-color: #e6f7ff;
    border-left: 5px solid #0066cc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.uv-info .uv-icon {
    height: 150px;
    width: auto;
    flex-shrink: 0;
}

.uv-info .uv-text-content {
    flex-grow: 1;
}

.uv-info p {
    margin: 8px 0;
    font-size: 1.2em;
    line-height: 1.4;
}
.uv-info p:last-child {
    margin-bottom: 0;
}
.uv-info strong {
    color: #004d99;
    margin-right: 5px;
}

/* --- ESTILOS PARA SLIDES DINÁMICAS --- */
.dynamic-image-slide {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.95);
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.dynamic-image-slide .image-slide-content {
    max-width: 90%;
    width: fit-content;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    text-align: center;    
}

.dynamic-image-slide .responsive-image {
    max-width: 100%;
    max-height: 65vh;
    width: auto;
    height: auto;
    display: block;
    margin: auto;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 5px;
    object-fit: contain;
}

.dynamic-image-slide h2,
.dynamic-image-slide p {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.dynamic-image-slide h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #004d99;
    border-bottom: none;
}

.dynamic-image-slide p {
    font-size: 1.2em;
    color: #555;
    max-width: 80%;
    margin-top: 15px;
    margin-bottom: 0;
}

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1px 0;
    margin-top: auto;
    font-size: 0.7em;
    width: 100%;
    box-sizing: border-box; 
}

/* --- ESTILOS PARA LAS HORAS DEL SHOA --- */
.header-clock {
    text-align: center;
    margin: 0 20px;
    min-width: 225px;
}

/* Ajustes responsivos para pantallas más pequeñas */
@media (max-width: 768px) {
    .shoa-clocks-container {
        flex-direction: column;
        align-items: center;
    }
    .shoa-clock-item {
        max-width: 90%; 
    }
}

/* --- ESTILOS PARA SIDEBARS DEL CLIMA --- */
.weather-sidebar {
    position: fixed;
    top: 150px;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

#weather-sidebar-left {
    left: 20px;
}

#weather-sidebar-right {
    right: 20px;
}

.weather-station-box {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-top: 2px solid #007bff;
    border-bottom: 2px solid #007bff;
    padding: 15px;
    border-radius: 8px;
    box-shadow:
    /*superior*/
    0px -1px 1px rgba(0,0,0,0.2),
    /*inferior*/
    0px 1px 3px rgba(0,0,0,0.4),
    /*izquierda*/
    -1px 0px 3px rgba(0,0,0,0.4),
    /*derecha*/
    1px 0px 3px rgba(0,0,0,0.4),
    /*interior*/
    inset 1px 1px 3px rgba(0,0,0,0.4); 
    backdrop-filter: blur(5px);
}

.weather-station-box h4 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #004d99;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.weather-station-box p {
    margin: 0px 0;
    font-size: 0.85em;
    line-height: 1.4;
}

.weather-station-box p strong {
    color: #333;
}

/* --- ESTILOS PARA LA HORA DE ACTUALIZACIÓN DE ESTACIONES --- */
.station-update-time {
    font-size: 0.8em;
    font-style: italic;
    color: #333;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 2px 5px;
    border-radius: 3px;
    text-align: right;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 5px;
    margin-bottom: 0;
}

/* --- ESTILO PARA EL CONTENEDOR DEL MAPA --- */
#air-quality-map-container {
    width: 100%;
    height: 65vh;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Ajuste para que no se solape con el header en pantallas pequeñas */
@media (max-width: 1200px) {
    .weather-sidebar {
        display: none; 
    }
}

/* --- ESTILOS PARA LA LEYENDA DEL MAPA DE CALIDAD DEL AIRE --- */
.info.legend {
    padding: 10px 15px;
    font-family: Arial, sans-serif;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 5px;
    display: flex; 
    flex-direction: row; 
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 15px; 
    text-transform: capitalize; 
}

.legend-item:last-child {
    margin-right: 0; 
}

.legend-item i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.3);
    flex-shrink: 0;
}
/* --- ESTILO PARA FUENTE DE DATOS --- */
.data-source {
    width: 100%;
    text-align: center;
    font-size: 0.85em;
    font-style: italic;
    color: #6c757d; 
    margin-top: 1px; 
    margin-bottom: 0px; 
    padding: 0 20px;
    box-sizing: border-box;
}
/* --- Estilo para la fuente de la información en las estaciones meteorológicas --- */
.station-source {
    font-size: 0.7em;     
    font-style: italic;    
    color: #6c757d;      
    text-align: right;     
    margin-top: 2px;       
    margin-bottom: 0;
    padding: 0;
    border: none;
}

/* --- ESTILOS PARA EL LAYOUT DEL MAPA Y PANEL DE ALERTA --- */
/* Contenedor principal que usa Flexbox para dividir el espacio */
#air-quality-main-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 65vh;
    gap: 20px;
    margin-bottom: 10px;
}

#air-quality-map-container {
    flex: 3; 
    height: 100%;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#air-quality-alert-panel {
    flex: 1;
    height: 100%;
    background-color: #f4f7f9;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto; 
    border: 1px solid #e0e0e0;
    box-sizing: border-box; 
    scrollbar-width: none;
}

#air-quality-alert-panel {
    flex: 1;
    height: 100%;
    background-color: #f4f7f9;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    box-sizing: border-box; 
    scrollbar-width: none;
}

/* Estilo para cada estación listada en el panel */
.alert-station-item {
    background-color: #fff;
    padding: 8px; 
    border-radius: 6px;
    margin-bottom: 8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 6px solid;
}

/* Colores del borde izquierdo según el estado de la alerta */
.status-border-alerta { border-left-color: #ff9800; }
.status-border-preemergencia { border-left-color: #f44336; }
.status-border-emergencia { border-left-color: #9c27b0; }

.alert-station-item h4 {
    margin: 0 0 4px 0;
    font-size: 1.0em;
}

.alert-station-item p {
    margin: 2px 0;
    font-size: 0.85em;
    line-height: 1.3;
}
.alert-station-item p strong {
    text-transform: capitalize;
}

.alert-station-item hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 5px 0;
}

/* Mensaje cuando no hay alertas */
.no-alerts-message {
    text-align: center;
    color: #666;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.no-alerts-message h4 {
    margin: 0;
    font-size: 1.2em;
    color: #4caf50;
}
#air-quality-alert-panel::-webkit-scrollbar {
    display: none;
}
/* --- ESTILOS PARA RELOJ DIGITAL --- */
.header-clock {    
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-clock h3 {
    font-size: 0.8em;
    color: #cce7ff;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 8px;
    text-align: center;
}

.led-clock {
    display: inline-flex; 
    align-items: center; 
    background-color: #242323;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 15px;
    padding-right: 15px;
    border-radius: 25px;
    box-shadow: 0 2px 5px rgba(110, 110, 110, 0.3), inset 0 0 6px rgba(0, 255, 43, 0.5);
}

/* Estilo para cada dígito individual */
.digit {
    font-family: 'DS-Digital', sans-serif;
    color: #4CAF50;
    font-size: 3.0em;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
    width: 28px;
    text-align: center;
}

/* Estilo para los dos puntos separadores */
.separator {
    font-family: 'DS-Digital', sans-serif;
    color: #4CAF50;
    font-size: 3.5em;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
    animation: blink 1s step-end infinite;
    width: 18px;
    text-align: center;
}

/* Animación de parpadeo */
@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* --- ESTILOS ESPECÍFICOS PARA DASHBOARD.HTML --- */

/* --- ESTILOS PARA CARRUSEL CENTRAL DEL DASHBOARD --- */

#central-carousel-container {
    position: relative;
    overflow: hidden;
    height: 100%;
}

#central-carousel-container.static-mode {
    display: flex;
    gap: 15px;
}

.central-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out;
    display: flex; 
    gap: 15px;
}

.central-slide.active-central-slide {
    opacity: 1;
    visibility: visible;
    position: relative; 
}

/* Estilos específicos para el slide de imágenes dinámicas */
.central-slide.dynamic-image-slide {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    /* Se mantiene como flex para centrar su contenido */
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* --- AJUSTE CLAVE 1 --- */
/* Hacemos que el contenedor del contenido ocupe todo el alto
   y sea un flex-container para organizar el título, la imagen y la descripción. */
.dynamic-image-slide .image-slide-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%; /* Ocupa el 100% de su padre (.central-slide) */
    width: 100%;
    text-align: center;
}

/* --- AJUSTE CLAVE 2 --- */
/* El título y la descripción no deben crecer ni encogerse, ocupan su espacio natural. */
.dynamic-image-slide h2,
.dynamic-image-slide p { /* Asumimos que la descripción está en un <p> */
    flex-shrink: 0;
}
.dynamic-image-slide h2 {
 color: #004d99;
 margin-bottom: 15px;
}


/* --- AJUSTE CLAVE 3 --- */
/* La imagen es ahora la que se adapta al espacio sobrante. */
.dynamic-image-slide .responsive-image {
    max-width: 100%;
    /* Se elimina 'max-height: 70vh' y se reemplaza con esto: */
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    /* Un truco de flexbox para que las imágenes grandes se encojan correctamente */
    min-height: 0;
}

/* 1. Body como contenedor flex de pantalla completa */
body.dashboard-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    overflow-y: hidden; /* Previene el scroll principal */
    background-color: #f0f2f5;
}

/* 2. Elementos que no se encogen */
body.dashboard-body header,
body.dashboard-body footer {
    flex-shrink: 0;
}

/* 3. Banner del clima */
.weather-banner {
    display: flex; /* Activa el layout flexible */
    justify-content: space-around; /* Distribuye las estaciones horizontalmente */
    align-items: stretch; /* Asegura que todas tengan la misma altura */
    flex-wrap: wrap; /* Permite que se ajusten si no hay espacio */
    gap: 10px;
    padding: 10px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 8px 5px;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
}

.weather-banner .weather-station-box {
    flex: 1;
    min-width: 205px;
    max-width: 220px;
    border: 1px solid #e0e0e0;    
    padding: 10px 10px 5px 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow:
    /*superior*/
    0px -1px 1px rgba(0,0,0,0.2),
    /*inferior*/
    0px 1px 3px rgba(0,0,0,0.4),
    /*izquierda*/
    -1px 0px 3px rgba(0,0,0,0.4),
    /*derecha*/
    1px 0px 3px rgba(0,0,0,0.4),
    /*interior*/
    inset 1px 1px 3px rgba(0,0,0,0.4); 
}

/* 4. Grid principal que crece para llenar el espacio */
main.dashboard-grid {    
    display: grid;
    grid-template-columns: 0.5fr 1.2fr 0.8fr; 
    gap: 15px;
    padding: 0 5px 15px 5px;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;

    /* --- Líneas para ANULAR los estilos de la regla 'main' genérica --- */
    max-width: none;
    margin: 0;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    border: none;
    position: static;
}

/* 5. Columnas y Paneles */
.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    min-width: 0;
}

.dashboard-panel {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow:
    /*superior*/
    0px -1px 1px rgba(0,0,0,0.2),
    /*inferior*/
    0px 1px 3px rgba(0,0,0,0.4),
    /*izquierda*/
    -1px 0px 3px rgba(0,0,0,0.4),
    /*derecha*/
    1px 0px 3px rgba(0,0,0,0.4),
    /*interior*/
    inset 1px 1px 3px rgba(0,0,0,0.4); 
    display: flex;
    flex-direction: column;
    flex-grow: 0;
    flex: 1;
    min-height: 0;
}

.dashboard-panel h3 {
    margin-top: 0;
    font-size: 1.4em;
    color: #004d99;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* 6. Contenido de Paneles específicos */
#air-quality-map-container-dashboard {
    flex-grow: 1;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#air-quality-alert-panel-dashboard {
    flex-shrink: 0;
    overflow-y: auto;
    margin-top: 15px;
    max-height: 25vh;
}

#air-quality-alert-panel-dashboard h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

/* 7. Listas y contenido con scroll interno */
.dashboard-list,
#novedades-content {
    overflow-y: auto;
}

.dashboard-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.dashboard-list li {
    padding: 10px 5px;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.5;
}

.dashboard-list li:last-child {
    border-bottom: none;
}

/* 8. Panel Novedades Header (CORREGIDO) */

.novedades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.novedades-header h3 {
    border: none;
    margin: 0;
    padding: 0;
}

.novedades-header #informe-correlativo {
    font-weight: bold;
    font-size: 1.1em;
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
}

#novedades-content {
    font-size: 1.1em;
    line-height: 1.6;
    white-space: pre-wrap;
    flex-grow: 1;
}

/* --- ESTILOS PARA LA MARQUESINA DE CALIDAD DEL AIRE --- */
/* Contenedor principal que reemplaza el antiguo panel de alertas */
#air-quality-alert-panel-dashboard {
    flex-shrink: 0;
    flex-grow: 0;
    margin-top: 15px;
    height: 45px; /* Altura fija para la barra de la marquesina */
    background-color: #e9ecef;
    border-radius: 5px;
    border: 1px solid #ced4da;
    display: flex;
    align-items: center;
    overflow: hidden; /* Oculta el texto que se sale del contenedor */
}

/* Contenedor del texto dentro de la barra */
.marquee-container {
    width: 100%;
    white-space: nowrap; /* Evita que el texto se parta en varias líneas */
    overflow: hidden;
}


.marquee-text {
    display: inline-block;
    padding-left: 100%; /* Inicia justo fuera de la vista a la derecha */
    animation: marquee-scroll 20s linear infinite;
    font-size: 1.1em;
    color: #343a40;
}

.marquee-text strong {
    color: #000;
}

/* La animación de desplazamiento */
@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


#air-quality-alert-panel-dashboard h4 {
    display: none;
}

/* --- ESTILOS PARA ALERTAS EN DASHBOARD --- */
.dashboard-list li.alerta-temprana-preventiva {
    background-color: #d4edda;
    color: #155724;
    border-left: 5px solid #28a745;
    padding-left: 10px;
    font-weight: bold;
}
.dashboard-list li.alerta-amarilla {
    background-color: #fff3cd;
    color: #856404;
    border-left: 5px solid #ffc107;
    padding-left: 10px;
    font-weight: bold;
}
.dashboard-list li.alerta-roja {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 5px solid #dc3545;
    padding-left: 10px;
    font-weight: bold;
}

#novedades-content p {
    margin: 5px 0;
    padding: 5px;
    border-bottom: 1px solid #f0f0f0;
}
#novedades-content p:last-child {
    border-bottom: none;
}

/* --- ESTILOS PARA CARRUSEL DE MAPAS --- */
/* Contenedor principal del carrusel */
#map-carousel-container {
    flex-grow: 1;
    position: relative; /* Clave para posicionar los slides dentro */
    width: 100%;
    min-height: 300px; /* Asegura una altura mínima */
}

/* Estilo para cada slide de mapa */
.map-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Oculto por defecto */
    visibility: hidden;
    transition: opacity 0.7s ease-in-out;
    background-color: #f0f0f0; /* Color de fondo mientras carga */
    border-radius: 5px;
}

/* Estilo para el slide ACTIVO */
.map-slide.active-map-slide {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* Asegura que los contenedores de mapa internos llenen el slide */
#air-quality-map-container-dashboard,
#precipitation-map-container-dashboard {
    width: 100%;
    height: 100%;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Controles del carrusel */
#map-carousel-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px; /* Espacio sobre los botones */
    flex-shrink: 0;
}

#map-carousel-controls button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#map-carousel-controls button:hover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
}

#map-pause-play-btn.paused {
    background-color: #d4edda; /* Verde cuando está en modo "Reanudar" */
    border-color: #c3e6cb;
}

.precipitation-label {
    background-color: transparent;
    border: none;
    box-shadow: none;
    font-weight: bold;
    font-size: 12px;
    color: #000000;
    text-shadow: 1px 1px 2px #ffffff, -1px -1px 2px #ffffff, 1px -1px 2px #ffffff, -1px 1px 2px #ffffff;
}

/* --- ESTILOS PARA RESALTADO DE AVISOS EN DASHBOARD --- */
.dashboard-list strong {
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
    margin-right: 5px;
    display: inline-block; /* Permite aplicar padding y border-radius */
}

/* VERDE para Avisos */
.dashboard-list .aviso-aviso {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* AMARILLO para Alertas */
.dashboard-list .aviso-alerta {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ROJO para Alarmas */
.dashboard-list .aviso-alarma {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* AZUL para Marejadas */
.dashboard-list .aviso-marejadas {
    background-color: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

/* --- ESTILOS PARA CARRUSEL DE AVISOS Y SCROLL VERTICAL --- */

/* --- 1. Título dinámico --- */
.dynamic-title span {
    transition: all 0.4s ease-in-out;
    color: #6c757d; /* Color gris para títulos inactivos */
    font-weight: normal;
    padding: 2px 0;
}

.dynamic-title span.active-title {
    color: #0056b3; /* Color azul fuerte para el título activo */
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 86, 179, 0.3);
    border-bottom: 2px solid #0056b3;
}

/* --- 2. Contenedor del carrusel de avisos --- */
#avisos-list-container {
    position: relative;
    flex-grow: 1; /* Ocupa el espacio disponible en el panel */
    overflow: hidden;
    width: 100%;
}

/* --- 3. Diapositivas del carrusel de avisos --- */
.aviso-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1); /* Animación de deslizamiento suave */
    /* Se añade el efecto de fade vertical */
    -webkit-mask-image: linear-gradient(transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(transparent, black 10%, black 90%, transparent);
}

/* --- ESTILOS PARA SCROLL VERTICAL EN PANEL DE ALERTAS --- */
#alertas-list-container {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    
    /* La máscara que crea el efecto de desvanecimiento (fade) en los bordes */
    -webkit-mask-image: linear-gradient(transparent, black 1%, black 98%, transparent);
    mask-image: linear-gradient(transparent, black 2%, black 98%, transparent);
}

/* --- 4. Estilos para el scroll vertical DENTRO de una diapositiva --- */
.is-scrolling .dashboard-list {
    /* Animación de desplazamiento vertical */
    animation: vertical-scroll linear infinite;
}

@keyframes vertical-scroll {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
}

/* --- 5. Estilos para el resaltado de títulos dentro de la lista --- */
.dashboard-list strong[class^="aviso-"] {
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
    margin-right: 5px;
    display: inline-block;
    border: 1px solid transparent;
}

.aviso-avisos {
    background-color: #d4edda; color: #155724; border-color: #c3e6cb;
}
.aviso-alertas {
    background-color: #fff3cd; color: #856404; border-color: #ffeeba;
}
.aviso-alarmas {
    background-color: #f8d7da; color: #721c24; border-color: #f5c6cb;
}
.aviso-marejadas {
    background-color: #cfe2ff; color: #084298; border-color: #b6d4fe;
}

/* --- AJUSTE AL DEGRADADO DEL CARRUSEL DE AVISOS --- */
.aviso-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
    
    -webkit-mask-image: linear-gradient(transparent, black 2%, black 98%, transparent);
    mask-image: linear-gradient(transparent, black 2%, black 98%, transparent);
}

/* --- ESTILOS PARA LOS CONTROLES DEL CARRUSEL DE AVISOS --- */
#avisos-carousel-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
    flex-shrink: 0;
}

#avisos-carousel-controls button {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    width: 35px;
    height: 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#avisos-carousel-controls button:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

#avisos-carousel-controls button.paused {
    background-color: #e2e6ea;
}

/* --- ESTILOS PARA PANEL DE WAZE --- */
#waze-incidents-container {
    flex-grow: 1;
    overflow-y: auto;

    -webkit-mask-image: linear-gradient(black 90%, transparent);
    mask-image: linear-gradient(black 90%, transparent);
}

.waze-list {
    padding-right: 10px;
}

.waze-incident-item {
    display: flex;
    flex-direction: column;
    padding: 12px 5px;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.0;
}

.waze-incident-item .waze-street {
    font-weight: bold;
    font-size: 1.0em;
    color: #333;
}

.waze-incident-item .waze-city {
    font-size: 0.95em;
    color: #555;
}

.waze-incident-item .waze-time {
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
    text-align: right;
}

.no-waze-incidents {
    font-size: 1.1em;
    color: #155724;
    text-align: center;
    padding-top: 20px;
}

.no-waze-container {
    display: flex;
    flex-direction: column; /* Apila el texto y el GIF verticalmente */
    justify-content: center; /* Centra verticalmente */
    align-items: center;   /* Centra horizontalmente */
    height: 100%;          /* Ocupa toda la altura del panel */
    text-align: center;
}

/* --- ESTILOS PARA PANEL DE WAZE --- */

/* Contenedor principal del carrusel de Waze */
#waze-incidents-container {
    flex-grow: 1;
    overflow: hidden;
    position: relative; /* Necesario para posicionar los slides */
}

/* Estilo para cada slide/página del carrusel */
.waze-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
    padding-right: 10px;
}

/* Nuevo contenedor para la primera línea (Calle y Comuna) */
.waze-incident-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.waze-incident-item .waze-street {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    text-align: left;
}

.waze-incident-item .waze-city {
    font-size: 0.9em;
    color: #555;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Controles del carrusel de Waze (similar a los de Avisos) */
#waze-carousel-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
    flex-shrink: 0;
}

#waze-carousel-controls button {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    width: 35px;
    height: 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#waze-carousel-controls button:hover {
    background-color: #e9ecef;
}

#waze-carousel-controls button.paused {
    background-color: #e2e6ea;
}

/* --- ESTILOS PARA EL ENLACE DEL MAPA DE WAZE --- */
.waze-map-link {
    text-decoration: none;
    font-size: 1.5em;
    margin-right: 12px;
    transition: transform 0.2s ease-in-out;
    cursor: pointer;
}

.waze-map-link:hover {
    transform: scale(1.25);
}

/* Ajuste al header del incidente para alinear correctamente el nuevo ícono */
.waze-incident-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* --- ESTILOS PARA ESTADO DE PASO FRONTERIZO --- */
.weather-box-footer {
    display: flex;
    justify-content: space-between; /* Alinea los elementos a los extremos */
    align-items: center;
    margin-top: 8px;
    padding-top: 5px;
    border-top: 1px solid #eee; /* Línea separadora */
}

.pass-status {
    font-weight: bold;
    font-size: 0.9em;    
    background-color: rgba(255, 255, 255, 0.7);
    padding: 2px 5px;
    border-radius: 3px;    
}

/* Clases para colorear solo la palabra del estado */
.status-habilitado {
    color: #28a745; /* Verde */
}

.status-cerrado {
    color: #dc3545; /* Rojo */
}

.status-no-informado {
    color: #6c757d; /* Gris */
}

/* Ajuste a la hora para que conviva en el footer */
.station-update-time {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.8em !important;
}

/* Esta regla se aplica a las tarjetas del dashboard */
.dashboard-panel {
    border-top: 3px solid #0051ff;
    border-bottom: 3px solid #0051ff;
    box-shadow:
    /*superior*/
    0px -1px 1px rgba(0,0,0,0.2),
    /*inferior*/
    0px 1px 3px rgba(0,0,0,0.4),
    /*izquierda*/
    -1px 0px 3px rgba(0,0,0,0.4),
    /*derecha*/
    1px 0px 3px rgba(0,0,0,0.4),
    /*interior*/
    inset 1px 1px 3px rgba(0,0,0,0.4); 
}

/* Esta regla se aplica a las tarjetas más pequeñas del banner meteorológico */
.weather-banner .weather-station-box {
    border-left: 1px solid #0051ff;
    border-right: 1px solid #0051ff;
}

/* --- Estilo para datos de precipitación anterior en el mapa del dashboard --- */
.precipitation-label {
    text-align: center;
    line-height: 1.1;
}

.precipitation-label .precip-anterior {
    font-size: 0.8em;
    font-weight: normal;
    color: #333;
}

/* --- ANIMACIÓN PARA ENCABEZADO TIPO BANDERA --- */
header {
    position: relative;
    overflow: hidden;
}

header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0) 60%
    );
    background-size: 200% 100%;

    animation: wave-animation 7s linear infinite;
}

header > * {
    position: relative;
    z-index: 2;
}

@keyframes wave-animation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* --- ANIMACIÓN PARA EL CHECK DE WAZE --- */
.no-waze-incidents .checkmark-icon {
    display: inline-block;
    animation: slow-pulse 4s ease-in-out infinite;
}

@keyframes slow-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* --- CORRECCIÓN DE COLOR PARA TEXTO DEL BANNER DEL CLIMA --- */
.weather-banner .weather-station-box,
.weather-banner .weather-station-box p,
.weather-banner .weather-station-box strong,
.weather-banner .weather-station-box .pass-status,
.weather-banner .weather-station-box .station-update-time {
    color: #333 !important;
}

.weather-banner .weather-station-box h4 {
    color: #004d99 !important;
} 

/* --- TRANSICIÓN REFORZADA PARA EL BANNER DEL CLIMA --- */
.weather-banner {
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
}

.weather-banner.fading-out {
    opacity: 0;
}

/* --- ANIMACIÓN ONDULANTE PARA BORDE INFERIOR DEL HEADER --- */
header::before {
    content: '';
    position: absolute;
    z-index: 0;
    left: 0;
    bottom: -20px; 
    width: 100%;
    height: 40px; 
    background: radial-gradient(ellipse at 50% 100%, #004d99 50%, transparent 51%);
    background-size: 50% 100%;   
    animation: wave-bottom 15s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}


@keyframes wave-bottom {
    0%, 100% {
        background-position: 0% 0;
    }
    50% {
        background-position: 100% 0;
    }
}

/* Mejoras generales para imágenes y tablas fluidas */
img, table {
    max-width: 100%;
    height: auto;
}

/* Ajuste para tablas en pantallas pequeñas: scroll horizontal */
@media (max-width: 900px) {
    table {
        display: block;
        overflow-x: auto;
        width: 100%;
        font-size: 0.95em;
    }
    th, td {
        min-width: 100px;
        box-sizing: border-box;
    }
}

/* HEADER y LOGOS: apilar y centrar en móviles */
@media (max-width: 768px) {
    header {
        flex-direction: column !important;
        align-items: center !important;
        padding: 10px 0 !important;
    }
    .logo-left, .logo-right {
        width: 100px !important;
        justify-content: center !important;
        margin: 5px 0 !important;
    }
    .header-title-container {
        margin: 10px 0 !important;
    }
    .header-title-container h1 {
        font-size: 1.1em !important;
        text-align: center !important;
    }
    .header-clock {
        min-width: unset !important;
        margin: 5px 0 !important;
    }
}

/* MAIN y SECCIONES: padding reducido y apilado */
@media (max-width: 768px) {
    main {
        padding: 8px !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
    .informe-header-fijo {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 8px 5px !important;
        font-size: 1em !important;
    }
    .slide > h2, .slide > table, .slide > .uv-info, .slide > .image-slide-content, .slide > p {
        padding: 0 5px !important;
    }
}

/* UV info y paneles: apilar verticalmente */
@media (max-width: 600px) {
    .uv-info {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 10px 5px !important;
    }
    .uv-info .uv-icon {
        height: 80px !important;
    }
}

/* Aire calidad: apilar mapa y panel */
@media (max-width: 900px) {
    #air-quality-main-container {
        flex-direction: column !important;
        height: auto !important;
        gap: 10px !important;
    }
    #air-quality-map-container, #air-quality-alert-panel {
        height: 250px !important;
        min-height: 180px !important;
    }
}

/* Footer: texto más pequeño y centrado */
@media (max-width: 600px) {
    footer {
        font-size: 0.6em !important;
        padding: 4px 0 !important;
    }
}

/* Ocultar sidebars en móviles */
@media (max-width: 1200px) {
    .weather-sidebar {
        display: none !important;
    }
}

/* Ajuste para slides dinámicas y contenedores */
@media (max-width: 600px) {
    .dynamic-image-slide .responsive-image {
        max-width: 98vw !important;
        max-height: 40vh !important;
    }
    .dynamic-image-slide h2 {
        font-size: 1.1em !important;
    }
    .dynamic-image-slide p {
        font-size: 0.95em !important;
    }
}

/* Ajuste para tablas con muchas columnas en móviles */
@media (max-width: 600px) {
    th, td {
        font-size: 0.85em !important;
        padding: 6px 2px !important;
    }
}

/* --- Estilos para el carrusel de la columna derecha --- */
.dashboard-panel-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.right-column-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    background-color: #e9ecef;
}

.right-column-slide.active-right-slide {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    z-index: 1;
}

#panel-emergencias-dashboard .table-container {
    max-height: 90%;
    overflow-y: auto;
}

#panel-emergencias-dashboard table {
    width: 100%;
    border-collapse: collapse;
}

#panel-emergencias-dashboard th, #panel-emergencias-dashboard td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 0.9em;
}

#panel-emergencias-dashboard th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
}

.hydro-station-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 5px 5px 5px 5px;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 430px;
    border-top: 2px solid #007bff;
    border-bottom: 2px solid #007bff;
    /*display: flex;*/
    /*flex-direction: column;*/
    /*flex: 1;*/
    /*max-width: 550px;*/
    /*height: 125px;*/
}

.hydro-station-card h4 {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    color: #004d99;
    font-weight: bold;
    text-align: center;
    height: 40px;
    line-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.linear-gauge-unit {
    width: 100%;
}

.linear-gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.gauge-label {
    font-size: 0.8em;
    font-weight: bold;
}

.gauge-current-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #004d99;
}

.linear-gauge-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 15px;
}

/* La barra principal que contiene las zonas de color */
.linear-gauge-track {
    display: flex;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Las zonas de color */
.lg-zone-green { background-color: #a5d6a7; }
.lg-zone-yellow { background-color: #ffe082; }
.lg-zone-red { background-color: #ef9a9a; }

/* El marcador del valor actual */
.linear-gauge-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 20px;
    background-color: #343a40;
    border: 1px solid white;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transition: left 0.5s ease-out;
    z-index: 10;
}

/* Las etiquetas de los umbrales */
.linear-gauge-ticks {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    font-size: 0.7em;
    color: #666;
}

.linear-gauge-ticks span {
    position: absolute;
    transform: translateX(-50%);
    background-color: rgba(249, 249, 249, 0.8);
    padding: 1px 3px;
    border-radius: 3px;
}

.linear-gauge-ticks span:first-child {
    transform: translateX(0%);
}

.card-footer {
    margin-top: auto;
    padding-top: 5px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 15px;
}

/* Nuevo estilo para el LED de estado */
.status-led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 0 5px;
}

.led-green {
    background-color: #4caf50;
    box-shadow: 0 0 8px #4caf50;
}

.led-red {
    background-color: #f44336;
    box-shadow: 0 0 8px #f44336;
    animation: pulse-red-led 2s infinite;
}

@keyframes pulse-red-led {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

@keyframes pulse-yellow {
    0% { text-shadow: 0 0 4px rgba(255, 235, 59, 0.5); }
    50% { text-shadow: 0 0 10px rgba(255, 235, 59, 1); }
    100% { text-shadow: 0 0 4px rgba(255, 235, 59, 0.5); }
}
@keyframes pulse-red {
    0% { text-shadow: 0 0 5px rgba(244, 67, 54, 0.7); }
    50% { text-shadow: 0 0 15px rgba(244, 67, 54, 1); }
    100% { text-shadow: 0 0 5px rgba(244, 67, 54, 0.7); }
}

#weather-banner-container {
    position: relative;
    overflow: hidden;   
}

/* Estilo para CADA slide (clima, hidrometría, etc.) */
.top-banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 10px;
    /*padding: 10px;*/
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease-in-out;
}

/* Estilo para la slide que está visible */
.top-banner-slide.active-top-slide {
    opacity: 1;
    visibility: visible;
    position: relative;
}

/* --- NUEVOS ESTILOS PARA LA TARJETA HIDROMÉTRICA --- */
/* Contenedor para alinear el LED y el título */
.hydro-card-header {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 2px;
}

/* Ajustes al título para que funcione con Flexbox */
.hydro-station-card h4 {
    flex-grow: 1;
    text-align: left;
    margin: 0;
    height: auto;
    line-height: 1.2;
    display: block;
}

.hydro-station-card .card-footer {
    height: 1px;
    padding-top: 0;
    margin-top: 5px;
    border-top: 1px solid #eee;
}

/* Ajuste al tamaño del LED para que no sea tan grande */
.status-led {
    width: 4px;
    height: 4px;
    flex-shrink: 0;
}

/* --- ESTILOS PARA INDICADOR DE ESTADO HIDRO --- */
.hydro-status-indicator {
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}

.blinking-red {
    color: #dc3545;
    animation: blink-red 1.5s linear infinite;
}

@keyframes blink-red {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(220, 53, 69, 0.7);
    }
    50% {
        opacity: 0.5;
        text-shadow: none;
    }
}

.blinking-value {
    animation: blink-red 1.5s linear infinite;
}

/* --- ESTILOS PARA CONTROLES DE VISUALIZACIÓN EN EL FOOTER --- */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
}

#dashboard-controls-container {
    display: flex;
    gap: 25px;
    align-items: center;
}

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

.control-group label {
    font-size: 0.9em;
    color: #f0f0f0;
    font-weight: bold;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* --- ESTILOS PARA CARRUSEL/PAGINACIÓN DE NOVEDADES --- */
#novedades-content {
    position: relative;
    overflow: hidden;
}

.novedad-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.novedad-page.active {
    opacity: 1;
    visibility: visible;
}

/* --- ESTILOS PARA SLIDE DE HIDROMETRÍA Y TURNOS --- */
/* Contenedor principal del slide (Llamado, Hidro, Operadores) */
#hydro-slide {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 25px;
    height: 143px;
}

/* Paneles laterales de turnos */
.turno-container {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 260px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-top: 2px solid #007bff;
    border-bottom: 2px solid #007bff;
}

.turno-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #004d99;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.turno-container .turno-op-nombre {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1.3;
    color: #333;
}

.turno-container .proximo-turno {
    margin-top: 12px;
    font-size: 0.9em;
    font-weight: normal;
    color: #6c757d;
}

/* --- ESTILO PARA EL INDICADOR DE PÁGINA DE NOVEDADES --- */
#novedades-page-indicator {
    font-size: 0.9em;
    font-weight: normal;
    color: #999;
    text-align: right;
    padding: 0;
    margin: 0 20px;
    border: none;
}

/* --- ESTILOS PARA PANELES DE TURNOS --- */
/* AJUSTE PARA TÍTULO DE AVISOS EN DASHBOARD */
#panel-avisos .dynamic-title {
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- Estilos para el nuevo encabezado del Panel de Avisos -- */
#panel-avisos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

#panel-avisos-header .dynamic-title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
    flex-grow: 1;
}

#panel-avisos-header .dynamic-title span {
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

#panel-avisos-header .dynamic-title span:not(.active-title):hover {
    color: #007bff;
}

#aviso-pause-play-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    margin-left: 15px;
    flex-shrink: 0;
}

#aviso-pause-play-btn.paused {
    background-color: #d4edda;
}

/* Hace que el panel de "Llamado" organice su contenido verticalmente */
#turno-llamado-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Estilo para la nueva línea de texto de la hora del informe */
#hora-informe-inline {
    font-size: 0.8em;
    font-weight: bold;
    color: #888;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
    width: 80%;
    align-self: center;
}

/* --- ESTILOS PARA LA MARQUESINA DE NOTIFICACIONES EN EL FOOTER --- */
/* Ajusta el footer para que sea un contenedor flexible */
footer {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* El contenedor de la marquesina que ocupa el espacio disponible */
#notification-marquee-container {
    flex-grow: 1;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    height: 30px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;    
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* El texto que se desplazará */
#notification-marquee-text {
    position: absolute;
    margin: 0;
    padding-left: 100%;
    white-space: nowrap;
    color: #f0f0f0;
    font-weight: bold;
    font-size: 0.9em;
    animation-name: scroll-left;
    animation-timing-function: linear;    
}

/* La animación de desplazamiento */
@keyframes scroll-left {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* --- Estilos para encabezado de panel SEC con hora de actualización --- */
.panel-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Evita que el h3 dentro de este nuevo layout tenga sus propios márgenes y bordes */
.panel-header-flex h3 {
    margin: 0;
    border: none;
    padding: 0;
}

/* Estilo para el texto de la hora, similar al de las estaciones meteorológicas */
.panel-update-time {
    font-size: 0.8em;
    font-style: italic;
    color: #6c757d;
    white-space: nowrap;
    margin-left: 15px;
}

/* --- Estilos para Indicador LED de Estado de Datos --- */
.hydro-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.hydro-card-header h4 {
    flex-grow: 1; /* El título ocupa el espacio restante */
    margin: 0;
    text-align: left;
}

.led-indicator-container {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.led-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

/* Estado "apagado" por defecto */
.led-off {
    background-color: #555;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.5);
}

/* Estado "encendido" con colores y brillo */
.led-on-green {
    background-color: #4caf50;
    box-shadow: 0 0 8px #4caf50, inset 0 0 2px white;
}
.led-on-yellow {
    background-color: #ffeb3b;
    box-shadow: 0 0 8px #ffeb3b, inset 0 0 2px white;
}
.led-on-red {
    background-color: #f44336;
    box-shadow: 0 0 8px #f44336, inset 0 0 2px white;
    animation: pulse-red-led 2s infinite;
}

.gauge-current-value.blinking-value {
    animation: blink-yellow 1.5s linear infinite;
}

@keyframes blink-yellow {
    0%, 100% {
        color: #1eb400;
        text-shadow: 0 0 5px rgba(147, 255, 59, 0.7);
    }
    50% {
        color: #333;
        text-shadow: none;
    }
}

/* --- Estilos para Paneles Dinámicos de Columna Derecha --- */
/* Esta clase hará que el panel ocupe toda la altura de la columna */
.dashboard-panel.full-height {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Asegura que el contenido con scroll (listas, tablas) use el espacio disponible */
.dashboard-panel.full-height .table-container,
.dashboard-panel.full-height #novedades-content,
.dashboard-panel.full-height #waze-incidents-container {
    flex-grow: 1;
    overflow-y: auto;
}

/* --- Estilos para Scroll Vertical Animado --- */
/* Keyframes para la animación de desplazamiento hacia arriba */
@keyframes vertical-scroll-anim {
    0% { transform: translateY(0%); }
    20% { transform: translateY(0%); } 
    80% { transform: translateY(calc(-100% + 200px)); } 
    100% { transform: translateY(calc(-100% + 200px)); } 
}

/* Clase que se aplicará con JS al contenido que necesite scroll */
.vertical-scroll-content {
    animation-name: vertical-scroll-anim;
    animation-timing-function: linear;
    animation-iteration-count: 1;
}

/* --- Estilos para el GIF del Panel SEC --- */
.sec-gif-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 5px;
    margin-top: auto;
}

.sec-gif-container img {
    max-height: 100px;
    max-width: 80%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#sec-data-slide .dashboard-panel {
    max-height: 350px;
    overflow: hidden;
}

.no-items-placeholder {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #6c757d;
}

/* --- ESTILOS PARA EL POPUP DE DESGLOSE COMUNAL (SEC) --- */
.sec-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.sec-modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    animation: slide-down 0.4s ease-out;
}

.sec-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.sec-modal-header h4 {
    margin: 0;
    font-size: 1.4em;
    color: #004d99;
}

.sec-modal-close-btn {
    background: none;
    border: none;
    font-size: 2.5em;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.sec-modal-close-btn:hover {
    color: #333;
}

.sec-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.sec-communes-table {
    width: 100%;
    border-collapse: collapse;
}

.sec-communes-table th,
.sec-communes-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.sec-communes-table th {
    font-weight: bold;
    background-color: #f8f9fa;
}

.province-row:hover {
    background-color: #e9ecef; /* Efecto hover para las filas clickeables */
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ESTILOS PARA FONDOS DINÁMICOS DE ESTACIONES METEOROLÓGICAS --- */
.weather-station-box {
    position: relative;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

/* Capa semitransparente para mejorar la legibilidad del texto */
.weather-overlay {
    position: relative;
    z-index: 2;
    background-color: transparent;
    padding: 0.1px 5px;
    border-radius: 6px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Estilo de "resaltador" para cada línea de texto individual */
.weather-overlay h4,
.weather-overlay p {
    color: #000;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 1px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2px;
    text-shadow: 1px 1px 2px #333;
}

.weather-overlay strong {
    background-color: transparent;
    text-shadow: none;
}

.weather-overlay h4 {
    color: #003366;
    font-size: 0.9em; 
    margin-bottom: 5px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
    text-shadow: 1px 1px 2px #333;
    color: #000;
}

.weather-overlay .weather-box-footer {
    background-color: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.weather-station-box[data-station-code="320051"] .weather-overlay h4 {
    font-size: 0.8em;
    padding: 1px 5px;
}

/* --- ESTILOS PARA ALERTA VISUAL SEC --- */
@keyframes pulse-red-yellow {
    0%, 100% {
        background-color: #f8d7da;
        color: #721c24;
    }
    50% {
        background-color: #fff3cd;
        color: #856404;
    }
}

.pulse-alert-sec {
    animation: pulse-red-yellow 1.5s infinite;
    font-weight: bold;
    border: 2px dashed #856404;
}

/* --- ESTILOS PARA MEDIDOR DE AFECTACIÓN SEC --- */
.sec-gauge-container {
    width: 100%;
    max-width: 450px;
    margin: 70px auto 10px auto;
    position: relative;
    padding-bottom: 15px;
}

.sec-gauge-track {
    display: flex;
    width: 100%;
    height: 25px;
    border-radius: 12.5px;
    overflow: hidden;
    border: 1px solid #b8b8b8;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.sec-gauge-level {
    width: 10%;
    height: 100%;
}

.sec-gauge-ticks {
    display: flex;
    justify-content: space-between;
    padding: 5px 2px 0 2px;
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
}

.sec-gauge-needle-container {
    position: absolute;
    bottom: 10px;
    left: 0%;     
    height: 100%;
    transition: left 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 2;
}

.sec-gauge-needle {
    width: 0; 
    height: 0;     
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 15px solid #343a40;
    position: absolute;
    top: 25px;
    transform: translateX(-50%);
    
}

.sec-gauge-value-display {
    position: absolute;
    top: -5px; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #343a40;
    color: white;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
}

/* --- ESTILOS PARA LOGO SENAPRED EN PANELES VACÍOS --- */
.dashboard-panel {
    position: relative;
}

.empty-panel-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding-top: 30px;
    box-sizing: border-box;
}

.empty-panel-logo-container img {
    max-width: 900px;
    max-height: 900px;
    opacity: 0.25;
}

/*Icono en footer para estado puertos en /dashboard */
.footer-icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.5em;
    padding: 0 5px;
    vertical-align: middle;
    line-height: 1;
}

.footer-icon-btn:hover {
    opacity: 0.8;
}

/* --- ESTILOS PARA BOTÓN DE DETALLES DE CALIDAD DEL AIRE --- */
#air-quality-details-btn {
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 1em;
}

#air-quality-details-btn:hover {
    background-color: #0056b3;
}

/* --- AJUSTES DE LAYOUT PARA EL BANNER DE HIDROMETRÍA --- */
/* Contenedor central de las 3 estaciones */
#hydro-stations-wrapper {
    flex-grow: 1;
    display: flex;
    gap: 20px;
}

/* Paneles laterales de turnos */
#turno-llamado-container,
#turno-operadores-container {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 200px; /* Ancho fijo */
}

/* Contenedor de los dos medidores (Altura y Caudal) */
.gauges-container {
    display: flex;
    flex-direction: column;
    flex-grow: 0;
    flex-shrink: 0; 
    flex-basis: 260px; 
    justify-content: center;
    gap: 2px;
    width: 100%;
}

/* --- Estilos para Pop-up de Permiso de Audio --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    backdrop-filter: blur(4px);
}

.popup-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    width: 90%;
    max-width: 350px;
}

.popup-content p {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

.popup-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.popup-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    flex-grow: 1;
}

#btn-audio-no {
    background-color: #6c757d;
    color: white;
}

#btn-audio-yes {
    background-color: #007bff;
    color: white;
}

/* --- Estilos para controles de vista Verano/Invierno --- */
.view-switch-btn {
    background: none;
    border: 2px solid #fff;
    color: white;
    cursor: pointer;
    font-size: 1.5em;
    padding: 2px 6px;
    border-radius: 5px;
    line-height: 1;
    transition: background-color 0.3s, transform 0.2s;
}

.view-switch-btn:hover {
    transform: scale(1.1);
}

.view-switch-btn.active-view {
    background-color: #007bff;
    border-color: #cce7ff;
}

.control-separator {
    display: inline-block;
    width: 2px;
    height: 25px;
    background-color: #4a5a6a;
    margin: 0 10px;
    vertical-align: middle;
}
/* --- Estilos para controles de vista Verano/Invierno --- */

/* --- Estilos FINALES para Marcador en Cuadrícula 2x2 --- */
.wind-grid-table {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5); 
    border: 1px solid #333;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    font-family: Arial, sans-serif;
    border-collapse: collapse;
}

.wind-grid-table td {
    width: 50%;
    height: 50%;
    text-align: center;
    vertical-align: middle;
    padding: 1px;
}

/* Líneas de la cuadrícula */
.wind-grid-table tr:first-child td {
    border-bottom: 1px solid #999;
}
.wind-grid-table td:first-child {
    border-right: 1px solid #999;
}

/* Celda de Velocidad del Viento */
.wind-speed-cell {
    font-size: 9.2px;
    font-weight: bold;
    line-height: 1;
}
.wind-speed-cell .unit {
    display: block;
    font-size: 9px;
    font-weight: normal;
}
.wind-speed-cell .calm-text {
    font-size: 8.5px;
    font-weight: bold;
    color: #003366;
}

/* Celda de la Flecha/Círculo */
.wind-arrow-cell {
    padding-top: 1.5px;
}
.arrow-svg {
    width: 12px;
    height: 12px;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5));
}

/* Celda de Temperatura */
.wind-temp-cell {
    font-size: 9.5px;
    font-weight: bold;
    color: #d32f2f;
}

/* Celda de Humedad */
.wind-humidity-cell {
    font-size: 9.5px;
    font-weight: bold;
    color: #0277bd;
}

/* --- ESTILOS PARA POPUP DE MAPA DE EVENTOS SÍSMICOS --- */
.event-map-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(5px);
    
    /* Control de visibilidad y animación */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s;
}

.event-map-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.event-map-content {
    background-color: #ffffff;
    width: 50%;
    height: 50%;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.event-map-overlay.visible .event-map-content {
    transform: scale(1);
}

.event-map-header {
    background-color: #c20d00;
    color: white;
    padding: 10px 15px;
    flex-shrink: 0;
}

.event-map-header h3 {
    margin: 0;
    font-size: 1.3em;
    text-align: center;
    color: white;
    border: none;
}

#event-map-container {
    flex-grow: 1;
    background-color: #e5e3df; 
}

/* Hacemos que el contenedor del modal use Flexbox en columna */
.sec-modal-content {
    display: flex;
    flex-direction: column;
}

/* Evitamos que el encabezado del modal se encoja */
.sec-modal-header {
    flex-shrink: 0;
}

/* Hacemos que el contenedor del mapa crezca para ocupar todo el espacio sobrante */
#sec-map-container {
    flex-grow: 1;
}

/* --- ESTILOS OVERLAY BIENVENIDA --- */
.audio-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(240, 242, 245, 0.98); /* Fondo claro casi opaco */
    z-index: 9999; display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease-out;
}

.welcome-style {
    background-color: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    width: 90%; max-width: 550px;
    text-align: center;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.welcome-header {
    background: linear-gradient(135deg, #004d99 0%, #003366 100%);
    color: white; padding: 25px 20px;
}

.welcome-logo {
    width: 60px; height: 60px; border-radius: 50%; border: 3px solid white;
    margin-bottom: 10px;
}

.welcome-header h2 { margin: 0; font-size: 1.4em; border: none; color: white; }
.welcome-header h3 { margin: 5px 0 0 0; font-size: 1em; font-weight: normal; opacity: 0.9; color: #cce7ff; }

.welcome-info-box {
    padding: 25px; background-color: #f8f9fa; text-align: left;
    border-bottom: 1px solid #eee;
}

.info-primary { font-size: 1.1em; color: #333; margin-bottom: 15px; text-align: center; }
#welcome-filename { color: #0056b3; font-weight: bold; word-break: break-word; }

.info-grid { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.info-grid div { flex: 1; background: white; padding: 10px; border-radius: 6px; border: 1px solid #e0e0e0; text-align: center; }
.info-grid small { color: #666; text-transform: uppercase; font-size: 0.75em; letter-spacing: 0.5px; }

.info-secondary { text-align: center; color: #555; margin-top: 15px; font-size: 0.95em; }
.highlight-time { color: #28a745; font-weight: bold; font-size: 1.1em; }

.audio-note { font-size: 0.85em; color: #888; margin: 15px 0 5px 0; font-style: italic; }

.enable-audio-btn {
    background-color: #004d99; color: white; width: 100%; padding: 18px;
    font-size: 1.1em; font-weight: bold; border: none; cursor: pointer;
    transition: background 0.3s;
    border-radius: 0 0 12px 12px; /* Redondeado solo abajo */
}
.enable-audio-btn:hover { background-color: #003366; }

.enable-audio-btn:active {
    transform: scale(0.98);
}

@keyframes pulse-icon {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- ESTILOS PARA SELLO OFFLINE INTERMITENTE --- */
.offline-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg); /* Centrado y rotado */
    
    color: #d32f2f; /* Rojo oscuro */
    border: 3px solid #d32f2f;
    padding: 5px 15px;
    
    font-family: 'Arial Black', sans-serif;
    font-size: 1.8em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    
    background-color: rgba(255, 255, 255, 0.85); /* Fondo blanco semitransparente para legibilidad */
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    border-radius: 8px;
    
    pointer-events: none; /* Permite hacer clic en lo que está abajo */
    z-index: 10; /* Por encima de todo */
    
    /* Configuración de la animación */
    opacity: 0; /* Empieza invisible */
    animation: offline-fade-sequence 8s infinite; /* Ciclo de 8 segundos */
}

/* SECUENCIA DE ANIMACIÓN (8 segundos total):
   0% - 60%: Invisible (4.8 seg) -> TIEMPO PARA LEER DATOS
   65% - 95%: Visible (2.4 seg) -> ALERTA "OFFLINE"
   100%: Invisible
*/
@keyframes offline-fade-sequence {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-30deg) scale(0.8); }
    60%  { opacity: 0; transform: translate(-50%, -50%) rotate(-30deg) scale(0.8); }
    65%  { opacity: 1; transform: translate(-50%, -50%) rotate(-30deg) scale(1.1); } /* Efecto "golpe" al aparecer */
    70%  { opacity: 1; transform: translate(-50%, -50%) rotate(-30deg) scale(1); }
    95%  { opacity: 1; }
    100% { opacity: 0; }
}

/* --- EFECTO SNAKE PARA AVISOS ACTIVOS --- */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ==========================================================================
   ESTILOS DE ALERTA ACTIVA 
   ========================================================================== */

/* --- 1. ANIMACIONES DE PULSO (RESPIRACIÓN) --- */
/* AVISO (Verde) */
@keyframes pulse-green-border {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); border-color: #28a745; }
    70% { box-shadow: 0 0 0 6px rgba(40, 167, 69, 0); border-color: #5dd675; }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); border-color: #28a745; }
}
@keyframes pulse-green-bg {
    0%, 100% { background-color: rgba(40, 167, 69, 0.1); }
    50% { background-color: rgba(40, 167, 69, 0.25); }
}

/* ALERTA (Amarillo) */
@keyframes pulse-yellow-border {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); border-color: #ffc107; }
    70% { box-shadow: 0 0 0 6px rgba(255, 193, 7, 0); border-color: #ffe066; }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); border-color: #ffc107; }
}
@keyframes pulse-yellow-bg {
    0%, 100% { background-color: rgba(255, 193, 7, 0.1); }
    50% { background-color: rgba(255, 193, 7, 0.25); }
}

/* ALARMA (Rojo) */
@keyframes pulse-red-border {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); border-color: #dc3545; }
    70% { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); border-color: #ff6b6b; }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); border-color: #dc3545; }
}
@keyframes pulse-red-bg {
    0%, 100% { background-color: rgba(220, 53, 69, 0.1); }
    50% { background-color: rgba(220, 53, 69, 0.3); }
}


/* --- 2. DASHBOARD (Etiquetas pequeñas <strong>) --- */
/* Animación de GLOW (Resplandor) para las etiquetas */

@keyframes glow-pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); border-color: #28a745; }
    50% { box-shadow: 0 0 10px 2px rgba(40, 167, 69, 0.5); border-color: #4cd964; }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); border-color: #28a745; }
}

@keyframes glow-pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); border-color: #ffc107; }
    50% { box-shadow: 0 0 10px 2px rgba(255, 193, 7, 0.5); border-color: #ffdb4d; }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); border-color: #ffc107; }
}

@keyframes glow-pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); border-color: #dc3545; }
    50% { box-shadow: 0 0 10px 2px rgba(220, 53, 69, 0.5); border-color: #ff6b6b; }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); border-color: #dc3545; }
}

.snake-active {
    position: relative;
    z-index: 5;
    border-style: solid !important;
    border-width: 2px !important;
    transition: all 0.3s ease-in-out;
}

/* --- (avisos, alertas, alarmas) --- */
/* Asignamos la animación de GLOW según el tipo */

.snake-active.aviso-avisos {
    animation: glow-pulse-green 1.5s infinite;
}
.snake-active.aviso-alertas {
    animation: glow-pulse-yellow 1.5s infinite;
}
.snake-active.aviso-alarmas {
    animation: glow-pulse-red 1s infinite;
}

@keyframes glow-pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); border-color: #0d6efd; }
    50% { box-shadow: 0 0 10px 2px rgba(13, 110, 253, 0.5); border-color: #3d8bfd; }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); border-color: #0d6efd; }
}

/* Asignar la animación a la clase de marejadas */
.snake-active.aviso-marejadas, 
.snake-active.aviso-marejada {
    animation: glow-pulse-blue 1.5s infinite;
}

/* --- 3. INDEX (Filas de Tabla <tr>) --- */
/* Usamos box-shadow INSET para dibujar bordes internos que no colapsan */

tr.row-active-aviso, tr.row-active-alerta, tr.row-active-alarma {
    position: relative;
    z-index: 100;
}

/* AVISO (Verde) */
tr.row-active-aviso td {
    animation: pulse-green-bg 2s infinite !important;
    border-top: 2px solid #28a745 !important;
    border-bottom: 2px solid #28a745 !important;
}
tr.row-active-aviso td:first-child { border-left: 2px solid #28a745 !important; }
tr.row-active-aviso td:last-child { border-right: 2px solid #28a745 !important; }

/* ALERTA (Amarillo) */
tr.row-active-alerta td {
    animation: pulse-yellow-bg 2s infinite !important;
    border-top: 2px solid #ff9800 !important;
    border-bottom: 2px solid #ff9800 !important;
}
tr.row-active-alerta td:first-child { border-left: 2px solid #ff9800 !important; }
tr.row-active-alerta td:last-child { border-right: 2px solid #ff9800 !important; }

/* ALARMA (Rojo) */
tr.row-active-alarma td {
    animation: pulse-red-bg 1.5s infinite !important;
    border-top: 2px solid #dc3545 !important;
    border-bottom: 2px solid #dc3545 !important;
}
tr.row-active-alarma td:first-child { border-left: 2px solid #dc3545 !important; }
tr.row-active-alarma td:last-child { border-right: 2px solid #dc3545 !important; }

/* --- ESTILOS NUEVO HEADER DERECHO (N° INFORME) --- */
.header-info-right {
    width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-number-box {
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 5px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.report-label {
    display: block;
    font-size: 0.9em;
    color: #ccc;
    letter-spacing: 2px;       
    margin-bottom: 0px;
    font-weight: bold;
}

.report-value {
    display: block;
    font-size: 3.0em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 191, 255, 0.8);
    line-height: 1.0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-top: 2px;
}

/* --- ESTILO PARA LA FUENTE DEL LOG EN NOVEDADES --- */
.log-source-tag {
    font-size: 0.65em;
    color: #666;
    text-transform: uppercase;
    font-weight: bold;
    margin-left: 5px;
    margin-right: 5px;
    background-color: #e9ecef;
    padding: 1px 4px;
    border-radius: 3px;
    vertical-align: middle;
}

/* --- ESTILOS PARA MEDIDOR UV (DASHBOARD) --- */
#uv-meter-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    padding: 10px;
    box-sizing: border-box;
}

.uv-dashboard-wrapper {
    display: flex;
    gap: 30px;
    align-items: center;
    height: 90%;
    width: 90%;
}

/* Columna del Medidor Vertical */
.uv-scale-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border: 1px solid #ccc;
}

.uv-level-block {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    opacity: 0.3;
    transition: all 0.3s ease;
}

/* Colores Oficiales UV */
.uv-low { background-color: #289500; }       /* 1-2 */
.uv-moderate { background-color: #f7e400; color: #333; } /* 3-5 */
.uv-high { background-color: #f85900; }      /* 6-7 */
.uv-very-high { background-color: #d8001d; } /* 8-10 */
.uv-extreme { background-color: #6b49c8; }   /* 11+ */

/* Estado Activo (Brillante y Palpitante) */
.uv-level-block.active {
    opacity: 1;
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 0 15px currentColor;
    animation: uv-pulse 1.5s infinite;
}

@keyframes uv-pulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
    100% { filter: brightness(1); }
}

/* Columna de Información Grande */
.uv-info-column {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.uv-big-value {
    font-size: 7em;
    font-weight: bold;
    line-height: 1;
    font-family: 'Segoe UI', sans-serif;
    margin-bottom: 10px;
}

.uv-risk-label {
    font-size: 2em;
    text-transform: uppercase;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
}

.uv-timestamp {
    margin-top: 20px;
    color: #666;
    font-style: italic;
}