/* app/assets/css/popup.css */

/* ========================================
   OVERLAY - CAPTURA TODOS LOS CLICS
   ======================================== */
#popupOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    cursor: pointer;
    pointer-events: auto;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ========================================
   BANNER DE POPUPS - CENTRADO
   ======================================== */
.banner-popups-flotante {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 9999;
    width: var(--banner-width, 400px);
    background: transparent !important;
    padding: 10px;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* ========================================
   CONTENEDOR INTERNO - CAPTURA EVENTOS
   ======================================== */
.popups-container-fila {
    display: flex;
    gap: 20px;
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    position: relative;
    max-width: 100%;
}

.popup-item-fila {
    flex-shrink: 0;
    pointer-events: auto;
}

.popup-enlace-fila {
    display: block;
    text-decoration: none;
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.popup-enlace-fila:hover {
    transform: scale(1.02);
}

.popup-imagen-contenedor-fila {
    width: var(--img-width, 350px);
    height: var(--img-height, 350px);
    min-height: 300px;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.popup-imagen-fila {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.popup-fallback-fila {
    display: none;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    align-items: center;
    justify-content: center;
    color: #666;
    font-weight: bold;
    border-radius: 10px;
    position: absolute;
    top: 0;
    left: 0;
}

/* ========================================
   BOTÓN DE CIERRE
   ======================================== */
.btn-cerrar-popups {
    position: absolute;
    top: -18px;
    right: -18px;
    background: #dc3545;
    color: white;
    border: 3px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 22px;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    pointer-events: auto;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-cerrar-popups:hover {
    transform: scale(1.1) !important;
    background: #c82333;
}

.btn-cerrar-popups:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

/* ========================================
   PREVENIR SCROLL
   ======================================== */
body.popup-open {
    overflow: hidden !important;
    padding-right: var(--scrollbar-width, 0px);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .banner-popups-flotante {
        width: 95%;
        max-width: 500px;
    }
    
    .popups-container-fila {
        gap: 15px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .banner-popups-flotante {
        width: 98%;
        max-width: 400px;
        padding: 5px;
    }
    
    .popups-container-fila {
        flex-direction: column !important;
        align-items: center;
        gap: 15px;
        padding: 20px;
    }
    
    .popup-item-fila {
        width: 100% !important;
        max-width: 350px !important;
    }
    
    .popup-imagen-contenedor-fila {
        width: 100% !important;
        max-width: 350px;
        min-height: 200px;
        height: auto !important;
        aspect-ratio: 1/1;
    }
    
    .btn-cerrar-popups {
        top: -15px;
        right: -15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .popups-container-fila {
        padding: 15px;
    }
    
    .popup-imagen-contenedor-fila {
        min-height: 150px;
    }
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}