/* static/css/modal.css */
/* Contenedor oscuro de fondo */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 21, 38, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* --- LÓGICA DE FADE --- */
    opacity: 0;
    pointer-events: none; /* Evita que bloquee clics cuando está invisible */
    transition: opacity 0.4s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* El "Pop-up" con medidas de Shorts/Reels */
.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px; /* Ancho típico de un Reel */
    aspect-ratio: 9 / 16;
    background: #050a14;
    border: 1px solid #0a1526;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.9);
    transition: transform 0.4s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* El video ocupa todo el contenedor */
.modal-video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Cambiado a contain para que los controles se vean completos */
    background-color: black;
}

/* La X de cierre (video modal + base del popup) */
.close-btn {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    z-index: 2000; /* Un valor alto para que no lo tapen los controles del video */
    background: rgba(10, 21, 38, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 0;
    transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.close-btn:hover {
    background: #b61e25;
    border-color: transparent;
    transform: scale(1.08);
}

/* Clase para ocultar elementos */
.hidden {
    display: none !important;
}

/* Ajustes para móviles muy pequeños */
@media (max-height: 700px) {
    .modal-content {
        height: 90vh; /* Ajusta la altura si la pantalla es muy bajita */
        width: auto;
    }
}

/* Contenedor del Pop-up Temporal */
.temporal-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 21, 38, 0.82);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Por encima de todo */
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    /* Estado inicial: visible */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* El contenido se ajusta a la imagen */
.temporalPopUp-content {
    position: relative;
    width: fit-content;
    max-width: 90%;
    max-height: 80vh;
    background: #050a14;
    border: 1px solid #0a1526;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(1);
    transition: transform 0.5s ease;
}

.temporal-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* Clase para el cierre suave */
.temporal-popup.fade-out {
    opacity: 0;
    visibility: hidden;
}

.temporal-popup.fade-out .temporalPopUp-content {
    transform: scale(0.9);
}

/* Botón de cierre del popup con anillo de cuenta regresiva */
.popup-countdown-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 0; /* el número reemplaza a la X mientras cuenta */
    padding: 0;
}

.popup-countdown-ring {
    position: absolute;
    inset: 0;
    width: 40px;
    height: 40px;
    transform: rotate(-90deg); /* arranca desde arriba, no desde la derecha */
    pointer-events: none;
}

.popup-countdown-ring-bg,
.popup-countdown-ring-progress {
    fill: none;
    stroke-width: 2.5;
}

.popup-countdown-ring-bg {
    stroke: rgba(255, 255, 255, 0.2);
}

.popup-countdown-ring-progress {
    stroke: #b61e25;
    stroke-linecap: round;
    /* stroke-dasharray/dashoffset se calculan en JS según el radio real */
    transition: stroke-dashoffset 0.9s linear;
}

.popup-countdown-number {
    position: relative;
    z-index: 1;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.popup-countdown-btn:hover .popup-countdown-number {
    display: none;
}

.popup-countdown-btn:hover::after {
    content: "\00d7";
    position: relative;
    z-index: 1;
    font-size: 22px;
    color: #fff;
    line-height: 1;
}

.popup-countdown-btn:hover .popup-countdown-ring {
    display: none;
}