/** CMS Source - Header CSS */

/* ==========================================================================
   HEADER - 2-LINE LAYOUT
   Line 1: Brand (Logo + Search + Partner Banner + User Actions)
   Line 2: Navigation (mega-menus)
   ========================================================================== */
:root {
    --header-brand: 56px;
    --header-nav: 44px;
    --header-total: 100px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Container */
.site-header .container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ==========================================================================
   LINE 1: BRAND BAR
   Logo | Search | Banner | User Actions
   ========================================================================== */
.header-brand {
    height: var(--header-brand);
    background: #fff;
}

.header-brand .container {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 1rem;
}

/* Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo-img {
    position: relative;
    z-index: 2;
    max-height: 42px;
    width: auto;
    border: 3px solid white;
    border-radius: 8px;
}

.brand-name {
    position: relative;
    z-index: 1;
    font-family: var(--font-family-heading, 'Bryndan Write', serif);
    font-size: 1.25rem;
    font-weight: 500;
    color: #7e9678;
    -webkit-text-stroke: 2px white;
    paint-order: stroke fill;
    text-shadow: 0 1px 3px rgba(0,0,0,0.08);
    white-space: nowrap;
    margin-left: var(--brand-name-margin-left, 0px);
}

/* Search Form (pill shape) */
.header-search-form {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 auto;
}

.header-search-input {
    width: 100%;
    height: 34px;
    padding: 0 2.5rem 0 1rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 9999px;
    font-size: 0.8125rem;
    background: var(--gray-50, #f9fafb);
    color: var(--text-primary, #111827);
    transition: all 0.2s ease;
    outline: none;
}

.header-search-input:focus {
    background: #fff;
    border-color: var(--primary, #A8BBA3);
    box-shadow: 0 0 0 3px rgba(168, 187, 163, 0.15);
}

.header-search-input::placeholder {
    color: var(--text-muted, #6b7280);
}

.header-search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    padding: 0;
}

.header-search-btn:hover {
    color: var(--primary-dark, #8fa889);
    background: rgba(168, 187, 163, 0.1);
}

.header-search-btn svg {
    width: 16px;
    height: 16px;
}

/* Espace Formation Button */
.brand-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 0;
    height: 36px;
    padding: 0 1.25rem;
    background: linear-gradient(135deg, #f0f5ee 0%, #e8efe5 100%);
    border-radius: 8px;
    color: var(--primary-dark, #7e9678);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(90, 122, 80, 0.08);
    transition: all 0.2s ease;
    margin-right: 20px;
}

.brand-banner--btn:hover {
    background: linear-gradient(135deg, #e8efe5 0%, #dde8d9 100%);
    box-shadow: 0 2px 6px rgba(90, 122, 80, 0.15);
    color: var(--primary-darker, #5A7A50);
}

.brand-banner--btn i {
    font-size: 0.9375rem;
}

/* ==========================================================================
   USER ACTIONS (icon + label)
   ========================================================================== */
.header-user-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Individual action link: flex column, icon on top, label below */
.header-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    line-height: 1.2;
    white-space: nowrap;
}

.header-action:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--text-primary, #111827);
}

.header-action svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.header-action__label {
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1;
}

/* Publish action: highlighted with primary color */
.header-action--publish {
    border: 1.5px solid var(--primary, #A8BBA3);
    background: rgba(168, 187, 163, 0.06);
    color: var(--primary-dark, #8fa889);
    border-radius: 8px;
    padding: 0.3rem 0.625rem;
}

.header-action--publish:hover {
    background: var(--primary, #A8BBA3);
    color: #fff;
    border-color: var(--primary, #A8BBA3);
}

.header-action--publish svg {
    stroke: currentColor;
}

/* Badge (blue circle, absolute top-right) */
.header-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #3b82f6;
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: translate(4px, -4px);
}

/* Mini avatar (28px round) */
.user-avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* Mini initial circle (20px round) */
.user-initial-mini {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.6rem;
    border-radius: 50%;
    line-height: 1;
}

/* ==========================================================================
   USER DROPDOWN MENU
   ========================================================================== */
.user-dropdown {
    position: relative;
}

.user-toggle {
    padding: 0.25rem 0.5rem;
}

.user-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    padding: 0.375rem;
    z-index: 1001;
}

.user-dropdown .user-toggle[aria-expanded="true"] + .user-menu,
.user-dropdown:hover .user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}

.user-menu-item:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--text-primary, #111827);
}

.user-menu-item i {
    font-size: 0.9375rem;
    opacity: 0.6;
    width: 18px;
    text-align: center;
}

.user-menu-divider {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid var(--border-light, #f3f4f6);
}

.user-logout {
    color: var(--danger, #ef4444);
}

.user-logout:hover {
    background: #fef2f2;
    color: var(--danger-dark, #dc2626);
}

/* ==========================================================================
   LANGUAGE SELECTOR
   ========================================================================== */
.header-lang-selector {
    position: relative;
    flex-shrink: 0;
}

.header-lang-toggle {
    gap: 2px;
}

.header-lang-flag {
    width: 21px;
    height: 19px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.header-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 80px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    padding: 0.25rem;
    z-index: 1001;
}

.header-lang-toggle[aria-expanded="true"] + .header-lang-menu,
.header-lang-selector.open .header-lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 5px;
    transition: all 0.15s;
    white-space: nowrap;
}

.header-lang-option:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--text-primary, #111827);
}

.header-lang-option--active {
    background: rgba(168, 187, 163, 0.1);
    color: var(--primary-dark, #8fa889);
    font-weight: 600;
}

.header-lang-option--active:hover {
    background: rgba(168, 187, 163, 0.15);
}

/* ==========================================================================
   CART DROPDOWN
   ========================================================================== */
.topbar-cart-wrapper {
    position: relative;
}

.topbar-cart {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(4px, -4px);
    pointer-events: none;
    margin-left: -5px;
}

.cart-dropdown-footer-total {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.cart-item-mini-more {
    text-align: center;
    padding: 4px 0;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.cart-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.topbar-cart-wrapper:hover .cart-dropdown,
.topbar-cart[aria-expanded="true"] + .cart-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cart-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    font-weight: 600;
    font-size: 0.875rem;
}

.cart-dropdown-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted, #6b7280);
}

.cart-dropdown-body {
    padding: 0.75rem 1rem;
    max-height: 280px;
    overflow-y: auto;
}

.cart-dropdown-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #7e9678;
}

.cart-dropdown-empty i {
    font-size: 2rem;
    opacity: 0.3;
    margin-bottom: 0.5rem;
    display: block;
}

.cart-dropdown-empty p {
    margin: 0;
    font-size: 0.8125rem;
}

.cart-dropdown-items .cart-item-mini {
    display: flex;
    gap: 0.625rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.cart-dropdown-items .cart-item-mini:last-child {
    border-bottom: none;
}

.cart-item-mini-img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: var(--gray-100, #f3f4f6);
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-mini-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-mini-info {
    flex: 1;
    min-width: 0;
}

.cart-item-mini-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-mini-price {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.cart-dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-light, #f3f4f6);
}

.cart-dropdown-footer .btn-block {
    width: 100%;
}

/* ==========================================================================
   LINE 2: NAVIGATION BAR
   ========================================================================== */
.header-nav {
    height: var(--header-nav);
    background: #fff;
    border-top: 1px solid var(--border-light, #f3f4f6);
}

.header-nav .container {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Nav menu list */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.nav-item {
    position: relative;
}

/* Nav link wrapper (for items with mega-menus: link + toggle button side by side) */
.nav-link-wrapper {
    display: flex;
    align-items: center;
}

.nav-link-main {
    padding-right: 0.25rem;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 28px;
    background: none;
    border: none;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: all 0.15s;
}

.nav-dropdown-toggle:hover {
    color: var(--text-primary, #111827);
    background: var(--gray-100, #f3f4f6);
}

/* Base nav link */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 5px;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--text-primary, #111827);
}

.nav-link i {
    font-size: 0.875rem;
    opacity: 0.65;
}

/* Home link: icon only on desktop */
.nav-link--home {
    padding: 0;
}

.nav-link--home svg {
    width: 18px;
    height: 18px;
}

/* Nav arrow chevron */
.nav-arrow {
    font-size: 0.5625rem;
    transition: transform 0.2s;
}

.nav-link-wrapper[aria-expanded="true"] .nav-arrow {
    transform: rotate(180deg);
}

/* Spacer to push donate link to the right */
.nav-item--spacer {
    flex-grow: 1;
}

/* Donate link: warm red/heart color — specificity (0,2,0) to override navigation.css */
.nav-item--donate .nav-link--donate {
    color: #b30f0f;
    font-weight: 600;
}

.nav-item--donate .nav-link--donate:hover {
    background: rgba(179, 15, 15, 0.06);
    color: #8b0c0c;
}

.nav-item--donate .nav-link--donate svg,
.nav-item--donate .nav-donate-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Seedling icon */
.nav-icon-seedling {
    width: 16px;
    height: 16px;
    opacity: 0.65;
}

/* Clock icon (Actualite) */
.nav-icon-clock {
    width: 16px;
    height: 16px;
    opacity: 0.65;
}

/* Home icon */
.nav-home-icon {
    opacity: 1;
    color: var(--primary-dark, #7e9678);
}

/* ==========================================================================
   MEGA-MENUS
   ========================================================================== */
.mega-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    transform: translateY(8px);
    max-width: calc(100vw - 2rem);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    padding: 1.25rem 1.5rem;
}

/* Show mega-menu on wrapper aria-expanded="true" */
.nav-link-wrapper[aria-expanded="true"] + .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Also show on hover of the whole nav-item */
.nav-item.has-mega-menu:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---- Ressources: 5-column grid ---- */
.mega-menu--ressources {
    width: min(950px, 90vw);
}

.mega-menu__grid--5col {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

/* Mega-menu item: icon + div(strong + small) */
.mega-menu__item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary, #374151);
    transition: all 0.15s;
}

.mega-menu__item:hover {
    background: var(--gray-50, #f9fafb);
    color: var(--text-primary, #111827);
}

.mega-menu__item i {
    font-size: 1.125rem;
    opacity: 0.6;
    margin-top: 2px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.mega-menu__item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mega-menu__item strong {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.mega-menu__item small {
    font-size: 0.6875rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.3;
}

/* ---- La Pepiniere: split layout (desc left, CTAs right) ---- */
.mega-menu--pepiniere {
    width: min(480px, 90vw);
    padding: 1.5rem 2rem;
}

.mega-menu__split {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 20px;
}

.mega-menu__desc {
    flex: 1;
    min-width: 0;
}

.mega-menu__desc h3,
.mega-menu__desc .mega-menu__title {
    /* Header/menu → Quicksand (font-family-subtitle) imposé par l'utilisateur.
       Indispensable ici car Bryndan Write ne gère pas la graisse 700. */
    font-family: var(--font-family-subtitle);
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0 0 0.625rem 0;
}

.mega-menu__desc p {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.5;
    margin: 0;
}

.mega-menu__ctas {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Primary CTA: sage green background */
.mega-menu__cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s;
    white-space: nowrap;
}

.mega-menu__cta-btn--primary {
    background: var(--primary, #A8BBA3);
    color: #fff;
    border: 1.5px solid var(--primary, #A8BBA3);
}

.mega-menu__cta-btn--primary:hover {
    background: var(--primary-dark, #8fa889);
    border-color: var(--primary-dark, #8fa889);
}

.mega-menu__cta-btn--outline {
    background: transparent;
    color: var(--primary-dark, #8fa889);
    border: 1.5px solid var(--primary, #A8BBA3);
}

.mega-menu__cta-btn--outline:hover {
    background: rgba(168, 187, 163, 0.08);
    color: var(--primary-dark, #8fa889);
}

.mega-menu__cta-btn i {
    font-size: 0.875rem;
}

/* ---- Le Marche: 3-column layout (desc | col1 | col2) ---- */
.mega-menu--marche {
    width: min(620px, 90vw);
    padding: 1.5rem 2rem;
    /* Aligné à droite pour ne pas déborder de l'écran */
    right: 0;
    left: auto;
}

.mega-menu__three-col {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 1.25rem;
    padding: 10px 25px;
}

.mega-menu__col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Icon + text link in a column */
.mega-menu__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s;
}

.mega-menu__link:hover {
    background: var(--gray-50, #f9fafb);
    color: var(--text-primary, #111827);
}

.mega-menu__link i {
    font-size: 0.9375rem;
    opacity: 0.6;
    width: 18px;
    text-align: center;
}

/* See-all arrow link */
.mega-menu__see-all {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-dark, #8fa889);
    text-decoration: none;
    transition: color 0.15s;
}

.mega-menu__see-all:hover {
    color: var(--primary, #A8BBA3);
}

/* ---- Evenements: intro text + 3 vignette cards ---- */
.mega-menu--events {
    width: min(480px, 90vw);
    padding: 20px 10px 10px 10px !important;
    /* Aligné à droite pour ne pas déborder de l'écran */
    right: 0;
    left: auto;
}

.mega-menu__intro {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.mega-menu__vignettes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}

/* Vignette card: icon + label, border, hover effect */
.mega-menu__vignette {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary, #374151);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.15s;
}

.mega-menu__vignette:hover {
    border-color: var(--primary, #A8BBA3);
    background: rgba(168, 187, 163, 0.04);
    color: var(--primary-dark, #8fa889);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(168, 187, 163, 0.12);
}

.mega-menu__vignette i {
    font-size: 1.25rem;
    opacity: 0.7;
}


/* ---- Collectif: 4 vignettes alignees sur 1 ligne ---- */
/* Ordre : Discussions, Groupes, Actu des Membres, Membres.
   L'activation du module Groupes (FEATURE_GROUPS_ENABLED=true) a porte le
   nombre de vignettes de 3 a 4 ; l'ancienne largeur 460px faisait passer
   "Membres" a la ligne 2. On elargit donc le mega-menu et on decale sa
   position pour qu'il ne deborde pas sur la droite de l'ecran et reste
   visuellement centre sous "Espace collectif". */
.mega-menu--collectif {
    width: min(740px, 92vw);
    /* Aligner a droite pour ne jamais deborder de l'ecran */
    left: auto;
    right: 0;
    padding: 5px !important;
}

/* Grille 4 colonnes pour le variant collectif (override du repeat(3,1fr)
   par defaut de .mega-menu__vignettes ligne 1003). */
.mega-menu--collectif .mega-menu__vignettes {
    grid-template-columns: repeat(4, 1fr);
}

/* ==========================================================================
   LOGIN BUTTON (for non-authenticated state)
   ========================================================================== */
.btn-login {
    padding: 0.375rem 0.875rem;
    background: var(--gray-900, #111827);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--gray-700, #374151);
}

/* ==========================================================================
   MOBILE TOGGLE
   ========================================================================== */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary, #111827);
    border-radius: 1px;
    transition: all 0.2s;
}

.mobile-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   SEARCH PANEL (legacy overlay search)
   ========================================================================== */
.search-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.search-panel[hidden] {
    display: none;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-form input:focus {
    border-color: var(--primary, #A8BBA3);
}

.search-form button {
    padding: 0.75rem 1.25rem;
    background: var(--gray-900, #111827);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover {
    background: var(--gray-700, #374151);
}

.search-close {
    font-size: 1.5rem;
    background: transparent;
    color: var(--text-muted, #6b7280);
}

/* ==========================================================================
   MOBILE MENU (Full overlay with scroll)
   ========================================================================== */
.mobile-menu {
    position: fixed;
    top: var(--header-brand);
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu[hidden] {
    display: none;
}

.mobile-menu-inner {
    padding: 1rem;
}

.mobile-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.mobile-nav-item.has-sub {
    display: flex;
    flex-wrap: wrap;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex: 1;
    padding: 0.875rem 1rem;
    color: var(--text-primary, #111827);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--border-radius, 0.375rem);
    transition: background 0.15s ease;
}

/* Hover/active state includes full row for non-dropdown items */
.mobile-nav-item:not(.has-sub) .mobile-nav-link:hover,
.mobile-nav-item:not(.has-sub) .mobile-nav-link:active {
    background: var(--bg-secondary, #f9fafb);
}

/* For dropdown items, the whole row (link + toggle) should highlight together */
.mobile-nav-item.has-sub:hover,
.mobile-nav-item.has-sub:active {
    background: var(--bg-secondary, #f9fafb);
    border-radius: var(--border-radius, 0.375rem);
}

.mobile-nav-link i {
    font-size: 1.125rem;
    opacity: 0.55;
    width: 24px;
}

/* Align SVG icons (Home, Seedling, Donate) with Bootstrap Icons */
.mobile-nav-link .nav-home-icon,
.mobile-nav-link .nav-icon-seedling,
.mobile-nav-link .nav-donate-icon,
.mobile-nav-link .nav-icon-clock {
    width: 24px;
    height: 18px;
    opacity: 0.55;
    flex-shrink: 0;
}

.mobile-nav-link--donate {
    color: #b30f0f;
}

.mobile-nav-link--formation {
    color: var(--primary-dark, #7e9678);
    font-weight: 600;
}

.mobile-sub-toggle {
    width: 48px;
    background: none;
    border: none;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-sub-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
}

.mobile-sub {
    display: none;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0 0 0.5rem 2.5rem;
}

.mobile-sub-toggle[aria-expanded="true"] + .mobile-sub {
    display: block;
}

.mobile-sub li a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    font-size: 0.875rem;
}

/* Hide long descriptions in mobile sub-menus */
.mobile-sub li a .mobile-sub-desc {
    display: none;
}

.mobile-sub li a i {
    font-size: 0.9375rem;
    opacity: 0.5;
}

.mobile-sub-cta a {
    color: var(--primary-dark, #8fa889);
    font-weight: 600;
}

.mobile-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.mobile-quick-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #374151);
    text-decoration: none;
    background: var(--gray-50, #f9fafb);
    border-radius: 6px;
    transition: background 0.2s;
    position: relative;
}

.mobile-quick-link:hover {
    background: var(--gray-200, #e5e7eb);
    color: var(--text-primary, #111827);
}

.mobile-search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.mobile-search-form input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.875rem;
}

.mobile-search-form button {
    padding: 0.625rem 0.75rem;
    background: var(--primary-dark, #8fa889);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.mobile-auth {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-light, #f3f4f6);
    margin-top: 1rem;
}

.mobile-btn {
    display: block;
    padding: 0.875rem;
    text-align: center;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.mobile-btn-outline {
    border: 2px solid var(--gray-900, #111827);
    color: var(--gray-900, #111827);
}

.mobile-btn-primary {
    background: var(--gray-900, #111827);
    color: #fff;
}


/* Mobile search toggle - shown only on mobile/tablet */
.mobile-search-toggle {
    display: none;
}

/* Mobile search overlay - dropdown below header */
.mobile-search-overlay {
    display: none;
    position: fixed;
    top: var(--header-brand);
    left: 0;
    right: 0;
    background: var(--bg-primary, #fff);
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 998;
    animation: searchSlideDown 0.2s ease;
}

.mobile-search-overlay.active {
    display: flex;
}

.mobile-search-overlay form {
    display: flex;
    width: 100%;
    gap: 8px;
}

.mobile-search-overlay input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 8px);
    font-size: 0.95rem;
    outline: none;
    background: var(--bg-secondary, #f8f9fa);
}

.mobile-search-overlay input:focus {
    border-color: var(--primary, #7e9678);
    box-shadow: 0 0 0 2px rgba(126,150,120,0.15);
}

.mobile-search-overlay button {
    padding: 10px 16px;
    background: var(--primary, #7e9678);
    color: #fff;
    border: none;
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes searchSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE - TABLET (< 1024px)
   Hide nav line, show mobile toggle
   ========================================================================== */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }

    .mobile-toggle {
        display: flex;
    }

    :root {
        --header-brand: 52px;
    }

    .header-brand {
        height: var(--header-brand);
    }

    .brand-logo-img {
    position: relative;
    z-index: 2;
        max-height: 42px;
    }

    .brand-name {
        font-size: 1.1rem;
    }

    .header-search-form {
        width: 220px;
    }

    .brand-banner {
        display: none;
    }


    /* Reorder header items for mobile */
    .header-brand .container {
        flex-wrap: nowrap;
    }

    .header-search-form {
        display: none;
    }
    
    /* Search toggle stays near logo (left side) */
    .mobile-search-toggle {
        display: flex;
    }
    
    /* Push user-actions group to the right */
    .header-user-actions {
        margin-left: auto;
    }
    
    .header-lang-selector {
        margin-left: 4px;
    }
    
    .mobile-toggle {
        margin-left: 4px;
    }
    
    .mobile-menu {
        top: var(--header-brand);
    }
}

/* ==========================================================================
   RESPONSIVE - MOBILE (< 768px)
   Hide search, hide banner, icons only
   ========================================================================== */
@media (max-width: 768px) {
    .site-header .container {
        padding: 0 0.75rem;
    }

    :root {
        --header-brand: 48px;
    }

    .header-brand {
        height: var(--header-brand);
    }

    .brand-logo-img {
    position: relative;
    z-index: 2;
        max-height: 38px;
    }

    .brand-name {
        display: none;
    }

    /* Hide search form on mobile */
    .header-search-form {
        display: none;
    }

    /* Partner banner already hidden from tablet */

    /* User actions: icons only, no labels */
    .header-action__label {
        display: none;
    }

    .header-action span:not(.header-badge):not(.cart-badge):not(.header-action__label) {
        display: none;
    }

    .header-action--publish span {
        display: none;
    }

    .header-action {
        padding: 0.25rem;
    }

    .header-action--publish {
        padding: 0.3rem;
    }

    .header-user-actions {
        gap: 0;
    }

    .btn-login {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .mobile-menu {
        top: var(--header-brand);
    }

    /* Cart dropdown: full width on mobile */
    .cart-dropdown {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0 0 12px 12px;
    }
}

/* ==========================================================================
   RESPONSIVE - SMALL MOBILE (< 480px)
   ========================================================================== */
@media (max-width: 480px) {
    .site-header .container {
        padding: 0 0.5rem;
    }

    .header-brand .container {
        gap: 0.375rem;
    }

    .brand-logo-img {
    position: relative;
    z-index: 2;
        max-height: 28px;
    }

    .header-action svg {
        width: 20px;
        height: 20px;
    }

    .header-lang-flag {
        width: 18px;
        height: 13px;
    }

    .user-avatar-mini {
        width: 20px;
        height: 20px;
    }
    .user-initial-mini {
        width: 18px;
        height: 18px;
        font-size: 0.55rem;
    }
}

/* ==========================================================================
   THEME TOGGLE — segmented switch horizontal (soleil | lune)
   Les deux icônes sont TOUJOURS visibles, disposées à l'horizontale.
   Un "thumb" (pastille colorée) glisse sur l'icône active.
   - Mode light : thumb jaune-orangé derrière le soleil
   - Mode dark  : thumb bleu nuit derrière la lune
   Layout forcé en row + inline-flex pour qu'aucun parent ne puisse les
   empiler verticalement (ex: .header-action { flex-direction: column }).
   ========================================================================== */
.header-theme-toggle {
    /* Reset bouton */
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    /* Mise en page */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Ne pas hériter de .header-action */
    flex-direction: row;
    line-height: 0;
}

.header-theme-toggle .theme-toggle-track {
    position: relative;
    display: inline-flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 58px;
    height: 28px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fef3c7; /* FLAT crème chaud (jour) */
    border: 1.3px solid #8b6347;
    box-shadow: none; /* flat, aucun relief */
    transition: background 0.3s ease, border-color 0.3s ease;
    margin-right: 20px;
}

.header-theme-toggle .theme-toggle-thumb {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fcd9a8; /* flat peach pâle derrière le soleil actif (jour) */
    box-shadow: none; /* flat */
    transform: translateY(-50%);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.35s ease;
    pointer-events: none;
    z-index: 1;
}

.header-theme-toggle .theme-icon {
    display: inline-block !important; /* override display:none possible d'ailleurs */
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

/* État LIGHT (soleil actif) — défaut */
.header-theme-toggle .theme-icon--sun {
    color: #7c2d12; /* brun-rouge profond : soleil actif sur thumb peach */
    opacity: 1;
}
.header-theme-toggle .theme-icon--moon {
    color: #3730a3; /* bleu nuit tirant vers le mauve — lune inactive */
    opacity: 0.55;
}

/* État DARK — explicit (data-theme="dark") */
[data-theme="dark"] .header-theme-toggle .theme-toggle-track {
    background: #1e293b; /* flat slate sombre (nuit) */
    border-color: #8b6347;
    box-shadow: none;
}
[data-theme="dark"] .header-theme-toggle .theme-toggle-thumb {
    left: 33px; /* 58 - 22 - 3 = 33 */
    background: #4338ca; /* flat bleu nuit mauve derrière la lune active */
    box-shadow: none;
}
[data-theme="dark"] .header-theme-toggle .theme-icon--sun {
    color: #fe8c07; /* jaune orangé vif — soleil inactif, signal "cliquer pour jour" */
    opacity: 0.55;
}
[data-theme="dark"] .header-theme-toggle .theme-icon--moon {
    color: #c7d2fe; /* indigo pâle : lune active, contraste max sur thumb bleu nuit */
    opacity: 1;
}

/* Pas de fallback prefers-color-scheme : le thème par défaut est "jour".
   Seul un choix explicite (localStorage) peut basculer en mode sombre. */

/* Hover/focus */
.header-theme-toggle:hover .theme-toggle-track {
    border-color: #6d4a32;
}
[data-theme="dark"] .header-theme-toggle:hover .theme-toggle-track {
    border-color: #6d4a32;
}
.header-theme-toggle:focus-visible {
    outline: none;
}
.header-theme-toggle:focus-visible .theme-toggle-track {
    box-shadow: 0 0 0 3px rgba(168, 187, 163, 0.35);
}

/* ==========================================================================
   DARK MODE — HEADER (bg sombre sage Permathèque, nav links lisibles)
   Les règles par défaut (#fff) étaient hardcodées → override ici pour que
   le mode sombre ait un rendu cohérent avec la palette nocturne Permathèque.
   ========================================================================== */
[data-theme="dark"] .site-header {
    background: #1a2218;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .header-brand {
    background: #1a2218;
}

/* Logo : pas de bordure visible en mode nuit, mais on garde la border
   box pour conserver exactement la même taille qu'en mode jour. */
[data-theme="dark"] .brand-logo-img {
    border-color: transparent;
}

[data-theme="dark"] .header-nav {
    background: #243022;
    border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-link {
    color: #c8d4c2;
}

[data-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

[data-theme="dark"] .nav-link i {
    opacity: 0.8;
}

[data-theme="dark"] .nav-dropdown-toggle {
    color: #a4b29d;
}

[data-theme="dark"] .nav-dropdown-toggle:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .header-search-input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e8efe4;
}

[data-theme="dark"] .header-search-input::placeholder {
    color: #8fa489;
}

[data-theme="dark"] .header-action {
    color: #c8d4c2;
}

[data-theme="dark"] .header-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

[data-theme="dark"] .brand-name {
    color: #e8efe4;
    -webkit-text-stroke: 2px #243022;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Même traitement en mode sombre système quand l'utilisateur n'a pas d'override manuel */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .site-header {
        background: #1a2218;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
    :root:not([data-theme="light"]) .header-brand {
        background: #1a2218;
    }
    :root:not([data-theme="light"]) .header-nav {
        background: #243022;
        border-top-color: rgba(255, 255, 255, 0.06);
    }
    :root:not([data-theme="light"]) .nav-link {
        color: #c8d4c2;
    }
    :root:not([data-theme="light"]) .nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }
    :root:not([data-theme="light"]) .nav-link i {
        opacity: 0.8;
    }
    :root:not([data-theme="light"]) .nav-dropdown-toggle {
        color: #a4b29d;
    }
    :root:not([data-theme="light"]) .nav-dropdown-toggle:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.08);
    }
    :root:not([data-theme="light"]) .header-search-input {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.12);
        color: #e8efe4;
    }
    :root:not([data-theme="light"]) .header-search-input::placeholder {
        color: #8fa489;
    }
    :root:not([data-theme="light"]) .header-action {
        color: #c8d4c2;
    }
    :root:not([data-theme="light"]) .header-action:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }
    :root:not([data-theme="light"]) .brand-name {
        color: #e8efe4;
        -webkit-text-stroke: 2px #243022;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
}
