/* ============================================================
   an_headerdesign v2.0
   Variables: --anhd-accent, --anhd-top-bg, --anhd-top-color
   
   Target theme: Flavor / flavor-like with amegamenu
   
   Desktop layout:
   ┌────────────────────────────────────────────────┐
   │  ★ Livraison offerte dès 49€ d'achat          │  dark bar
   ├────────────────────────────────────────────────┤
   │  LOGO   [  Rechercher un produit...  🔍]  ♡ 👤 🛒 │  white
   ├────────────────────────────────────────────────┤
   │       Cat 1  ·  Cat 2  ·  Cat 3  ·  Cat 4    │  #F7FAFC
   └────────────────────────────────────────────────┘
   ============================================================ */

/* ── RESET ── */

#header {
    box-shadow: none !important;
    background: #fff !important;
    position: relative;
}

#header .vertical-center {
    min-height: 0 !important;
}

#header .container {
    max-width: 1400px;
    padding-left: 16px;
    padding-right: 16px;
}

/* ================================================================
   1. ANNOUNCEMENT BANNER
   ================================================================ */

#header .header-banner {
    background: var(--anhd-top-bg, #0A192F) !important;
    color: var(--anhd-top-color, #fff) !important;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    line-height: 38px;
    letter-spacing: 0.02em;
    padding: 0 16px;
    margin: 0;
}

#header .header-banner a {
    color: inherit;
    text-decoration: none;
}

#header .header-banner a:hover {
    text-decoration: underline;
}

/* ================================================================
   2. OLD UTILITY NAV — hidden by default, JS shows service client if needed
   ================================================================ */

#header .header-nav.tablet-h {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    border: none !important;
    background: #F7FAFC !important;
}

/* When module hides the old nav entirely */
#header.anhd-hide-old-nav .header-nav-inside {
    display: none !important;
}

/* When visible, restyle it slim */
#header .header-nav .header-nav-inside {
    min-height: 32px;
    font-size: 12px;
}

#header .header-nav .header-nav-inside .left-nav {
    display: flex;
    align-items: center;
}

#header .header-nav .header-nav-inside .right-nav {
    display: none !important; /* wishlist moved to header-right */
}

/* ================================================================
   3. MAIN HEADER AREA
   ================================================================ */

#header .header-top.tablet-h {
    background: #fff !important;
    border: none !important;
    padding: 0 !important;
    height: auto !important;
    position: relative;
}

#header .header-top .header-top-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 0 !important;
    gap: 0;
}

/* ── 3A. LOGO ── */

#header .header-top-wrapper > .vertical-center[id="_desktop_logo"],
#header .header-top-wrapper > #_desktop_logo {
    order: 1 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    padding: 14px 24px 14px 0 !important;
    width: auto !important;
    max-width: none !important;
}

#header .header-top-wrapper > #_desktop_logo img.logo {
    max-height: 52px;
    width: auto;
    display: block;
    transition: max-height 0.25s ease;
}

/* ── 3B. RIGHT SECTION: Search + Wishlist + User + Cart ── */

#header .header-top-wrapper > .header-right {
    order: 2 !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    justify-content: flex-end !important;
    padding: 14px 0 !important;
}

/* ── 3C. CENTER (MENU): Full width row ── */

#header .header-top-wrapper > .header-center {
    order: 3 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ================================================================
   4. AMEGAMENU — Hide duplicates, keep menu items only
   ================================================================ */

/* Kill all theme sticky/fixed behavior */
#header #amegamenu,
#header #amegamenu .fixed-menu-container {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}

#header #amegamenu .fixed-menu-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}
#header .fixed-menu-container > .vertical-center,
#header .fixed-menu-container > div[id="_desktop_logo"],
#header #amegamenu .fixed-menu-container > .hidden-md-down.vertical-center {
    display: none !important;
}

/* HIDE duplicate cart inside fixed-menu-container */
#header .fixed-menu-container > .fixed-menu-right,
#header .fixed-menu-container > .col-md-2 {
    display: none !important;
}

/* Menu container: full-width gray bar */
#header .header-top-nav {
    background: #F7FAFC;
    border-top: 1px solid #EDF2F7;
    border-bottom: 1px solid #E2E8F0;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
}

/* Menu items */
#header #amegamenu ul.anav-top {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

#header #amegamenu .amenu-link {
    display: block;
    padding: 10px 24px;
    font-size: 13.5px;
    font-weight: 600;
    color: #1A202C;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

#header #amegamenu .amenu-link:hover,
#header #amegamenu .amenu-item:hover > .amenu-link {
    color: var(--anhd-accent, #0891B2);
    border-bottom-color: var(--anhd-accent, #0891B2);
}

/* ================================================================
   5. SEARCH BAR — Always visible, inline
   ================================================================ */

#header .search-wrapper {
    flex: 1 !important;
    max-width: 520px !important;
    min-width: 160px !important;
    position: relative !important;
}

/* Kill toggle button */
#header .search-wrapper > .search-button.dropdown-toggle {
    display: none !important;
}

/* Force dropdown to be inline */
#header .search-wrapper #search_widget,
#header .search-wrapper .dropdown-menu {
    display: flex !important;
    position: static !important;
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#header #search_widget form {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 44px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    overflow: hidden;
    background: #F7FAFC;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#header #search_widget form:focus-within {
    border-color: var(--anhd-accent, #0891B2);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.08);
}

#header #search_widget input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 0 16px;
    height: auto;
    border: none !important;
    outline: none !important;
    font-size: 14px;
    color: #1A202C;
    background: transparent !important;
}

#header #search_widget input[type="text"]::placeholder {
    color: #A0AEC0;
}

#header #search_widget button[type="submit"] {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-width: 48px;
    border: none;
    background: var(--anhd-accent, #0891B2);
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}

#header #search_widget button[type="submit"]:hover {
    background: #06B6D4;
}

#header #search_widget button[type="submit"] svg {
    width: 18px;
    height: 18px;
    display: block;
    vertical-align: middle;
    flex-shrink: 0;
}

#header #search_widget button[type="submit"] svg path,
#header #search_widget button[type="submit"] svg circle,
#header #search_widget button[type="submit"] svg line {
    stroke: #fff !important;
    fill: none !important;
}

#header #search_widget button[type="submit"] span {
    display: none !important;
}

/* Override theme's absolute positioning */
#header .search-widget form button[type="submit"],
#header #search_widget form button[type="submit"] {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    right: auto !important;
}

#header #search_widget button .hidden-xl-down {
    display: none !important;
}

/* Autocomplete */
#header .ui-autocomplete {
    z-index: 1050 !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
    background: #fff !important;
}

/* ================================================================
   6. HEADER ICONS — Wishlist, User, Cart
   ================================================================ */

/* Shared icon button style */
.anhd-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    text-decoration: none !important;
    color: #374151;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.anhd-icon-btn:hover {
    background: #F0FDFA;
    color: var(--anhd-accent, #0891B2);
    transform: translateY(-1px);
}

.anhd-icon-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* Badge (cart count, wishlist count) */
.anhd-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    background: var(--anhd-accent, #0891B2);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 0 4px;
    pointer-events: none;
}

/* Original user/cart elements — hidden, replaced by JS icons */
#header .header-right > #_desktop_user_info,
#header .header-right > #_desktop_cart {
    display: none !important;
}

/* Wishlist in old nav — hidden (moved via JS) */
#header .an_wishlist-nav-link {
    display: none !important;
}

/* ================================================================
   7. STICKY
   ================================================================ */

#header.anhd-sticky .header-top.tablet-h {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999 !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06) !important;
    background: #fff !important;
}

#header.anhd-sticky .header-top-wrapper > #_desktop_logo {
    padding: 10px 24px 10px 0 !important;
}

#header.anhd-sticky .header-top-wrapper > .header-right {
    padding: 10px 0 !important;
}

#header.anhd-sticky .header-top-wrapper > #_desktop_logo img.logo {
    max-height: 38px;
}

#header.anhd-sticky #amegamenu .amenu-link {
    padding: 8px 20px;
    font-size: 13px;
}

/* Spacer */
.anhd-spacer {
    display: none;
}

.anhd-spacer.is-active {
    display: block;
}

/* ================================================================
   8. CONFIG TOGGLES
   ================================================================ */

#header.anhd-hide-service .anhd-service-btn,
#header.anhd-hide-service .anhd-mobile-service {
    display: none !important;
}

#header.anhd-hide-wishlist .anhd-wishlist-btn {
    display: none !important;
}

/* ================================================================
   9. MOBILE
   ================================================================ */

@media (max-width: 991px) {
    /* Banner */
    #header .header-banner {
        font-size: 11px;
        line-height: 32px;
    }

    /* Show mobile part of header-nav */
    #header .header-nav.tablet-h {
        display: block !important;
    }

    /* Hide desktop wrapper */
    #header .header-top .header-top-wrapper {
        display: block !important;
    }

    /* Mobile header from nav */
    #header .mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 8px 0;
        min-height: 56px;
        position: relative;
    }

    #header #menu-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        cursor: pointer;
        margin: 0;
        padding: 0;
        float: none;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    #header #menu-icon svg {
        width: 22px;
        height: auto;
    }

    #header .top-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
        pointer-events: none;
    }

    #header .top-logo a {
        pointer-events: auto;
    }

    #header .top-logo img.logo {
        max-height: 36px;
        width: auto;
    }

    #header .mobile-header #_mobile_cart {
        float: none;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    /* Hide desktop header-right icons on mobile */
    #header .header-right .anhd-icon-btn {
        display: none !important;
    }

    /* Mobile icons wrapper — aligned right */
    .anhd-mobile-icons {
        display: flex;
        align-items: center;
        gap: 0;
        margin-left: auto;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .anhd-mobile-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: none;
        border: none;
        color: #374151;
        text-decoration: none !important;
        cursor: pointer;
        transition: background 0.2s, color 0.2s;
        padding: 0;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .anhd-mobile-icon:hover,
    .anhd-mobile-icon:active {
        background: #F0FDFA;
        color: var(--anhd-accent, #0891B2);
    }

    .anhd-mobile-icon svg {
        width: 24px;
        height: 24px;
    }

    /* Also style mobile cart to match */
    #header .mobile-header #_mobile_cart {
        float: none;
        flex-shrink: 0;
    }

    #header .mobile-header #_mobile_cart .blockcart-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        position: relative;
    }

    /* Hide "Contactez-nous" and "Ma liste d'envies" in mobile menu */
    #header .amegamenu_mobile-modal a[href*="nous-contacter"],
    #header .amegamenu_mobile-modal a[href*="contact-us"],
    #header .amegamenu_mobile-modal a[href*="contactez"],
    .amegamenu_mobile-modal .anav-mobile li a[href*="contact"],
    #_mobile_clientservice,
    #_mobile_an_wishlist-nav {
        display: none !important;
    }

    /* Mobile cart badge */
    #header .mobile-header .cart-products-count,
    #header .mobile-header .mobile-cart-item-count {
        position: absolute;
        top: 2px;
        right: -2px;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
        text-align: center;
        border-radius: 9px;
        background: var(--anhd-accent, #0891B2);
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        padding: 0 4px;
    }

    /* Hide desktop stuff on mobile */
    #header .header-top .header-center.position-static {
        display: none !important;
    }

    /* Sticky mobile */
    #header.anhd-sticky .header-top.tablet-h {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
    }

    /* Mobile menu panel */
    #header .amegamenu_mobile-modal {
        z-index: 1100;
        background: #fff;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.12);
    }

    #header .amegamenu_mobile-cover {
        z-index: 1099;
    }

    #header .amegamenu_mobile-modal .mobile-menu-header {
        padding: 16px;
        border-bottom: 1px solid #EDF2F7;
    }

    #header .amegamenu_mobile-modal .anav-mobile .amenu-link {
        display: block;
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 600;
        color: #1A202C;
    }

    #header .amegamenu_mobile-modal .anav-mobile .amenu-link:active {
        background: #F7FAFC;
        color: var(--anhd-accent, #0891B2);
    }

    /* Panel responsive */
    .anhd-sc-panel {
        width: 100%;
        max-width: 100vw;
        border-radius: 0;
    }

    .anhd-panel-badges {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* ================================================================
   SERVICE CLIENT PANEL — Custom from scratch
   ================================================================ */

/* Hide theme's original service client entirely */
#_desktop_clientservice {
    display: none !important;
}

/* Overlay */
.anhd-sc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 47, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.anhd-sc-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* Panel */
.anhd-sc-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: #fff;
    z-index: 99999;
    border-radius: 20px 0 0 20px;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.anhd-sc-panel.is-open {
    transform: translateX(0);
}

/* ── Inject our own panel design via JS ── */

.anhd-panel-header {
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, #0A192F 0%, #0E2A4A 100%);
    border-radius: 20px 0 0 0;
    position: relative;
    overflow: hidden;
}

.anhd-panel-header::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(8, 145, 178, 0.15);
    border-radius: 50%;
}

.anhd-panel-header__icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(8, 145, 178, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #06B6D4;
}

.anhd-panel-header__icon svg {
    width: 26px;
    height: 26px;
}

.anhd-panel-header__title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
}

.anhd-panel-header__subtitle {
    font-size: 13px;
    color: #94A3B8;
    margin: 0;
}

/* Close button override for dark header */
.anhd-panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94A3B8;
    transition: all 0.2s;
    z-index: 2;
}

.anhd-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.anhd-panel-close svg {
    width: 18px;
    height: 18px;
}

/* Panel body */
.anhd-panel-body {
    padding: 24px 28px;
}

/* Contact items */
.anhd-panel-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #EDF2F7;
    margin-bottom: 12px;
    transition: all 0.2s;
    text-decoration: none !important;
    background: #fff;
}

a.anhd-panel-item:hover,
.anhd-panel-item:hover {
    border-color: var(--anhd-accent, #0891B2);
    background: #F0FDFA;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.08);
}

.anhd-panel-item__icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: #F0FDFA;
    border: 1px solid #E0F7FA;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--anhd-accent, #0891B2);
}

.anhd-panel-item__icon svg {
    width: 20px;
    height: 20px;
}

.anhd-panel-item__content {
    flex: 1;
    min-width: 0;
}

.anhd-panel-item__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1A202C;
    margin-bottom: 2px;
}

.anhd-panel-item__value {
    display: block;
    font-size: 12.5px;
    color: #718096;
}

a.anhd-panel-item:hover .anhd-panel-item__value {
    color: var(--anhd-accent, #0891B2);
}

.anhd-panel-item__arrow {
    width: 18px;
    height: 18px;
    color: #CBD5E0;
    align-self: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

a.anhd-panel-item:hover .anhd-panel-item__arrow {
    color: var(--anhd-accent, #0891B2);
    transform: translateX(2px);
}

/* Separator */
.anhd-panel-sep {
    height: 1px;
    background: #EDF2F7;
    margin: 20px 0;
}

/* Footer badges */
.anhd-panel-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.anhd-panel-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #F7FAFC;
    border-radius: 10px;
}

.anhd-panel-badge__icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--anhd-accent, #0891B2);
    border: 1px solid #E2E8F0;
}

.anhd-panel-badge__icon svg {
    width: 14px;
    height: 14px;
}

.anhd-panel-badge__text {
    font-size: 11px;
    font-weight: 600;
    color: #4A5568;
    line-height: 1.3;
}
