/* VARIABLES Y BASE DEL HEADER */
.site-header {
    background-color: #3B3B3B;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 0 !important;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center; /* Centra verticalmente Logo, Menú y Acciones */
    justify-content: space-between;
    min-height: 102px; /* Ajustado a la altura del logo */
    position: relative;
}

/* 1. LOGO (IZQUIERDA) */
.header-logo {
    display: flex;
    align-items: center;
    z-index: 1002;
}

.logo-img {
    width: 93px !important;
    height: 102px !important;
    display: block !important;
    object-fit: contain;
}

/* 2. MENÚ DESKTOP (CENTRO) */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation .nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 30px; /* Separación limpia entre ítems */
}

.main-navigation .nav-menu > li {
    position: relative;
}

/* Estilo y tamaño de fuente principal del menú */
.main-navigation a {
    color: #ffffff;
    text-decoration: none;
    font-size: 30px; /* Tamaño de letra para Desktop */
    font-weight: 500;
    padding: 8px 0;
    display: inline-block;
    position: relative;
    transition: color 0.3s ease;
}

/* Efecto Hover: Cambio de color a #7DF9F1 y línea animada inferior */
.main-navigation a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #7DF9F1;
    transition: width 0.3s ease;
}

.main-navigation a:hover {
    color: #7DF9F1;
}

.main-navigation a:hover::after {
    width: 100%;
}

/* DESPLEGABLE (SUB-MENÚ ESCRITORIO) */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #808080;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    min-width: 220px;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 4px;
    z-index: 1001;
}

.sub-menu li a {
    font-size: 15px; /* Más pequeño para sub-ítems */
    padding: 8px 16px;
    display: block;
    color: #ffffff;
}

.sub-menu li a::after {
    display: none; /* Sin línea inferior en el submenú */
}

.sub-menu li a:hover {
    background-color: rgba(0, 0, 0, 0.15);
    color: #7DF9F1;
}

/* Hover automático de submenú en Escritorio */
@media screen and (min-width: 993px) {
    .menu-item-has-children:hover > .sub-menu,
    .menu-item-has-children.hover-active > .sub-menu {
        display: block !important;
        animation: fadeIn 0.3s ease;
    }
}

/* 3. ACCIONES DERECHA */
.header-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    z-index: 1002;
}

.header-actions a,
.search-toggle {
    color: #ffffff;
    text-decoration: none;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color 0.3s ease, transform 0.2s ease;
}

.header-actions a:hover,
.search-toggle:hover {
    color: #7DF9F1;
    transform: scale(1.1);
}

/* CONTADOR CARRITO */
.cart-link {
    position: relative;
    display: flex;
    align-items: center;
}

.cart-count {
    background-color: #1a1a1a;
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 7px;
    margin-left: 5px;
}

/* BUSCADOR DESPLEGABLE */
.header-search {
    position: relative;
}

.search-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 45px;
    background-color: #ffffff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.search-dropdown.active {
    display: block;
}

.search-field {
    border: 1px solid #cccccc;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 4px;
    outline: none;
}

/* BOTÓN HAMBURGUESA Y MENÚ MOBILE */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
    transition: color 0.3s ease;
    pointer-events: auto !important;
}

.menu-toggle .hamburger-bar {
    pointer-events: none; /* Permite que el hover se registre limpiamente en el botón */
}

.menu-toggle:hover .hamburger-bar {
    background-color: #7DF9F1;
}

/* Previene que las barras internas bloqueen el evento mouseenter en JS */
.hamburger-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ffffff;
    margin-bottom: 4px;
    transition: background-color 0.3s ease;
    pointer-events: none !important;
}

.hamburger-bar:last-child {
    margin-bottom: 0;
}

/* CORRECCIÓN ESPACIO SUPERIOR (ESPACIAMIENTO FSE / BODY / PRODUCTO INDIVIDUAL) */
html, 
body.single-product {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.single-product .wp-site-blocks {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.single-product .site-header {
    margin-top: 0 !important;
    top: 0 !important;
}

/* Ocultar la cabecera predeterminada de WordPress en la página de producto */
.single-product .wp-site-blocks > header:not(.site-header),
.single-product .wp-block-template-part:has(header) {
    display: none !important;
}

/* Compensación cuando la barra de administración de WordPress está activa */
body.admin-bar.single-product .site-header {
    top: 32px !important;
}

/* RESPONSIVE UNIFICADO: TABLET Y CELULAR */
@media screen and (max-width: 992px) {
    .menu-toggle {
        display: block;
    }

    /* Menú desplegable oculto por defecto */
    .main-navigation {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #3B3B3B;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }

    /* Muestra el menú al activar la clase active */
    .main-navigation.active {
        display: block !important;
        animation: fadeIn 0.2s ease-in-out;
    }

    .main-navigation .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 15px;
    }

    /* Animación de texto y línea inferior para enlaces en móvil */
    .main-navigation a {
        font-size: 18px; 
        width: 100%;
        color: #ffffff;
        text-decoration: none;
        padding: 8px 0;
        display: inline-block;
        position: relative;
        transition: color 0.3s ease;
    }

    .main-navigation a::after {
        content: '';
        position: absolute;
        width: 0;
        height: 2px;
        bottom: 0;
        left: 0;
        background-color: #7DF9F1;
        transition: width 0.3s ease;
    }

    .main-navigation a:hover {
        color: #7DF9F1;
    }

    .main-navigation a:hover::after {
        width: 100%;
    }

    /* Submenú desplegable en móvil */
    .sub-menu {
        position: static;
        box-shadow: none;
        background-color: rgba(0,0,0,0.2);
        padding-left: 15px;
        margin-top: 5px;
        border-radius: 4px;
    }

    .menu-item-has-children.active > .sub-menu,
    .menu-item-has-children:hover > .sub-menu {
        display: block;
    }
}

@media screen and (max-width: 782px) {
    body.admin-bar.single-product .site-header {
        top: 46px !important;
    }
}

@media screen and (max-width: 600px) {
    .header-container {
        padding: 10px 15px;
        min-height: 80px;
    }

    .logo-img {
        width: 75px !important;
        height: 82px !important;
    }

    .header-actions {
        gap: 12px;
    }

    .header-actions a,
    .search-toggle {
        font-size: 20px;
    }
}

/* Animación suave */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Permitir que los clics atraviesen las capas superiores y lleguen al enlace del producto */
.search-dropdown {
    overflow: visible !important;
}

.dgwt-wcas-suggestions-wrapp {
    position: fixed !important;
    z-index: 99999999 !important;
    pointer-events: auto !important;
}

.dgwt-wcas-suggestion {
    cursor: pointer !important;
    pointer-events: auto !important;
}