/*
 * style_fixed.css - Estilos completos y corregidos (Versión Final y Estable)
 * * Cambios aplicados:
 * 1. FIX DE DISTRIBUCIÓN: Fecha y Hora en una sola línea.
 * 2. FIX DE DISTRIBUCIÓN: Franja de datos principal con 8 ítems en línea (dataRow1).
 * 3. FIX DE TAMAÑO DE IMAGEN: Las fotos del carrusel llenan el 100% del espacio (object-fit: cover).
 * 4. FIX DE ALTURA: La Galería y las Noticias tienen la misma altura en escritorio (align-items: stretch).
 * 5. FIX AÑADIDO (8 ITEMS POR FILA): Ajuste de Flexbox en .data-strip-item y #dataRowX.
 * 6. FIX DE ESPACIADO: Aumento significativo del margen entre "Última lectura", Fecha y Hora.
 * 7. FIX: Estilo para la hora en Máxima y Mínima (`.time-detail`).
 */

/* ──────────────────────────────── */
/* 1. Estilos generales del cuerpo */
/* ──────────────────────────────── */
body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ────────────────────────────────────── */
/* 2. Encabezado principal y Header Info */
/* ────────────────────────────────────── */
header {
    background-color: #1e3a8a; /* Azul oscuro */
    color: white;
    padding: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky; /* Fija el header al hacer scroll */
    top: 0;
    z-index: 1000;
}

.header-info {
    display: flex;
    align-items: center;
    justify-content: space-between; 
    padding: 10px 20px;
    background-color: #003399; 
}

.header-info img {
    height: 80px;   /*Aquí se configura la altura del encabezado */
    margin-right: 15px;
    width: auto;
    max-height: none;
}
.bandera {
    height: 40px;
}

.header-info h1 {
    margin: 0;
    font-size: 1.6em; 
    font-weight: bold;
    color: white;
    text-shadow: none;
    position: static;
    transform: none;
    text-align: center; 
    flex: 1; 
}


/* ────────────────────────────────────── */
/* 3. Franja superior para Fecha y Hora (Última lectura) - MODIFICADO ESPACIADO */
/* ────────────────────────────────────── */

/* Contenedor principal para la fecha/hora y "Última lectura" */
.datetime-display-container {
    background-color: #000000;
    color: white;
    padding: 10px 15px; 
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Wrapper para "Última lectura" y el bloque de Fecha/Hora */
.datetime-wrapper {
    display: flex;
    align-items: center; 
    justify-content: center; 
    position: relative; 
    max-width: 500px; 
    margin: 0 auto; 
    width: 100%;
}

/* Estilos para el texto de 'Última lectura' */
.datetime-wrapper .last-read-text {
    font-size: 1.4em; 
    font-weight: bold; 
    color: #fff; 
    /* Posicionamiento a la izquierda del bloque fecha/hora */
    position: absolute; 
    left: 0; 
    white-space: nowrap; 
}

/* El div interno que contiene la fecha y la hora */
.date-time-inner {
    display: flex; 
    align-items: baseline; 
    font-weight: bold;
    line-height: 1;
    /* Centramos el bloque fecha/hora y lo separamos de "Última lectura" */
    flex-grow: 1; 
    justify-content: center; 
    padding-left: 75px; /* ESPACIO GRANDE A LA IZQUIERDA */
}

/* Estilos específicos para la fecha */
.date-time-inner .date-display {
    margin-right: 30px; /* ESPACIO GRANDE ENTRE FECHA Y HORA */
    font-size: 1.6em; 
    color: #fff; 
}

/* Estilos específicos para la HORA */
.date-time-inner .time-display {
    font-size: 1.8em; 
    color: #fff; 
}


/* ────────────────────────────────── */
/* 4. Franja de Datos (.data-strip) */
/* ────────────────────────────────── */

.data-strip {
    display: flex;
    flex-direction: column; 
    padding: 0; 
    background-color: #000000; 
    color: white; 
    overflow-x: hidden;
}

.data-strip::-webkit-scrollbar {
    display: none;
}

.data-strip-item {
    width: 12.5%; 
    min-width: 80px; 
    flex-shrink: 0; 
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 0px; 
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
    border-right: none; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#dataRow1 .data-strip-item {
    border-bottom: none; 
}

#dataRow2 .data-strip-item:nth-child(n+9) {
    border-bottom: none;
}


.data-strip-item .icon {
    font-size: 1.1em;
    line-height: 1;
    margin-bottom: 2px;
}

.data-strip-item .value {
    font-size: 1.8em; 
    font-weight: bold;
    line-height: 1.1;
}

/* Estilo específico para la hora de Máxima/Mínima */
.data-strip-item .value .time-detail {
    font-size: 0.5em; /* Tamaño pequeño para la hora */
    font-weight: normal;
    display: block; /* Asegura que vaya debajo del valor principal */
    line-height: 1;
    margin-top: 2px;
    color: #aaa;
}

.data-strip-item .title {
    font-size: 0.95em;
    font-weight: normal;
    opacity: 0.9;
}


/* ───────────────────────────── */
/* 5. Contenido principal */
/* ───────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
    flex-grow: 1;
}


/* ───────────────────────────── */
/* 6. Animaciones (Mantenidas) */
/* ───────────────────────────── */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

/* ───────────────────────────── */
/* 7. Cámaras en vivo (.webcam-container) */
/* ───────────────────────────── */
.webcam-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.webcam-card {
    flex: 1 1 45%;
    max-width: 500px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
}

.webcam-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.webcam-card p {
    margin: 10px 0;
    font-size: 1em;
    font-weight: bold;
}

.webcam-card a {
    color: #1e3a8a;
    text-decoration: none;
}

.webcam-card a:hover {
    text-decoration: underline;
}

/* ───────────────────────────── */
/* 8. Enlaces rápidos (.links-container) */
/* ───────────────────────────── */
.links-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.links-container a img {
    width: auto;
    height: 45px;
    margin: 0;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.links-container a img:hover {
    opacity: 1;
}

/* ───────────────────────────── */
/* 10. Noticias y carrusel       */
/* ───────────────────────────── */
.media-news-wrapper {
  max-width: 1200px;
  margin: 40px auto;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.carousel-container,
.news-section {
  flex: 1 1 500px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 14px;
}

/* Carrusel */
.carousel-container {
  position: relative;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.carousel-track {
  display: flex;
  transition: transform 0.6s ease;
  height: 100%;
}

.carousel-item {
  flex: 0 0 100%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  background: rgba(0,0,0,0.4);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
}

.carousel-btn.left { left: 10px; }
.carousel-btn.right { right: 10px; }

.news-section h2 { text-align: center; margin-top: 0; }

.feed-selector { text-align: center; margin: 20px; }
.feed-selector select { padding: 5px 10px; font-size: 1em; }

.news-item { border-bottom: 1px solid #ddd; padding: 10px 0; }
.news-item:last-child { border-bottom: none; }
.news-item a { color: #0077cc; text-decoration: none; font-weight: bold; }
.news-item a:hover { text-decoration: underline; }
.news-date { font-size: 0.85em; color: #777; }

iframe[name="iframe_aemet_id33044"] {
    width: 100%;
    height: 200px;
    border: 1px solid #ccc;
    border-radius: 8px;
    display: block;
    margin-top: 20px;
    margin-bottom: 0px !important; 
}

/* ───────────────────────────── */
/* 11. Pie de página */
/* ───────────────────────────── */
footer {
    text-align: center;
    padding: 15px;
    background: #333;
    color: white;
    font-size: 0.9em;
    margin-top: auto;
}

/* ───────────────────────────── */
/* 12. Estilos de EstacionInfo (Sobre esta estación) */
/* ───────────────────────────── */
#estacionInfo h2 {
    color: #1e3a8a;
}
#estacionInfo p {
    margin-bottom: 10px;
}

/* ───────────────────────────── */
/* 13. Responsive */
/* ───────────────────────────── */
@media (max-width: 900px) {
    .media-news-wrapper { 
        flex-direction: column;
        flex-wrap: wrap;
    }
    .carousel-container,
    .news-section {
        flex: none;
        width: 100%;
    }
    
    .data-strip-item {
        width: calc(25% - 10px); 
        min-width: 90px;
    }
    
    #dataRow1 .data-strip-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    #dataRow1 .data-strip-item:nth-child(n+5) { 
        border-bottom: none;
    }
    #dataRow2 .data-strip-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    #dataRow2 .data-strip-item:nth-child(n+5) { 
        border-bottom: none;
    }
}

@media (max-width: 600px) {
    .header-info {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }

    .header-info h1 {
        font-size: 1.3em;
        margin-top: 5px;
    }
    .bandera {
        height: 30px;
    }

    .webcam-container {
        flex-direction: column;
        gap: 15px;
    }

    .webcam-card {
        width: 100%;
        max-width: none;
    }
    
    .data-strip-item {
        width: calc(25% - 10px);
    }
    
    .center-item {
        font-size: 1em;
        padding: 10px 0;
    }
    
    /* Responsive para la fecha/hora en pantallas pequeñas */
    .datetime-wrapper {
        flex-direction: column; /* Apila "Última lectura" y la fecha/hora */
        align-items: center;
        padding: 5px 0;
    }
    .datetime-wrapper .last-read-text {
        position: static; /* Restablece el posicionamiento */
        margin-right: 0;
        margin-bottom: 5px; /* Espacio debajo del texto */
        font-size: 1em; /* Reducimos el tamaño en móvil */
        color: #fff;
    }
    .date-time-inner {
        flex-grow: 0; 
        padding-left: 0; 
    }
    .date-time-inner .date-display {
        font-size: 1.2em; 
        margin-right: 20px; /* Reducido para móvil, pero suficiente */
    }
    .date-time-inner .time-display {
        font-size: 1.4em; 
    }

    .data-strip-item .value {
        font-size: 1.5em; 
    }
    .data-strip-item .title {
        font-size: 0.8em;
    }
}

/* --- Ajustes de las filas de datos - FIX para 8 ítems en línea --- */
#dataRow1, #dataRow2 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between; 
  gap: 0px; 
  background: #000;
  padding: 6px 10px; 
}
.toggle-container {
  text-align: center;
  background: #000;
  padding: 4px 0 10px 0; 
}
.toggle-btn {
  background: #cc3d00;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-btn:hover { background: #e34d00; }