/* Contenedor oscuro de fondo */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    
    /* --- 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: #000;
    border: 2px solid white; /* Borde blanco solicitado */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    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 */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 35px;
    color: white;
    cursor: pointer;
    z-index: 2000; /* Un valor alto para que no lo tapen los controles del video */
    background: rgba(0, 0, 0, 0.3); /* Un pequeño fondo para que se vea sobre el video */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 0;
}

.close-btn:hover {
    transform: scale(1.2);
}

/* 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(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Por encima de todo */
    backdrop-filter: blur(8px);
    
    /* 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: #000;
    border: 3px solid white; /* Borde blanco igual al modal */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    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);
}

/* Reutilizamos el estilo de tu X de cierre */
#closePopup {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    color: white;
    cursor: pointer;
    z-index: 3001;
    background: rgba(0, 0, 0, 0.5);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 0;
}