/* ============================================
   Estilos de la barra superior
   ============================================ */

header {
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-top {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    height: clamp(2.5rem, 5vw, 3.5rem);
    padding: 10px var(--espaciado-general);
    box-shadow: var(--shadow--natural);
    z-index: 2;
    
}
.header-top a {
    height: 100%;
}
.header-top img {
    height: 100%;
}

/* ============================================
   Badge de Envio Gratis
   ============================================ */

header .badge-envio-gratis-header {
    display: flex;
    flex-direction: row;
    letter-spacing: var(--espaciado--texto);
}

.header-top .header-rigt {
    align-items: center;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.header-top .header-rigt nav {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-content: center;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: center;
}


header .badge-envio-gratis-header .badge-header-p1 {
    font-size: clamp(10px, 1vw, 20px);
    color: white;
    background-color: var(--color--primary);
    margin: 0px;
    padding: 10px;
    z-index: 2;
    border-radius: 50px 50px 50px 0px;
}

header .badge-envio-gratis-header .badge-header-p2 {
    font-size: clamp(10px, 1vw, 20px);
    color: var(--color--primary);
    background-color: var(--color--secondary);
    margin: 0px;
    margin-left: -20px;
    padding: 10px 15px 10px 30px;
    z-index: 1;
    border-radius: 0px 50px 50px 0px;
    line-height: 1;
    align-self: center;
}

@media (max-width: 1068px) {
    header .badge-envio-gratis-header {
        display: none;
    }
}

/* ============================================
   Menu movil
   ============================================ */

.links-container {
    display: none;
}

.links-container a {
    text-decoration: none;
    color: black;
    width: 100%;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

.links-container a:hover {
    background-color: var(--color--hover_tertiary);
}


#sidebar-active {
    display: none;
}

.open-sidebar-button, .close-sidebar-button {
    display: none;
}

@media (max-width: 800px) {
    .header-rigt .nav-primary .btn:not(.boton-sesion){
        display: none !important;
    }
    .links-container {
        display: flex;
        flex-direction: column;
        align-items: flex-start;

        position: fixed;
        top: 0;
        right: -100%;
        z-index: 10;
        width: 300px;
        height: 100vh;
        
        /* 👇 ESTO ES LO QUE FALTA - Permitir scroll vertical */
        overflow-y: auto;
        overflow-x: hidden;
        
        background-color: white;
        transition: var(--tiempo--transiciones) ease-out;
    }
    .links-container a {
        box-sizing: border-box;
        height: auto;
        width: 100%;
        padding: 20px 30px;
        justify-content: flex-start;
    }
    .open-sidebar-button, .close-sidebar-button {
        display: block;
        cursor: pointer;
    }
    .close-sidebar-button {
        padding: 20px;
    }
    #sidebar-active:checked ~ .links-container{
        right: 0 !important;
    }
    #sidebar-active:checked ~ #overlay {
        background: rgba(0, 0, 0, 0.85);;
        height: 100%;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
    }
    .header-top .header-rigt nav {
        flex-direction: row-reverse;
    }
        
    /* Opcional: mejorar la apariencia del scrollbar */
    .links-container::-webkit-scrollbar {
        width: 4px;
    }
    
    .links-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .links-container::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }
    
    .links-container::-webkit-scrollbar-thumb:hover {
        background: #15ad3c;
    }
    
    /* Asegurar que los elementos ocupen el ancho correcto */
    .links-container a,
    .menu-item-categorias-movil {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ==============================================
   MENÚ DE CATEGORÍAS MÓVIL - ACORDEÓN
   ============================================== */

/* Ocultar el botón desktop en móvil */
@media (max-width: 800px) {
    .boton-categorias,
    #nav-categorias {
        display: none !important;
    }
    
    /* Estilos del acordeón móvil */
    .menu-item-categorias-movil {
        width: 100%;
        border-bottom: 1px solid #eee;
    }
    
    .categorias-movil-header {
        display: flex;
        align-items: center;
        gap: 5px;
        padding: 20px 30px;
        cursor: pointer;
        background-color: white;
        transition: background 0.2s ease;
        width: 100%;
        box-sizing: border-box;
    }
    
    .categorias-movil-header:hover {
        background-color: var(--color--hover_tertiary, #f5f5f5);
    }
    
    .categorias-movil-header .icon-box {
        width: 16px;
        height: 16px;
        background-size: contain;
        background-repeat: no-repeat;
    }
    
    .categorias-movil-header .boton-text {
        flex: 1;
        text-align: left;
        font-size: var(--tamaño--secundario) ;
        font-weight: 500;
        letter-spacing: 1px;
    }
    
    .categorias-movil-header .icon-arrow-down-movil {
        width: 16px;
        height: 16px;
        display: inline-block;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        transition: transform 0.3s ease;
    }
    
    /* Rotación de la flecha cuando está abierto */
    .menu-item-categorias-movil.open .categorias-movil-header .icon-arrow-down-movil {
        transform: rotate(180deg);
    }
    
    /* Submenú de categorías */
    .categorias-movil-submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-out;
        background-color: #f9f9f9;
    }
    
    .menu-item-categorias-movil.open .categorias-movil-submenu {
        max-height: 500px; /* Ajusta según el número de categorías */
        transition: max-height 0.4s ease-in;
    }
    
    .categoria-movil-item {
        display: block;
        padding: 12px 30px 12px 55px;
        text-decoration: none;
        color: #333;
        font-size: 0.9rem;
        border-top: 1px solid #eee;
        transition: background 0.2s ease;
    }
    
    .categoria-movil-item:hover {
        background-color: var(--color--hover_tertiary, #f0f0f0);
        color: var(--color--primary, #15ad3c);
    }
    
    /* Ajustes para los otros elementos del menú móvil */
    .links-container a {
        border-bottom: 1px solid #eee;
    }
}

/* ==============================================
   MENÚ DE TIENDAS MÓVIL - ACORDEÓN
   ============================================== */

/* Ocultar el botón desktop en móvil */
@media (max-width: 800px) {
    .boton-tiendas,
    #nav-tiendas {
        display: none !important;
    }
    
    /* Estilos del acordeón de tiendas */
    .menu-item-tiendas-movil {
        width: 100%;
        border-bottom: 1px solid #eee;
    }
    
    .tiendas-movil-header {
        display: flex;
        align-items: center;
        gap: 5px;
        padding: 20px 30px;
        cursor: pointer;
        background-color: white;
        transition: background 0.2s ease;
        width: 100%;
        box-sizing: border-box;
    }
    
    .tiendas-movil-header:hover {
        background-color: var(--color--hover_tertiary, #f5f5f5);
    }
    
    .tiendas-movil-header .icon-shop {
        width: 16px;
        height: 16px;
        background-size: contain;
        background-repeat: no-repeat;
    }
    
    .tiendas-movil-header .boton-text {
        flex: 1;
        text-align: left;
        font-size: var(--tamaño--secundario);
        font-weight: 500;
        letter-spacing: 1px;
    }
    
    .tiendas-movil-header .icon-arrow-down-movil {
        width: 16px;
        height: 16px;
        display: inline-block;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        transition: transform 0.3s ease;
    }
    
    /* Rotación de la flecha cuando está abierto */
    .menu-item-tiendas-movil.open .tiendas-movil-header .icon-arrow-down-movil {
        transform: rotate(180deg);
    }
    
    /* Submenú de tiendas */
    .tiendas-movil-submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-out;
        background-color: #f9f9f9;
    }
    
    .menu-item-tiendas-movil.open .tiendas-movil-submenu {
        max-height: 400px; /* Ajusta según el número de tiendas */
        overflow-y: auto;
        transition: max-height 0.4s ease-in;
    }
    
    .tienda-movil-item {
        display: block;
        padding: 12px 30px 12px 55px;
        text-decoration: none;
        color: #333;
        font-size: 0.9rem;
        border-top: 1px solid #eee;
        transition: background 0.2s ease;
    }
    
    .tienda-movil-item:hover {
        background-color: var(--color--hover_tertiary, #f0f0f0);
        color: var(--color--primary, #15ad3c);
    }
    
    .tienda-movil-item.no-stores {
        color: #999;
        cursor: default;
    }
    
    .tienda-movil-item.no-stores:hover {
        background-color: transparent;
        color: #999;
    }
    
    /* Scrollbar del submenú de tiendas */
    .tiendas-movil-submenu::-webkit-scrollbar {
        width: 3px;
    }
    
    .tiendas-movil-submenu::-webkit-scrollbar-track {
        background: #e0e0e0;
    }
    
    .tiendas-movil-submenu::-webkit-scrollbar-thumb {
        background: #15ad3c;
        border-radius: 3px;
    }
}

/* ==============================================
   Menu inferior
   ============================================== */

.header-bottom {
    display: flex;
    height: min(45px, 45px);
    background-color: var(--color--secondary);
    box-shadow: var(--shadow--natural);
    padding: 0px var(--espaciado-general);
    justify-content: space-between;
    align-items: center;
    anchor-name: --header-bottom;
}

/* ==============================================
   Selector de ubicacion
   ============================================== */

.ubicacion-selector-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    background: transparent;
    border: none;
    color: black;
    filter: opacity(0.5);
    font-size: var(--tamaño--secundario);
    font-weight: 500;
    transition: all var(--tiempo--transiciones) ease;
    text-decoration: none;
    line-height: 30px;
    outline: none;
    box-shadow: none;
    font-family: inherit;
    position: relative;
    text-transform: capitalize;
    cursor: pointer;
}

.ubicacion-selector-btn .ubicacion-text { 
    text-decoration: none; 
    transition: all var(--tiempo--transiciones) ease; 
}
.ubicacion-selector-btn:hover { 
    background: transparent; 
    transform: none; 
}
.ubicacion-selector-btn:hover .ubicacion-text { 
    text-decoration: underline; 
    text-underline-offset: var(--text-decoration-hover-offset); 
}
.ubicacion-icon { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 16px; 
    height: 16px; 
    flex-shrink: 0; 
}
.ubicacion-text { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: min(50vw, 300px); 
    line-height: inherit; 
}

.ubicacion-modal { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 2000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: rgba(0, 0, 0, 0.85); 
    animation: ubModalFadeIn 0.2s ease-out; 
    font-family: inherit; 
}

@keyframes ubModalFadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}


.ubicacion-modal-content { 
    background-image: url(../img/Img-popup.webp);
    background-position: top right;
    background-size: contain;
    border-radius: 10px;
    width: min(750px, 90%);
    height: min(400px, 90vw);
    animation: ubContentSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    position: relative;
}
@keyframes ubContentSlideIn { 
    from { opacity: 0; transform: translateY(-15px) scale(0.98); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}
.ubicacion-modal-body {
    background-color: white;
    height: 100%;
    width: min(350px, 100%);
    padding: 20px;
    border-radius: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 2px 0px 20px 10px rgba(0, 0, 0, 0.1);
}
.ubicacion-modal-header { 
    display: flex;
    padding: 20px 20px;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
    align-items: center;
    justify-content: space-between;
}
#ubicacion-modal-title { 
    margin: 0; 
    font-size: 18px; 
    color: #000; 
    font-weight: 600; 
    line-height: 1.3; 
    text-transform: uppercase;
    margin-bottom: 20px;
}
#ubicacion-selector-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.ubicacion-form-group { 
    width: 100%;
    display: flex; 
    justify-content: center; 
}
.ubicacion-label { 
    display: flex;
    flex-shrink: 0;
    width: 40px;
    height: auto;
    background-color: var(--color--primary);
    border-radius: 5px 0 0 5px;
    justify-content: center;
    align-items: center;
}
.ubicacion-label span {
    width: 20px;
    height: 20px;
}
.ubicacion-form-group:has(select:focus) > .ubicacion-label {
    background-color: var(--color--tertiary);
}
.spinner { 
    display: flex;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    border-top-color: white !important;
    animation: ubSpin 0.8s linear infinite !important;
}
@keyframes ubSpin { 
    to { transform: rotate(360deg); } 
}
.ubicacion-message { 
    padding: 10px; 
    border-radius: 4px; 
    margin-top: 20px; 
    text-align: center; 
    font-size: 14px; 
}
.ubicacion-message.success { 
    background: #d4edda; 
    color: #155724; 
    border: 1px solid #c3e6cb; 
}
.fkcart-shortcode-container .fkcart-shortcode-icon-wrap {
    gap: 5px;
}
.fkcart-shortcode-icon-wrap .fkcart-icon-checkout {
    width: 1rem !important;
}
.fkcart-shortcode-icon-wrap .fkcart-icon-checkout, 
.fkcart-shortcode-icon-wrap::after {
    filter: opacity(0.5);
}
.fkcart-shortcode-icon-wrap::after {
    content: 'Carrito';
    font-size: .8rem;
    font-weight: 500;
}

/* Sub menu Categorias */
.boton-categorias, 
.boton-tiendas {
    cursor: pointer;
}
.boton-tiendas {
    anchor-name: --btn-tiendas;
}
.boton-categorias {
    anchor-name: --btn-categorias;
}

#nav-tiendas {
    position-anchor: --btn-tiendas;
}
#nav-categorias {
    position-anchor: --btn-categorias;
}
#nav-categorias, 
#nav-tiendas {
    position: absolute;
    position-area: bottom span-right;
    border: none;
    border-radius: 5px;
    box-shadow: var(--shadow--natural);
    background: white;
    z-index: 999;
    
    /* Oculto por defecto */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(50px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}
#nav-categorias .categoria-elemento, 
#nav-tiendas .tienda-elemento {
    display: flex;
    text-decoration: none;
    color: var(--color--text_secondary);
    height: 30px;
    align-items: center;
    justify-content: flex-start;
    padding: 5px 20px;
}
#nav-categorias .categoria-elemento:hover, 
#nav-tiendas .tienda-elemento:hover {
    background-color: var(--color--secondary);
    border-radius: 5px;
}
#nav-tiendas .tienda-elemento h3,
#nav-categorias .categoria-elemento h3 {
    font-size: .8rem;
    font-weight: 400;
    margin: 0;
}

/* Mostrar menú al hacer hover en el botón O en el menú */
.boton-categorias:hover + #nav-categorias.categorias-popover,
#nav-categorias.categorias-popover:hover,
.boton-tiendas:hover + #nav-tiendas,
#nav-tiendas:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Estilo para evitar que el indicador del carrito se superponga a todo */

.fkcart-shortcode-container .fkcart-shortcode-count {
    z-index: 1 !important;
}