/* resorts/templates/resorts/estado_pistas.html */

.ep-metric-label {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.ep-meteorologia,
.ep-forecast-section {
    border-inline-start: none !important;
    border-top: 3px solid #1976d2;
}

.ep-forecast-section {
    border-top-color: #ff9800;
}

/* Webcams */
.ep-webcams {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
}

.ep-webcams .ep-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
}

.ep-webcams .ep-section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #800020, #a0002a);
    color: #fff;
    border-radius: 10px;
    flex-shrink: 0;
}

.ep-webcams-resort {
    color: #800020;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #800020;
}

.ep-webcams-resort i {
    margin-inline-end: 0.5rem;
}

/* Por que Candanchu no muestra imagen: sus camaras estan en un plan de
   ipcamlive que prohibe la incrustacion (ver resorts/webcams.py). Decirlo
   evita que cinco tarjetas sin foto parezcan un fallo de la pagina. */
.ep-webcams-note {
    margin: -0.5rem 0 1rem 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #6b7780;
    max-width: 60ch;
}

/* `auto-fill`, no `auto-fit`: con auto-fit las pistas vacias colapsan y el
   `1fr` reparte todo el sobrante entre las tarjetas que hay, asi que las 3
   camaras de Astun salian a ~400px y las 5 de Candanchu a ~234px en la
   misma pagina. Con auto-fill las pistas vacias se quedan y todas las
   tarjetas miden igual, que es lo que el usuario espera de dos rejillas
   identicas una debajo de otra. */
.ep-webcams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.ep-webcams-grid:last-child {
    margin-bottom: 0;
}

.webcam-card {
    text-decoration: none;
    display: block;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.webcam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

.webcam-card:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #800020;
}

.ep-webcam-media {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #4a0012;
}

.ep-webcam-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ep-webcam-fallback {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(145deg, #5c0018, #800020 55%, #3a000e);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.85rem;
    font-weight: 600;
}

.ep-webcam-fallback i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.ep-webcam-media.is-broken .ep-webcam-img {
    display: none;
}

.ep-webcam-media.is-broken .ep-webcam-fallback {
    display: flex;
}

.ep-webcam-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 0.6rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    z-index: 1;
}

.ep-webcam-badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    /* #c62828 en vez de rgba(244,67,54,.9): con blanco encima aquel daba
       ~3.7:1 y WCAG AA pide 4.5:1 para texto pequeno en negrita. */
    background: #c62828;
    color: #fff;
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    z-index: 1;
    letter-spacing: 0.02em;
}

.ep-webcam-media.is-broken .ep-webcam-badge {
    background: rgba(255, 255, 255, 0.2);
    animation: none;
}

.ep-webcam-media:not(.is-broken) .ep-webcam-badge {
    animation: pulse 2s infinite;
}

.ep-webcam-badge i {
    font-size: 0.4rem;
    margin-inline-end: 0.2rem;
}

/* Mobile-first responsive styles for Estado de Pistas */
@media (max-width: 767.98px) {
    /* Hero adjustments */
    .ep-hero { padding: 2rem 0 !important; padding-top: 7rem !important; }
    .ep-hero h1 { font-size: 1.4rem !important; }
    .ep-hero p { font-size: 0.95rem !important; }
    
    /* Card headers - stack on mobile */
    .ep-card-header { 
        flex-direction: column !important; 
        gap: 1rem !important;
        align-items: flex-start !important;
    }
    .ep-card-header a { 
        width: 100% !important; 
        text-align: center !important;
        padding: 0.75rem !important;
    }
    
    /* Metrics grid - adjust for mobile */
    .ep-metrics { 
        grid-template-columns: repeat(3, 1fr) !important; 
        gap: 0.5rem !important;
    }
    .ep-metric-value { font-size: 1.4rem !important; }
    .ep-metric-label { font-size: 0.65rem !important; letter-spacing: 0.5px !important; }
    .ep-metric-box { padding: 0.75rem 0.5rem !important; }
    
    /* Instalaciones section - stack on mobile */
    .ep-installations { 
        display: block !important;
    }
    .ep-installations > div { 
        margin-bottom: 1rem !important; 
    }
    
    /* Meteorologia section - optimize for mobile */
    .ep-meteorologia {
        border-top: 3px solid #1976d2 !important;
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    .ep-meteorologia > div { 
        font-size: 0.85rem !important; 
        margin-bottom: 0.25rem !important;
    }
    
    /* Forecast section */
    .ep-forecast-section { 
        padding: 0.75rem !important; 
        margin-bottom: 0.75rem !important;
    }
    .ep-forecast-section h4 { 
        font-size: 0.9rem !important; 
        margin-bottom: 0.5rem !important;
    }
    .ep-forecast-section p { 
        font-size: 0.85rem !important; 
        line-height: 1.4 !important;
    }
    
    /* Webcams grid */
    .ep-webcams {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }
    .ep-webcams-grid { 
        grid-template-columns: 1fr 1fr; 
        gap: 0.75rem;
    }
    .ep-webcam-label { font-size: 0.75rem; padding: 0.5rem; }
    .ep-webcam-badge { font-size: 0.6rem; padding: 0.15rem 0.35rem; }
    
    /* Weather section */
    .ep-weather-grid { grid-template-columns: 1fr 1fr !important; gap: 0.75rem !important; }
    .ep-weather-box { padding: 1rem !important; }
    .ep-weather-temp { font-size: 2rem !important; }
    
    /* Forecast days */
    .ep-forecast-days { gap: 0.25rem !important; }
    .ep-forecast-day { padding: 0.5rem 0.25rem !important; min-width: 50px !important; }
    .ep-forecast-icon { font-size: 1rem !important; }
    .ep-forecast-temps { font-size: 0.7rem !important; }
    
    /* Avalanche section */
    .ep-avalanche-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }
    .ep-avalanche-indicator { 
        width: 70px !important;
        height: 70px !important;
        font-size: 2rem !important;
    }
    .ep-avalanche-info { 
        font-size: 1rem !important;
    }
    .ep-avalanche-warning { 
        padding: 1rem !important;
        margin-top: 0.5rem !important;
    }
    .ep-avalanche-warning i { 
        font-size: 1.5rem !important;
    }
    
    /* Avalanche scale - horizontal scroll on very small */
    .ep-avalanche-scale { 
        gap: 0.25rem !important; 
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }
    .ep-avalanche-item { 
        font-size: 0.6rem !important; 
        padding: 0.5rem 0.15rem !important;
        min-width: 55px !important;
        flex-shrink: 0 !important;
    }
    
    /* Section padding */
    .ep-section { padding: 1.25rem !important; border-radius: 16px !important; }
    .ep-section-title { font-size: 1.1rem !important; margin-bottom: 1rem !important; }
    .ep-section-icon { width: 32px !important; height: 32px !important; }
    
    /* CTA */
    .ep-cta { padding: 2rem 1rem !important; }
    .ep-cta h2 { font-size: 1.4rem !important; }
    .ep-cta-buttons { flex-direction: column !important; gap: 0.75rem !important; }
    .ep-cta-btn { width: 100% !important; justify-content: center !important; }
    
    /* Disclaimer */
    .ep-disclaimer { padding: 1rem !important; font-size: 0.85rem !important; }
}

@media (max-width: 480px) {
    .ep-hero h1 { font-size: 1.2rem !important; }
    .ep-metrics { grid-template-columns: repeat(3, 1fr) !important; }
    .ep-metric-value { font-size: 1.2rem !important; }
    .ep-metric-label { font-size: 0.6rem !important; }
    .ep-webcams-grid { grid-template-columns: 1fr; }
    .ep-weather-grid { grid-template-columns: 1fr !important; }
    .ep-avalanche-indicator { width: 60px !important; height: 60px !important; font-size: 1.8rem !important; }
    .ep-section { padding: 1rem !important; }
    .ep-section-title { font-size: 1rem !important; }
    .ep-cta { padding: 1.5rem 1rem !important; }
    .ep-cta h2 { font-size: 1.2rem !important; }
    .ep-cta p { font-size: 0.95rem !important; }
}

/* Animación para indicador LIVE */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
