/* ============================================================
   nav-mega.css — Mega menu + Mobile nav
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   TRIGGER BOUTON
   ────────────────────────────────────────────────────────── */

.mega-wrap {
    position: static; /* relatif au header-inner, pas au nav */
}

.mega-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #f04e1a;
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, box-shadow .18s, transform .15s;
    line-height: 1;
    user-select: none;
}

.mega-trigger:hover,
.mega-trigger[aria-expanded="true"] {
    background: #d93e0e;
    box-shadow: 0 4px 14px rgba(240,78,26,.35);
    transform: translateY(-1px);
}

.mega-trigger-icon {
    font-size: 1em;
    line-height: 1;
    transition: transform .2s;
}

.mega-trigger[aria-expanded="true"] .mega-trigger-icon {
    transform: rotate(90deg);
}

.mega-trigger-arrow {
    font-size: 0.65em;
    margin-left: 2px;
    transition: transform .22s ease;
    opacity: .8;
}

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

/* ──────────────────────────────────────────────────────────
   PANEL PRINCIPAL
   ────────────────────────────────────────────────────────── */

.mega-panel {
    position: fixed;          /* fixed pour éviter les débordements */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 12px 40px rgba(0,0,0,.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .22s ease, transform .22s ease;
    z-index: 8888;
    overflow: hidden;
}

/* Décalage depuis le haut du header (ajusté via JS) */
.mega-panel { padding-top: var(--mega-top, 110px); }

.mega-panel.mega-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ──────────────────────────────────────────────────────────
   GRILLE INTÉRIEURE
   ────────────────────────────────────────────────────────── */

.mega-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 32px 24px;
    border-bottom: 1px solid #f0f0f0;
}

/* ──────────────────────────────────────────────────────────
   COLONNES CATÉGORIES
   ────────────────────────────────────────────────────────── */

.mega-col {
    padding: 0 16px 8px;
    border-right: 1px solid #f2f2f2;
}

.mega-col:first-child { padding-left: 0; }
.mega-col:last-child  { border-right: none; padding-right: 0; }

/* Titre catégorie */
.mega-cat-head {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 0 10px;
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #111;
    text-decoration: none;
    border-bottom: 2px solid #f04e1a;
    margin-bottom: 10px;
    transition: color .15s;
    letter-spacing: .01em;
    text-transform: uppercase;
}

.mega-cat-head:hover { color: #f04e1a; }

.mega-cat-icon {
    font-size: 1.15em;
    flex-shrink: 0;
    line-height: 1;
}

.mega-cat-name { flex: 1; line-height: 1.2; }

.mega-cat-arr {
    font-size: 0.7em;
    opacity: 0;
    transition: opacity .15s, transform .15s;
    flex-shrink: 0;
}

.mega-cat-head:hover .mega-cat-arr {
    opacity: 1;
    transform: translateX(4px);
}

/* Sous-catégories */
.mega-sub-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mega-sub-list li a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.79rem;
    color: #555;
    text-decoration: none;
    border-radius: 7px;
    transition: background .12s, color .12s, padding-left .14s;
    line-height: 1.3;
}

.mega-sub-list li a::before {
    content: '›';
    font-size: 0.85em;
    color: #ccc;
    transition: color .12s, transform .12s;
    flex-shrink: 0;
}

.mega-sub-list li a:hover {
    background: #fff5f2;
    color: #f04e1a;
    padding-left: 12px;
}

.mega-sub-list li a:hover::before {
    color: #f04e1a;
    transform: translateX(2px);
}

/* ──────────────────────────────────────────────────────────
   PIED DU MEGA — liens rapides discrets
   ────────────────────────────────────────────────────────── */

.mega-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 32px;
}

.mega-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-radius: 100px;
    border: 1px solid #eee;
    transition: background .14s, color .14s, border-color .14s;
    white-space: nowrap;
}

.mega-footer-link:hover {
    background: #fff5f2;
    color: #f04e1a;
    border-color: #f04e1a;
}

/* Overlay sombre derrière le mega */
.mega-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 8887;
    backdrop-filter: blur(1px);
    opacity: 0;
    transition: opacity .22s;
}

.mega-overlay.active {
    display: block;
    opacity: 1;
}

/* ──────────────────────────────────────────────────────────
   NAV DESKTOP
   ────────────────────────────────────────────────────────── */

.main-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    overflow: visible;
}

.main-nav > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 500;
    padding: 7px 11px;
    border-radius: 8px;
    color: var(--ink-2, #333);
    text-decoration: none;
    transition: background .14s, color .14s;
}

.main-nav > a:hover { background: #f5f5f5; color: #111; }
.main-nav > .nav-hot { color: #f04e1a; font-weight: 600; }
.main-nav > .nav-hot:hover { background: #fff5f2; }

/* ──────────────────────────────────────────────────────────
   MOBILE NAV — tiroir latéral propre
   ────────────────────────────────────────────────────────── */

.mobile-nav {
    /* Tiroir latéral depuis la gauche */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.mobile-nav.mobile-open {
    transform: translateX(0);
}

/* En-tête du tiroir */
.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.mobile-nav-title {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    letter-spacing: -.01em;
}

.mobile-nav-close {
    width: 34px;
    height: 34px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background .15s;
}

.mobile-nav-close:hover { background: #ebebeb; }

/* Section catégories */
.mobile-nav-section {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.mobile-nav-section-label {
    padding: 10px 20px 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #aaa;
}

/* Lien catégorie parent */
.mobile-cat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    transition: background .12s, color .12s;
    border-left: 3px solid transparent;
}

.mobile-cat-item:hover,
.mobile-cat-item:focus {
    background: #fff5f2;
    color: #f04e1a;
    border-left-color: #f04e1a;
}

.mobile-cat-icon {
    font-size: 1.2em;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.mobile-cat-name { flex: 1; }

.mobile-cat-count {
    font-size: 0.72rem;
    font-weight: 400;
    color: #bbb;
    background: #f5f5f5;
    padding: 2px 7px;
    border-radius: 100px;
}

/* Séparateur */
.mobile-nav-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 8px 20px;
}

/* Overlay mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9998;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .28s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ────────────────────────────────────────────────────────── */

/* Masquer mega sur mobile */
@media (max-width: 768px) {
    .mega-wrap    { display: none; }
    .mega-overlay { display: none !important; }
    /* Les autres liens de la nav desktop sont cachés aussi */
    .main-nav     { display: none; }
}

/* Masquer burger + mobile nav sur desktop */
@media (min-width: 769px) {
    .h-burger      { display: none; }
    .mobile-nav    { display: none !important; }
    .mobile-overlay { display: none !important; }
}

/* Tablette : mega menu plus compact */
@media (min-width: 769px) and (max-width: 1100px) {
    .mega-inner {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        padding: 20px 24px 18px;
    }
    .mega-col { padding: 0 12px 8px; }
    .mega-cat-head { font-size: 0.74rem; }
    .mega-sub-list li a { font-size: 0.75rem; }
    .mega-footer { padding: 10px 24px; }
    .main-nav > a { font-size: 0.8rem; padding: 6px 8px; }
    .mega-trigger { padding: 7px 12px; font-size: 0.82rem; }
}
/* ============================================================
   MENU CATÉGORIES — liste verticale (patch 07)
   Remplace la grille de colonnes étroites : avec des catégories
   sans sous-catégories, elle produisait 10 colonnes vides.
   ============================================================ */

.mega-panel .mega-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 40px;
    row-gap: 0;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 32px 18px;
    align-content: start;
}

.mega-item {
    padding: 0;
    border-right: none;
}

/* Une ligne = une catégorie */
.mega-panel .mega-cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    margin: 0;
    border-bottom: 1px solid #f2f2f2;
    border-radius: 8px;
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: #111;
    text-decoration: none;
    transition: background .15s, color .15s, padding-left .15s;
}

.mega-panel .mega-cat-head:hover {
    background: #fff5f0;
    color: #f04e1a;
    padding-left: 16px;
    border-bottom-color: transparent;
}

.mega-panel .mega-cat-icon {
    font-size: 1.25rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #faf6f1;
    border-radius: 8px;
    flex-shrink: 0;
}

.mega-panel .mega-cat-head:hover .mega-cat-icon {
    background: #ffe6da;
}

.mega-panel .mega-cat-name {
    flex: 1;
    line-height: 1.25;
    min-width: 0;
}

/* Compteur de produits */
.mega-cat-nb {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9a9a9a;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 99px;
    flex-shrink: 0;
}

.mega-panel .mega-cat-head:hover .mega-cat-nb {
    background: #ffe6da;
    color: #f04e1a;
}

.mega-panel .mega-cat-arr {
    font-size: 0.8rem;
    opacity: 0;
    color: #f04e1a;
    transition: opacity .15s, transform .15s;
    flex-shrink: 0;
}

.mega-panel .mega-cat-head:hover .mega-cat-arr {
    opacity: 1;
    transform: translateX(3px);
}

/* Sous-catégories : décalées sous leur parent */
.mega-panel .mega-sub-list {
    list-style: none;
    margin: 0 0 6px;
    padding: 4px 0 4px 54px;
}

.mega-panel .mega-sub-list li a {
    display: block;
    padding: 5px 0;
    font-size: 0.82rem;
    color: #6b6b6b;
    text-decoration: none;
    transition: color .15s, padding-left .15s;
}

.mega-panel .mega-sub-list li a:hover {
    color: #f04e1a;
    padding-left: 4px;
}

/* Une seule colonne dès que la place manque */
@media (max-width: 760px) {
    .mega-panel .mega-inner {
        grid-template-columns: 1fr;
        padding: 14px 18px 12px;
        max-height: 62vh;
        overflow-y: auto;
    }
    .mega-panel .mega-cat-head { font-size: 0.86rem; padding: 10px 8px }
    .mega-panel .mega-sub-list { padding-left: 46px }
}
