/* styles.css - Diseño Ultra-Moderno, Glassmorphism (Efecto Cristal) */

/* Reset & Base con Degradado Suave */

/* La barra de desplazamiento se reserva SIEMPRE: si no, las páginas cortas (sin
   barra) centran el contenido en un ancho algo mayor que las largas, y al pasar
   de una a otra todo se desplaza unos píxeles a los lados. */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body { 
    background-color: #f3f4f6;
    /* Mesh gradient pastel premium que hace resaltar el desenfoque de los cristales */
    background-image: 
        radial-gradient(at 0% 0%, rgba(199, 210, 254, 0.4) 0px, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(254, 202, 202, 0.3) 0px, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(209, 250, 229, 0.4) 0px, transparent 50%);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    color: #1e293b; 
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar Minimalista (Cristal) */
.navbar-custom {
    background-color: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 0;
    position: relative;
    z-index: 1050 !important;
}
.navbar-custom .navbar-toggler {
    border: 1.5px solid #475569;
    border-radius: 6px;
    padding: 4px 8px;
    background-color: rgba(71, 85, 105, 0.08);
}
.navbar-custom .navbar-toggler:focus {
    box-shadow: 0 0 0 2px rgba(71, 85, 105, 0.25);
}
.navbar-custom .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23475569' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.navbar-custom .navbar-brand {
    color: #0f172a !important;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
}
.navbar-custom .nav-link {
    color: #475569 !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.navbar-custom .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(15, 23, 42, 0.85);
}
/* Override hover style for the station dropdown selector to prevent white text on light background */
#navbarDropdownEstacion:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}
.navbar-custom .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px;
    z-index: 1060 !important;
}
.navbar-custom .dropdown-item {
    color: #334155;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    padding: 8px 12px;
}
.navbar-custom .dropdown-item:hover {
    background-color: rgba(15, 23, 42, 0.85);
    color: #ffffff;
}

/* Cabecera */
.header-estacion { 
    background: transparent; 
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 25px 0;
    margin-top: 10px;
    margin-bottom: 30px; 
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.header-estacion h3 { 
    font-size: 1.6rem; 
    font-weight: 800; 
    color: #0f172a; 
    letter-spacing: -0.5px;
    margin: 0;
}
.header-estacion .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Tarjetas Glassmorphism (Efecto Cristal) */
.card-custom { 
    background: rgba(255, 255, 255, 0.45) !important; 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5) !important; 
    border-radius: 16px; 
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04); 
    padding: 24px; 
    margin-bottom: 24px; 
}
.section-title { 
    font-size: 0.95rem; 
    font-weight: 700; 
    color: #0f172a; 
    border-bottom: 1px solid rgba(0, 0, 0, 0.06); 
    padding-bottom: 8px; 
    margin-bottom: 18px; 
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Bloques de Datos e Indicadores de Cristal */
.data-box { 
    background: rgba(255, 255, 255, 0.5) !important; 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 14px;
    padding: 20px; 
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.02);
}
.data-box:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05); 
    border-color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.65) !important;
}

/* Indicadores de Borde Izquierdo */
.box-temp { border-left: 4px solid #ff7675 !important; }
.box-hum  { border-left: 4px solid #1abc9c !important; }
.box-wind { border-left: 4px solid #9b59b6 !important; }
.box-pres { border-left: 4px solid #7f8c8d !important; }
.box-rain { border-left: 4px solid #3498db !important; }

.label-mini { 
    font-size: 0.65rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1.2px; 
    color: #64748b; 
    margin-bottom: 4px; 
}
.value-mini { 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: #0f172a; 
    letter-spacing: -0.5px;
}

/* Botones de Filtro */
.btn-filter { 
    font-size: 0.78rem; 
    font-weight: 600;
    border-radius: 20px; 
    margin: 3px; 
    padding: 6px 16px; 
    border: 1px solid rgba(255, 255, 255, 0.5); 
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease; 
    color: #475569; 
    cursor: pointer; 
}
.btn-filter:hover { 
    background: rgba(255, 255, 255, 0.7); 
    color: #0f172a;
    border-color: rgba(255, 255, 255, 0.8);
}
.btn-filter.active { 
    background-color: #0f172a !important; 
    color: #ffffff !important; 
    border-color: #0f172a !important; 
}

/* Footer Custom (Efecto Cristal) */
.footer-custom {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 -8px 32px 0 rgba(31, 38, 135, 0.02);
    margin-top: auto !important;
    width: 100%;
}

/* Punto de Estado Conexión con Animación Heartbeat (Latido) */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    margin-right: 3px;
}
.status-dot.online {
    background-color: #1abc9c;
}
.status-dot.online::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #1abc9c;
    animation: heartbeat 1.8s infinite ease-in-out;
    opacity: 0.6;
}
.status-dot.offline {
    background-color: #e74c3c;
}
@keyframes heartbeat {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

/* Scrollbar personalizado siempre visible en dropdowns con límite de altura */
.dropdown-custom-scroll {
    scrollbar-width: auto !important; /* Forzar barra estándar */
    scrollbar-color: #64748b #f1f5f9 !important; /* Colores de alto contraste */
}

.dropdown-custom-scroll::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
    display: block !important;
}

.dropdown-custom-scroll::-webkit-scrollbar-track {
    background: #f1f5f9 !important; /* Fondo sólido gris claro */
    border-radius: 4px !important;
}

.dropdown-custom-scroll::-webkit-scrollbar-thumb {
    background-color: #64748b !important; /* Barra gris oscura */
    border-radius: 4px !important;
    border: 1px solid #f1f5f9 !important;
}

.dropdown-custom-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #475569 !important;
}

/* Alertas & Switches Premium */
.tab-btn {
    border-radius: 8px !important;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 24px !important;
    transition: all 0.2s ease;
}
.tab-btn.active {
    background-color: #0f172a !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}
.tab-btn:not(.active):hover {
    background-color: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}
.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
}
.form-switch .form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}
.badge-status-change {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}
.bg-online-to-offline {
    background-color: #ffeef0;
    color: #ea384c;
    border: 1px solid rgba(234, 56, 76, 0.15);
}
.bg-offline-to-online {
    background-color: #e6fcf5;
    color: #0ca678;
    border: 1px solid rgba(12, 166, 120, 0.15);
}



/* =====================================================================
 * Aviso de cookies (LSSI/RGPD) — Meteo Cloud
 * Solo cookies técnicas propias (sesión PHP); el aviso es informativo.
 * ===================================================================== */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080; /* por encima del navbar fijo (Bootstrap usa 1030) */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
    padding: 0.7rem 1rem;
}

.cookie-banner-contenido {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
}

.cookie-banner-texto {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.86rem;
    color: #334155;
    line-height: 1.45;
    flex: 1 1 340px;
    min-width: 0;
}

.cookie-banner-texto i {
    color: #1d4ed8;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.cookie-banner-botones {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Animación de entrada suave (se muestra vía cookies.js quitando .d-none) */
.cookie-banner:not(.d-none) {
    animation: cookieSubir 0.35s ease-out;
}

@keyframes cookieSubir {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ---------------------------------------------------------------------
   Requisitos de contraseña (includes/password_politica.php)
   La lista se colorea en vivo desde assets/js/password_politica.js:
   gris = pendiente, verde = cumplido.
   --------------------------------------------------------------------- */
.password-reglas li {
    color: #64748b;
    line-height: 1.5;
}
.password-reglas li.cumplida {
    color: #16a34a;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Webcams de dos ópticas (Reolink 180°): las dos imágenes, una al lado de
   la otra. No hay modo "cosido": las ópticas comparten una franja central y
   unirlas por CSS dejaba una costura poco fiable, así que se muestran
   separadas, que es más honesto y se ve todo.
   El cambio de vista lo hace assets/js/webcams.js.
   --------------------------------------------------------------------- */
.webcam-marco[data-webcam-vista-actual="separadas"] {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    align-items: flex-start;
    /* El marco se ajusta a la imagen: si la foto es más estrecha que la
       columna, el recuadro oscuro la abraza en vez de dejar franjas gruesas
       a los lados (y el recuadro de datos queda sobre la foto, no sobre el
       fondo). Si la imagen es más ancha, max-width la mete en la columna. */
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}
.webcam-marco[data-webcam-vista-actual="separadas"] .webcam-optica {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}
/* Cámara de dos ópticas: las dos imágenes se reparten el ancho a la mitad
   (si no, al ser anchas se apilarían y sobraría fondo oscuro a los lados). */
.webcam-marco.es-doble[data-webcam-vista-actual="separadas"] {
    width: 100%;
}
.webcam-marco.es-doble[data-webcam-vista-actual="separadas"] .webcam-optica {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
}
.webcam-marco[data-webcam-vista-actual="separadas"] .webcam-optica img {
    /* Sin width:100%: la imagen manda en el tamaño, sin franjas dentro */
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
}


/* ---------------------------------------------------------------------
   Recuadro de datos de la estación ENCIMA de la imagen de una webcam
   (solo en la sección de webcams: listado, ficha y visor ampliado).
   Se dibuja con HTML/CSS, así que no toca el fichero de la imagen.
   --------------------------------------------------------------------- */
.webcam-overlay-datos {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 9px 5px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.55) 65%, rgba(15, 23, 42, 0));
    color: #f8fafc;
    font-size: 0.72rem;
    line-height: 1.25;
    z-index: 2;
    pointer-events: none;   /* se puede pulsar la imagen a través del recuadro */
}
/* Dentro del marco de la ficha (que lleva 8 px de relleno y se ajusta a la
   imagen) el recuadro se mete ese mismo margen para quedar SOBRE la foto y no
   sobre el fondo oscuro del marco. */
.webcam-overlay-datos.en-marco {
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 0 0 8px 8px;
}
.webcam-overlay-datos .wco-linea {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-weight: 700;
}
.webcam-overlay-datos .wco-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.webcam-overlay-datos .wco-pie {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
    margin-top: 1px;
    font-size: 0.62rem;
    color: rgba(248, 250, 252, 0.78);
}
.webcam-overlay-datos .wco-estacion,
.webcam-overlay-datos .wco-hora {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}
