.site-header {
    background-color: #fff !important;
    margin: 0 !important;
    position: sticky !important;
    top: 0 !important;
    width: 100% !important;
    z-index: 999 !important;
    box-shadow: 0 1px 0 0 rgba(0,0,0,.1) !important;
    display: flex;
}

/* Ajuste para el wpadminbar */
.admin-bar .site-header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px !important;
    }
}

/* Remover el padding extra que ya no necesitamos y arreglar overflow */
body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

#page {
    overflow: visible !important;
    width: 100% !important;
}

/* Desktop: grid layout */
body .site-header .header-container {
    width: 100%;
    max-width: 66.4989378333em;
    margin: 0 auto;
    display: grid !important;
    grid-template-areas:
        "logo search search"
        "nav user cart";
    grid-template-columns: 162px minmax(340px, 1fr) minmax(30px, 33px);
    grid-template-rows: 40px 28px;
    column-gap: clamp(6px, 1vw, 12px);
    row-gap: clamp(8px, 1.5vw, 12px);
    float: none !important;
}

/* Mobile: grid layout */
@media (max-width: 768px) {
    body .site-header .header-container {
        display: grid !important;
        grid-template-areas:
            "logo search icons"
            "nav nav nav";
        grid-template-columns: 60px 1fr auto;
        grid-template-rows: 40px auto;
        gap: 8px;
        width: 100%;
        max-width: 100vw;
        padding: 0 8px;
    }

    body .site-header .site-branding {
        grid-area: logo;
        min-width: 60px;
        max-width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 40px;
    }

    body .site-header .header-search {
        grid-area: search;
        min-width: 0;
        margin: 0;
        display: flex;
        align-items: center;
    }

    .header-mobile-icons {
        grid-area: icons;
        display: flex !important;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .categories-menu {
        grid-area: nav;
        width: 100%;
    }

    .categories-dropdown {
        display: none;
        width: 100%;
    }

    .categories-dropdown.active {
        display: block;
    }

    /* Ocultar elementos desktop en mobile */
    body .site-header .header-user,
    body .site-header .header-actions {
        display: none !important;
    }
}

/* Ocultar los íconos mobile en desktop */
@media (min-width: 769px) {
    .header-mobile-icons {
        display: none !important;
    }
}

/* Top row */
body .site-header .site-branding {
    grid-area: logo;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    height: 40px; /* Altura fija para el contenedor */
}

body .site-header .site-branding img,
body .site-header .site-branding .custom-logo-link {
    margin: 0 !important;
    height: 100% !important; /* Altura fija para la imagen */
    width: auto !important; /* Ancho automático para mantener proporción */
    object-fit: contain;
}

body .site-header .site-branding .site-title {
    margin: 0 !important;
    font-size: 1.2em;
}

body .site-header .site-branding .site-title a {
    color: #333;
    text-decoration: none;
}

body .site-header .header-search form {
    margin: 0 !important;
}

body .site-header .header-search {
    grid-area: search;
    display: flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Bottom row */

body .site-header .nav-menu {
    display: flex !important;
    list-style: none;
    margin: 0 !important;
    padding: 0 !important;
    gap: 1em;
}

body .site-header .nav-menu > li {
    padding: 0 !important;
    margin: 0 !important;
}

body .site-header .nav-menu a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    padding: 0 !important;
}

body .site-header .header-user {
    grid-area: user;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    margin: 0 !important;
    gap: 8px;
}

body .site-header .header-actions {
    grid-area: cart;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

/* Search form styles */
body .site-header .aws-container {
    flex: 1;
}

body .site-header .aws-search-form {
    height: 40px !important;
}

body .site-header .aws-search-field {
    height: 40px !important;
    padding: 8px 15px !important;
    font-size: 16px !important;
    border: 1px solid #e6e6e6 !important;
    border-radius: 4px !important;
}

/* Cart styles */
body .site-header .site-header-cart {
    margin-left: 8px !important;
    margin-right: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
}

/* Logo styles */
body .site-header .site-branding .custom-logo-link:not(.mobile-logo) {
    display: block;
    max-width: 162px; /* Limita el ancho máximo del logo grande */
}

body .site-header .site-branding .custom-logo-link:not(.mobile-logo) img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

body .site-header .site-branding .custom-logo-link.mobile-logo {
    display: none;
}

/* --- MOBILE HEADER ICONS --- */
.header-mobile-icons {
    display: none;
}

@media (max-width: 768px) {
    body .site-header .header-user,
    body .site-header .header-actions {
        display: none !important;
    }

    body .site-header .site-branding .custom-logo-link:not(.mobile-logo) {
        display: none;
    }
    
    body .site-header .site-branding .custom-logo-link.mobile-logo {
        display: block;
    }
}

/* --- Carrito mobile replicando Storefront --- */
.header-mobile-icons .footer-cart-contents {
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 2em;
    min-height: 28px;
    text-decoration: none;
    color: transparent; /* Oculta solo el texto 'Carrito' */
    text-indent: -9999px;
    width: 0;
}
.header-mobile-icons .footer-cart-contents::before {
    content: "";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 1.4em;
    display: block;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #222;
    width: 1.2em;
    text-align: center;
    line-height: 1;
    text-indent: 0;
}
.header-mobile-icons .footer-cart-contents .count {
    color: #fff !important;
    background: var(--color-accent) !important;
    border-radius: 50%;
    font-size: 0.8em;
    min-width: 1.5em;
    height: 1.5em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 1.1em;
    top: 0.1em;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    z-index: 1;
    padding: 0 0.3em;
    text-indent: 0;
    color: var(--color-text-inverse) !important;
}

@media (min-width: 769px) {
    .header-mobile-icons .footer-cart-contents {
        display: none !important;
    }
}

body .site-header .header-user-link {
    color: #333 !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 0.5em;
}
body .site-header .header-user-link:visited {
    color: #333 !important;
}
body .site-header .header-user-link svg {
    flex-shrink: 0;
    display: block;
}
.user-name-display {
    display: inline-block;
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    text-transform: capitalize;
    font-size: 1em;
    line-height: 1;
    margin-left: 0.2em;
}

/* --- Carrito desktop con nueva clase --- */
.desktop-cart-icon {
    display: flex !important;
}
@media (max-width: 768px) {
    .desktop-cart-icon {
        display: none !important;
    }
}
@media (min-width: 769px) {
    .desktop-cart-icon {
        position: relative;
        display: flex !important;
        align-items: center;
        padding-left: 2em;
        min-height: 28px;
        text-decoration: none;
        color: transparent;
        text-indent: -9999px;
        width: 0;
    }
    .desktop-cart-icon::before {
        content: "\f291";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 1.4em;
        display: block;
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        color: #222;
        width: 1.2em;
        text-align: center;
        line-height: 1;
        text-indent: 0;
        transition: color 0.2s, filter 0.2s;
    }
    .desktop-cart-icon:hover::before {
        color: #96588a;
        filter: drop-shadow(0 2px 6px #96588a33);
        animation: cart-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    }
    @keyframes cart-shake {
        10%, 90% { transform: translateY(-50%) translateX(-0.5px) rotate(-1deg); }
        20%, 80% { transform: translateY(-50%) translateX(1px) rotate(1deg); }
        30%, 50%, 70% { transform: translateY(-50%) translateX(-2px) rotate(-2deg); }
        40%, 60% { transform: translateY(-50%) translateX(2px) rotate(2deg); }
        100% { transform: translateY(-50%); }
    }
    .desktop-cart-icon .count {
        color: #fff !important;
        background: var(--color-accent) !important;
        border-radius: 50%;
        font-size: 0.8em;
        min-width: 1.5em;
        height: 1.5em;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 1.1em;
        top: 0.1em;
        font-weight: bold;
        box-shadow: 0 1px 2px rgba(0,0,0,0.08);
        z-index: 1;
        padding: 0 0.3em;
        text-indent: 0;
        color: var(--color-text-inverse) !important;
    }
} 