/**
 * 2007-2025 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 *
 * @author    Alfa Technologies
 * @copyright 2007-2025 Alfa Technologies
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 */

/* Overlay del popup - ID único para evitar conflictos */
/* CRÍTICO: Cuando está oculto, usar position: absolute y z-index negativo para NO crear stacking context */
#alfatech-popup-overlay {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: -9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: alfatech-fadeIn 0.3s ease-in-out;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    /* Asegurar que no cree stacking context cuando está oculto */
    transform: scale(0);
}

/* Solo cuando está visible: aplicar position: fixed y z-index alto */
#alfatech-popup-overlay[style*="display: flex"],
#alfatech-popup-overlay[style*="display:flex"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99998 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Contenedor del popup - Solo dentro de nuestro overlay */
#alfatech-popup-overlay .alfatech-popup-container {
    position: relative;
    background-color: transparent !important;
    background: transparent !important;
    border-radius: 8px;
    box-shadow: none;
    max-width: 90%;
    max-height: 90%;
    overflow: visible;
    animation: alfatech-slideIn 0.3s ease-in-out;
    display: inline-block;
}

/* Botón de cerrar - Fuera de la imagen, en la esquina superior derecha */
#alfatech-popup-overlay .alfatech-popup-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.8);
    font-size: 24px;
    line-height: 1;
    color: #ffffff;
    cursor: pointer;
    z-index: 1000000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#alfatech-popup-overlay .alfatech-popup-close:hover {
    background-color: rgba(0, 0, 0, 0.9);
    border-color: #ffffff;
    color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Contenido del popup */
#alfatech-popup-overlay .alfatech-popup-content {
    padding: 0;
    background: transparent;
}

/* Imagen del popup */
#alfatech-popup-overlay .alfatech-popup-image {
    max-width: 100%;
    height: auto;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* HTML del popup */
#alfatech-popup-overlay .alfatech-popup-html {
    max-width: 100%;
}

/* Animaciones */
@keyframes alfatech-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes alfatech-slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #alfatech-popup-overlay .alfatech-popup-container {
        max-width: 95%;
        max-height: 95%;
    }
    
    #alfatech-popup-overlay .alfatech-popup-content {
        padding: 0;
    }
    
    #alfatech-popup-overlay .alfatech-popup-close {
        top: -12px;
        right: -12px;
        font-size: 22px;
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    #alfatech-popup-overlay .alfatech-popup-container {
        max-width: 98%;
        max-height: 98%;
        border-radius: 0;
    }
    
    #alfatech-popup-overlay .alfatech-popup-content {
        padding: 0;
    }
    
    #alfatech-popup-overlay .alfatech-popup-close {
        top: -10px;
        right: -10px;
        font-size: 20px;
        width: 32px;
        height: 32px;
    }
}

/* SOLUCIÓN CRÍTICA: Eliminar el z-index problemático del footer */
/* Este CSS tiene máxima especificidad para sobrescribir cualquier z-index del footer */
html body .footer-container,
html body .footer-container *,
html body .footer-container p,
html body .footer-container span,
html body .footer-container div,
html body #footer_sub_menu_store_info,
html body #footer_sub_menu_store_info *,
html body .tvfooter-addresses,
html body .tvfooter-addresses *,
html body .tvfooter-store-link-content,
html body .tvfooter-store-link-content * {
    z-index: auto !important;
    position: relative !important;
}

/* Regla adicional con máxima especificidad para asegurar que sobrescriba */
body#index .footer-container,
body#index .footer-container *,
body#index .footer-container p,
body#index .footer-container span,
body#index .footer-container div,
body#index #footer_sub_menu_store_info,
body#index #footer_sub_menu_store_info *,
body#index .tvfooter-addresses,
body#index .tvfooter-addresses *,
body#index .tvfooter-store-link-content,
body#index .tvfooter-store-link-content * {
    z-index: auto !important;
    position: relative !important;
}

