/* Modal de Tienda en Línea */

/* Overlay que cubre toda la pantalla */
.store-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    /* Asegurar que esté por encima de todos los elementos del navbar */
    pointer-events: none;
}

.store-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal principal */
.store-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 872px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    padding-top: 32px;
    z-index: 10001;
    /* Asegurar que los clicks funcionen correctamente */
    pointer-events: auto;
}

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

/* Header de la modal */
.store-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-bottom: 24px;
    padding: 8px 20px;
}

.store-modal-close {
    background: none;
    position: absolute;
    right: 20px;
    top: 20px;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.store-modal-close:hover {
    background-color: #f5f5f5;
    color: #000;
}

/* Contenido de la modal */
.store-modal-content {
    padding: 0 100px 10px;
    height: 428px;
}

/* Sección de color */
.store-color-section {
    margin-bottom: 32px;
}

.store-color-section:last-child {
    margin-bottom: 0;
}

.store-color-title {
    font-size: 12px;
    font-weight: 600;
    color: #000;
    margin: 0 0 8px 0;
    line-height: 20px;
}

/* Estilos específicos para móvil en secciones de color */
@media (max-width: 768px) {
    .store-color-section {
        margin-bottom: 24px;
    }
    
    .store-color-title {
        font-size: 14px;
        font-weight: 600;
        color: #333;
        margin: 0 0 12px 0;
        padding-left: 4px;
    }
}

/* Grid de opciones de tienda */
.store-options-grid {
    display: flex;
    justify-content: start;
    align-items: center;
}

/* Opción de tienda individual */
.store-option {
    display: block;
    text-decoration: none;
    width: 128px;
    height: 100px;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-right: 8px;
    margin-bottom: 8px;
}

.store-logo{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f6f6f6;
    border-radius: 8px;
}

.store-logo img{
    display: block;
    height: 60px;
    object-fit: contain;
    width: 88px;
}


/* Responsive Design */
@media (max-width: 768px) {
    .store-modal-overlay {
        /* Forzar que esté por encima de cualquier elemento móvil */
        z-index: 999999 !important;
        /* Cambiar alineación para que el modal esté en la parte inferior */
        align-items: flex-end;
        justify-content: center;
        /* Background más sutil para que se vea el navbar oscurecido */
        background: rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(2px) !important;
    }
    
    .store-modal {
        /* Ancho completo en móvil */
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        /* Altura ajustable con scroll */
        max-height: 70vh;
        min-height: 60vh;
        /* Asegurar z-index muy alto en móvil */
        z-index: 999999 !important;
        /* Bordes redondeados solo arriba */
        border-radius: 20px 20px 0 0 !important;
        /* Animación slide-up desde abajo */
        transform: translateY(100%) !important;
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1) !important;
        /* Sombra mejorada */
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2) !important;
    }

    .store-modal-overlay.active .store-modal {
        transform: translateY(0) !important;
    }

    .store-modal-header {
        padding: 24px 20px 16px;
        border-bottom: 1px solid #f0f0f0;
    }

    .store-modal-title {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 0;
        text-align: center;
    }

    .store-modal-close {
        /* Mejorar el botón de cerrar para móvil */
        width: 36px !important;
        height: 36px !important;
        background-color: #f8f8f8 !important;
        border-radius: 50% !important;
        top: 16px !important;
        right: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .store-modal-close:hover {
        background-color: #f0f0f0 !important;
    }

    .store-modal-close svg {
        width: 18px !important;
        height: 18px !important;
        stroke: #666 !important;
    }

    .store-modal-content {
        padding: 20px;
        /* Permitir scroll vertical */
        overflow-y: auto;
        max-height: calc(70vh - 100px);
    }

    /* Cambiar grid a flexbox con wrap para mejor control */
    .store-options-grid {
        display: flex !important;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: flex-start;
        align-items: flex-start;
    }

    /* Hacer elementos más cuadrados y compactos */
    .store-option {
        width: calc(50% - 6px) !important;
        height: 80px !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }

    .store-logo {
        width: 100%;
        height: 100%;
        padding: 8px !important;
        min-height: 80px !important;
        border-radius: 12px !important;
        background-color: #f8f8f8 !important;
    }

    .store-logo img {
        height: 50px !important;
        width: auto !important;
        max-width: 90% !important;
    }
}

@media (max-width: 480px) {
    .store-modal {
        /* En pantallas más pequeñas, aumentar un poco la altura */
        max-height: 75vh !important;
        min-height: 65vh !important;
    }

    .store-options-grid {
        /* Mantener flexbox con wrap */
        display: flex !important;
        flex-wrap: wrap;
        gap: 10px;
    }

    .store-option {
        /* En pantallas pequeñas, elementos un poco más grandes */
        width: calc(50% - 5px) !important;
        height: 85px !important;
    }

    .store-logo {
        min-height: 85px !important;
        padding: 10px !important;
    }

    .store-logo img {
        height: 45px !important;
    }

    .store-modal-header {
        padding: 20px 16px 12px;
    }

    .store-modal-content {
        padding: 16px;
        max-height: calc(75vh - 90px);
    }

    .store-modal-title {
        font-size: 18px;
    }
}

/* Bloquear scroll cuando la modal está activa */
body.modal-open {
    overflow: hidden;
}

/* Prevenir interferencia con elementos del navbar móvil cuando el modal está activo */
.store-modal-overlay.active ~ * .mobile-icons,
.store-modal-overlay.active ~ * .mobile-menu-overlay,
.store-modal-overlay.active ~ * .mobile-search-modal,
.store-modal-overlay.active ~ * .mobile-user-dropdown {
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Asegurar que el modal siempre esté disponible para clicks */
.store-modal-overlay.active,
.store-modal-overlay.active .store-modal,
.store-modal-overlay.active .store-modal * {
    pointer-events: auto !important;
}
