/* ===== Header ===== */
.nav-link,
.mobile-nav-link,
.mobile-nav-link-main,
.mobile-submenu-link,
.mobile-newsletter-btn,
.search input,
.search input::placeholder {
    font-family: var(--font-head);
    font-size: var(--header-nav-size);
}

/* ===== LAYOUT HEADER ===== */
.site-header {
    position: relative;
    z-index: 100;
    width: 100%;
    background: rgba(47, 21, 108, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateZ(0); /* force layer GPU stable → évite le flicker des SVG sprites quand backdrop-filter re-render au scroll */
    isolation: isolate; /* nouveau stacking context : empêche le repaint du backdrop-filter d'invalider les <use> SVG externes au scroll rapide */
}

.site-header-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.25rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* ===== WRAPPERS INVISIBLES ===== */
.header-left,
.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2.25rem;
}

.header-left {
    justify-content: flex-end;
}

.header-right {
    justify-content: flex-start;
}

.header-left nav,
.header-right nav {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
}

/* ===== LOGO CENTRAL ===== */
.brand {
    flex-shrink: 0;
}

.header-logo {
    width: 90px;
    height: 90px;
    display: block;
    fill: var(--white);
    pointer-events: none;
    transform: translateZ(0); /* couche GPU dédiée → fix disparition du logo au scroll rapide sous backdrop-filter */
}

.brand .header-logo {
    margin: 10px;
}

.mobile-menu-content .header-logo {
    margin: 0;
}

/* ===== RECHERCHE ===== */
.search {
    position: relative;
}

.header-left .search {
    display: flex;
    align-items: center;
}

.search input {
    padding: 4px 55px 4px 20px;
    border: 3px solid var(--white);
    border-radius: 100px;
    color: var(--white);
    height: 52px;
}

/* Recherche desktop */
.header-left .search input {
    width: 220px;
    background: transparent;
}

/* Recherche mobile */
.search-mobile {
    width: 100%;
    max-width: 300px;
}

.search-mobile input {
    width: 100%;
    background: rgba(255, 255, 255, .15);
}

.search input:focus {
    outline: none;
}

.search input::placeholder {
    color: var(--lightgrey);
    opacity: .9;
}

.icon-search {
    width: 50px;
    height: 50px;
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%) translateZ(0); /* translateZ force une couche GPU dédiée → empêche que le repaint du backdrop-filter du header invalide le <use> externe au scroll rapide */
    pointer-events: auto;
    cursor: pointer;
    border: 3px solid var(--white);
    border-radius: 50%;
    padding: 0 2px 2px 0;
}

/* ===== NAVIGATION ===== */
.nav-link {
    color: var(--white);
    text-decoration: none;
    white-space: nowrap;
    transform: translateZ(0); /* couche GPU dédiée → fix disparition du texte au scroll rapide sous backdrop-filter */
}

.mobile-nav-link:hover,
.nav-link:hover {
    color: var(--green);
}

/* ===== ICÔNES ===== */
.header-icons {
    display: flex;
    gap: 1.75rem;
    align-items: center;
}

.icon-cart,
.icon-account {
    width: 40px;
    height: 40px;
    color: var(--white); /* fill="currentColor" dans le sprite → blanc dans le header */
    transform: translateZ(0); /* couche GPU dédiée → fix flicker des <use> externes au scroll quand backdrop-filter re-render */
}

.icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    /* Reset styles natifs <button> pour aligner identiquement avec <a> (icône compte connecté/déconnecté) */
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.badge {
    position: absolute;
    top: 0px;
    right: -8px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    pointer-events: none;
    width: 17px;
    height: 17px;
    font-size: 11px;
    color: var(--white);
    font-family: var(--font-body);
    line-height: 1;
}

/* ===== BURGER ===== */
.hamburger {
    display: none !important;
    z-index: 3;
    transform: translateZ(0); /* couche GPU dédiée → fix disparition des barres du burger au scroll rapide sous backdrop-filter (l'animation rotate de .hamburger-inner reste isolée à l'intérieur) */
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after,
.hamburger.is-active .hamburger-inner,
.hamburger.is-active .hamburger-inner::before,
.hamburger.is-active .hamburger-inner::after {
    background-color: var(--white) !important;
}

.hamburger-inner::before {
    width: 30px !important;
}

/* ===== RESPONSIVE v0.5 ===== */
@media (max-width: 1150px) and (min-width: 1025px) {
    .site-header-inner {
        gap: 1.75rem;
    }

    .header-left,
    .header-right {
        gap: 1.75rem;
    }

    .header-left .search input {
        width: 170px;
        padding: 0px 40px 0px 15px;
        height: 42px;
    }

    .icon-search {
        width: 40px;
        height: 40px;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .site-header-inner {
        grid-template-columns: auto 1fr auto;
        padding: 0 clamp(15px, 4vw, 30px);
    }

    .header-left nav,
    .header-right nav,
    .header-left .search {
        display: none;
    }

    .header-left {
        justify-content: flex-start;
    }

    .header-right {
        justify-content: flex-end;
    }

    .brand {
        justify-self: center;
    }

    .hamburger {
        display: block !important;
        position: relative;
    }

    .brand .header-logo {
        width: 50px;
        height: 50px;
    }

    .icon-cart,
    .icon-account {
        width: 30px;
        height: 30px;
    }

    .badge {
        width: 15px;
        height: 15px;
        font-size: 10px;
    }

    .header-icons {
        gap: 1.25rem;
        margin-right: .25rem;
    }
}

/* ===== MENU MOBILE ===== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .5);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
    will-change: opacity;
}

.mobile-menu-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 400px;
    background: var(--purple);
    /* Seul le menu principal garde le translateZ pour l'ouverture latérale */
    transform: translateX(-100%) translateZ(0);
    transition: transform .25s ease;
    overflow-y: auto;
    border-right: 3px solid var(--white);
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 2;
    will-change: transform;
}

.mobile-menu::-webkit-scrollbar {
    display: none;
}

.mobile-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background-image: url('/assets/images/ui/header/header-mobile-bg.svg');
    background-position: left center;
    background-repeat: no-repeat;
    background-size: auto 100%;
    transform: scaleX(-1);
    pointer-events: none;
    filter: brightness(1.5) contrast(1.2);
    opacity: 1;
}

.mobile-menu.is-open {
    transform: translateX(0) translateZ(0);
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    min-width: 350px;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    margin: .75rem 0rem;
}

.mobile-nav-link {
    color: var(--white);
    text-decoration: none;
}

.mobile-nav-link[aria-current="page"] {
    color: var(--green);
    font-weight: bold;
    letter-spacing: 1px;
}

.mobile-nav-link[aria-current="page"] .chevron-icon path {
    fill: var(--green);
}

/* ===== MENU AVEC SOUS-MENU ===== */
.mobile-nav-item-with-submenu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 0;
}

.mobile-nav-link-main {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--white);
}

.mobile-nav-link-main:hover,
.mobile-nav-link-main:hover .chevron-icon path {
    color: var(--green);
    fill: var(--green);
}

.mobile-nav-link-main[aria-expanded="true"] .chevron-icon {
    transform: rotate(90deg);
}

.chevron-icon {
    width: 10px;
    height: 14px;
    transition: transform .25s ease;
    transform-origin: center center;
}

.mobile-submenu {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
        max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-top: 0;
    contain: layout paint;
    will-change: max-height;
        transition: max-height .25s cubic-bezier(0.23, 1, 0.32, 1), 
                opacity .25s ease, 
                padding-top .25s ease;
    
    background: transparent;
}

.mobile-submenu.is-open {
    max-height: 300px;
    opacity: 1;
    padding-top: .5rem;
}

.mobile-submenu-link {
    text-decoration: none;
    text-align: center;
    transition: opacity .25s ease;
}

.submenu-toggle:hover,
.mobile-submenu-link:hover {
    opacity: var(--header-opacity-nav);
}

.mobile-submenu-link-fleurs { color: #3AAA35; }
.mobile-submenu-link-resines { color: #EC6608; }
.mobile-submenu-link-huiles { color: #FFCC00; }
.mobile-submenu-link-accessoires { color: #35B6B4; }

.mobile-social {
    display: flex;
    gap: 2.5rem;
    justify-content: center;
}

.social-icon {
    width: 55px;
    height: 55px;
}

.mobile-newsletter-btn {
    color: var(--white);
    text-decoration: none;
    padding: .25rem 1.75rem;
    border: 3px solid var(--white);
    border-radius: 100px;
    background: transparent;
    display: inline-block;
    text-align: center;
    transition: background .25s ease, color .25s ease;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}

.mobile-newsletter-btn:hover {
    background: var(--white);
    color: var(--purple);
}

@media (max-width: 1024px) {
    .mobile-menu-overlay,
    .mobile-menu {
        display: block;
    }
}

@media (max-width: 480px) {
    .mobile-menu {
        width: 100%;
        max-width: none;
        border-right: none;
    }
}