/* ============================================================
   NosJardinsEco – header.css
   ============================================================ */

/* ----------------------------------------------------------
   1. Topbar
   ---------------------------------------------------------- */
/* topbar.css gère la topbar — voir topbar.css */

/* ----------------------------------------------------------
   2. Header sticky
   ---------------------------------------------------------- */
.site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 34px; /* hauteur topbar */
    z-index: 200;
    width: 100%;
    background-color: #F8F7F2;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

@supports (backdrop-filter: blur(1px)) {
    .site-header {
        background-color: rgba(248, 247, 242, 0.97);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
}

.site-header.is-scrolled {
    border-bottom-color: #D9D9D9;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

/* ----------------------------------------------------------
   3. Header inner
   ---------------------------------------------------------- */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 60px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .header-inner { height: 64px; }
}

/* ----------------------------------------------------------
   4. Logo
   ---------------------------------------------------------- */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 0;
    transition: opacity 0.15s ease;
}
.site-logo:hover { opacity: 0.82; }

.site-logo__img {
    display: block;
    width: auto;
    height: 68px;
    max-width: 200px;
    object-fit: contain;
}

@media (min-width: 1024px) {
    .site-logo__img { height: 76px; max-width: 240px; }
}

/* ----------------------------------------------------------
   5. Navigation desktop (masquée sur mobile)
   ---------------------------------------------------------- */
.site-nav { display: none; }

@media (min-width: 1024px) {
    .site-nav {
        display: flex;
        align-items: center;
        flex: 1;
        justify-content: center;
    }
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list > li { position: relative; }

.nav-list > li > a {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    color: #3C3C3C;
    text-decoration: none;
    border-radius: 6px;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-list > li > a:hover,
.nav-list > li.current-menu-item > a,
.nav-list > li.current-page-ancestor > a {
    color: #34A42E;
    background-color: rgba(52,164,46,0.07);
}

/* Trait vert sous lien actif */
.nav-list > li > a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 1.6rem);
    height: 2px;
    background-color: #34A42E;
    border-radius: 2px;
    transition: transform 0.15s ease;
}
.nav-list > li > a:hover::after,
.nav-list > li.current-menu-item > a::after {
    transform: translateX(-50%) scaleX(1);
}

/* Dropdown desktop */
.nav-list > li.menu-item-has-children { position: relative; }

/* Masquer tout dropdown-toggle que WordPress pourrait injecter */
.nav-list .dropdown-toggle { display: none; }

.nav-list > li.menu-item-has-children > .sub-menu,
.nav-list > li.menu-item-has-children > .njeco-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #E8E8E0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    padding: 16px 0 10px;
    list-style: none;
    margin: 0;
    z-index: 250;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.nav-list > li.menu-item-has-children:hover > .sub-menu,
.nav-list > li.menu-item-has-children:focus-within > .sub-menu,
.nav-list > li.menu-item-has-children:hover > .njeco-dropdown,
.nav-list > li.menu-item-has-children:focus-within > .njeco-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-list > li > .sub-menu li a,
.nav-list > li > .njeco-dropdown li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 1.1rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    color: #3C3C3C;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-list > li > .sub-menu li a:hover,
.nav-list > li > .njeco-dropdown li a:hover {
    color: #34A42E;
    background-color: rgba(52,164,46,0.06);
}

/* Dropdown Boutique — masqué sur mobile */
@media (max-width: 1023px) {
    .nav-list > li.menu-item-has-children > .sub-menu,
    .nav-list > li.menu-item-has-children > .njeco-dropdown {
        display: none;
    }
}

/* Dropdown Boutique — 2 colonnes si présent */
.njeco-dropdown--boutique {
    min-width: 440px;
    left: 0;
    transform: translateY(6px);
    padding: 20px 16px 12px;
}
.nav-list > li:hover > .njeco-dropdown--boutique,
.nav-list > li:focus-within > .njeco-dropdown--boutique {
    transform: translateY(0);
}
.njeco-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #F0F0E8;
}
.njeco-dropdown__header-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3C3C3C;
}
.njeco-dropdown__header-link {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #34A42E;
    text-decoration: none;
}
.njeco-dropdown__header-link:hover { color: #1F6F2B; }
.njeco-dropdown__cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 12px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ----------------------------------------------------------
   6. Actions header (icônes + CTA)
   ---------------------------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    color: #3C3C3C;
    text-decoration: none;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.header-action-btn:hover {
    color: #34A42E;
    background-color: rgba(52,164,46,0.07);
}
.header-action-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
    display: block;
}

.cart-badge {
    position: absolute;
    top: 5px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background-color: #34A42E;
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 9999px;
    display: none;
}
.cart-badge.has-items { display: block; }

/* header-cta supprimé */

/* ----------------------------------------------------------
   7. Burger mobile
   ---------------------------------------------------------- */
.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: #3C3C3C;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.15s ease, background-color 0.15s ease;
    position: relative;
    z-index: 500;
}
.nav-toggle:hover {
    color: #34A42E;
    background-color: rgba(52,164,46,0.07);
}
.nav-toggle__icon {
    width: 22px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}
.nav-toggle__line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.15s ease;
    transform-origin: center;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}
@media (min-width: 1024px) {
    .nav-toggle { display: none; }
}

/* ----------------------------------------------------------
   8. Navigation mobile — panneau
   ---------------------------------------------------------- */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #F8F7F2;
    z-index: 400;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 2rem;
    pointer-events: none;
    box-sizing: border-box;
}

.mobile-nav.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

@media (min-width: 768px) {
    .mobile-nav {
        width: 360px;
        left: auto;
        right: 0;
        border-left: 1px solid #D9D9D9;
        box-shadow: -4px 0 24px rgba(0,0,0,0.08);
    }
}

@media (min-width: 1024px) {
    .mobile-nav { display: none; }
}

/* Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 399;
}
.nav-open .nav-overlay { display: block; }
body.nav-open { overflow: hidden; }

/* Liste principale */
.mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}
.mobile-nav__list > li {
    border-bottom: 1px solid #E0DED8;
}
.mobile-nav__list > li:first-child {
    border-top: 1px solid #E0DED8;
}

/* Lien direct */
.mobile-nav__list > li > a {
    display: block;
    padding: 1rem 0.5rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #3C3C3C;
    text-decoration: none;
    min-height: 52px;
    display: flex;
    align-items: center;
}
.mobile-nav__list > li > a:hover { color: #34A42E; }

/* Accordéon — ligne Boutique */
.mobile-nav__row {
    display: flex;
    align-items: center;
    min-height: 52px;
}
.mobile-nav__row > a {
    flex: 1;
    padding: 1rem 0.5rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #3C3C3C;
    text-decoration: none;
}
.mobile-nav__row > a:hover { color: #34A42E; }

/* Bouton toggle chevron */
.mobile-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 52px;
    background: none;
    border: none;
    color: #34A42E;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
}
.mobile-nav__toggle svg {
    transition: transform 0.25s ease;
    display: block;
    stroke: #34A42E;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mobile-nav__accordion.is-open .mobile-nav__toggle svg {
    transform: rotate(180deg);
}

/* Sous-menu */
.mobile-nav__sub {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(52,164,46,0.04);
}
.mobile-nav__accordion.is-open .mobile-nav__sub {
    max-height: 600px;
}
.mobile-nav__sub li a {
    display: block;
    padding: 0.8rem 1rem 0.8rem 1.5rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.95rem;
    color: #555;
    text-decoration: none;
    border-bottom: 1px solid rgba(224,222,216,0.5);
    min-height: 48px;
    display: flex;
    align-items: center;
}
.mobile-nav__sub li:last-child a { border-bottom: none; }
.mobile-nav__sub li a:hover { color: #34A42E; }

/* CTA bas de panneau */
.mobile-nav__cta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.mobile-nav__cta .btn {
    width: 100%;
    justify-content: center;
}

/* Mobile responsive small screens */
@media (max-width: 380px) {
    .header-inner {
        gap: 4px;
        padding-left: 10px;
        padding-right: 10px;
    }
    .site-logo__img { height: 38px; }
    .header-action-btn { width: 36px; height: 36px; }
    .nav-toggle { width: 36px; height: 36px; }
}
