/* ==========================================================
   MF CARBON CYCLES - FEUILLE DE STYLE PRINCIPALE
   Version consolidée et responsive
   Les styles de navigation sont isolés des autres composants.
========================================================== */

/* ----------------------------------------------------------
   1. BASE DU SITE
---------------------------------------------------------- */

:root {
    --mf-black: #17191c;
    --mf-dark: #22252a;
    --mf-gold: #e5bd24;
    --mf-gold-dark: #927500;
    --mf-white: #ffffff;
    --mf-grey: #f3f4f5;
    --mf-text: #292d32;
    --mf-muted: #777e87;
    --mf-border: #e5e7eb;
    --mf-shadow: 0 8px 28px rgba(0, 0, 0, .13);
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--mf-text);
}

img,
video {
    max-width: 100%;
    height: auto;
}

main {
    padding: 15px;
}

/* Les anciens styles génériques header/footer sont conservés,
   mais ne s'appliquent plus à la bannière principale du site. */
header:not(.mf-site-header),
footer {
    padding: 10px;
    background: #eee;
}

/* ----------------------------------------------------------
   2. PRODUITS ET TABLEAUX
---------------------------------------------------------- */

.produit {
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

td,
th {
    border: 1px solid #ccc;
    padding: 6px;
}

/* ----------------------------------------------------------
   3. GALERIES PHOTOS
   Règles précédemment dispersées regroupées ici.
---------------------------------------------------------- */

.galerie {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.galerie img.thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    border: 2px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease;
}

.galerie img.thumb:hover {
    transform: scale(1.03);
    border-color: #888;
}

.image-principale {
    margin: 10px 0;
}

.image-principale img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    border-radius: 6px;
    object-fit: contain;
}

/* ----------------------------------------------------------
   4. LIGHTBOX
---------------------------------------------------------- */

.lightbox {
    display: none;
    position: fixed;
    z-index: 5000;
    inset: 0;
    overflow: auto;
    padding: 5vh 15px;
    background: rgba(0, 0, 0, .88);
}

.lightbox-content {
    display: block;
    margin: 0 auto;
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox .fermer {
    position: fixed;
    top: 16px;
    right: 24px;
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

/* ----------------------------------------------------------
   5. CARTES W3.CSS ET ONGLETS
---------------------------------------------------------- */

.w3-card .w3-container {
    padding: 8px;
    min-height: 60px;
}

.tab button {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 20px;
    margin-right: 10px;
    font-size: 16px;
    transition: background-color .3s ease, color .3s ease;
}

.tab button:last-child {
    margin-right: 0;
}

/* ==========================================================
   6. NAVIGATION MF CARBON CYCLES
   Toutes les règles sont préfixées .mf- pour éviter
   les conflits avec les pages et composants de la boutique.
========================================================== */

/* Bannière et logo */
header.mf-site-header {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    text-align: center;
    background: transparent;
    overflow: hidden;
}

header.mf-site-header .mf-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    height: auto;
    margin: 0;
    padding: 0;
    object-fit: cover;
}

.mf-logo-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .2);
}

.mf-logo-overlay img {
    display: block;
    width: 230px;
    max-width: 75vw;
    height: auto;
}

/* Barre de navigation */
.mf-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    margin: 0;
    padding: 12px 24px;
    background: var(--mf-black);
    border-bottom: 3px solid var(--mf-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, .18);
}

.mf-nav-left,
.mf-nav-right {
    display: flex;
    align-items: center;
    gap: 13px;
}

/* Bouton d'ouverture */
.mf-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #555b63;
    border-radius: 9px;
    background: #292d32;
    color: #fff;
    font-size: 19px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.mf-menu-button:hover,
.mf-menu-button:focus-visible {
    background: var(--mf-gold);
    color: var(--mf-black);
    border-color: var(--mf-gold);
}

.mf-nav-label {
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

/* Recherche */
.mf-search {
    display: flex;
    align-items: center;
    height: 42px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
}

.mf-search input {
    width: 230px;
    min-width: 0;
    height: 42px;
    padding: 0 13px;
    border: 0;
    outline: 0;
    color: var(--mf-text);
    font-size: 13px;
}

.mf-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 45px;
    width: 45px;
    height: 42px;
    border: 0;
    background: var(--mf-gold);
    color: var(--mf-black);
    cursor: pointer;
    transition: background .2s ease;
}

.mf-search button:hover {
    background: #f2d45b;
}

/* Compte client */
.mf-account {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 11px;
    border-radius: 7px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: background .2s ease, color .2s ease;
}

.mf-account:hover {
    background: #30353b;
    color: var(--mf-gold);
}

/* Panier */
.mf-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 8px;
    background: var(--mf-gold);
    color: var(--mf-black);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    transition: background .2s ease;
}

.mf-cart:hover {
    background: #f2d45b;
    color: var(--mf-black);
}

.mf-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 20px;
    background: var(--mf-black);
    color: #fff;
    font-size: 11px;
}

/* Fond assombri */
.mf-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1998;
    background: rgba(0, 0, 0, .62);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.mf-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Panneau latéral */
.mf-side-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1999;
    display: flex;
    flex-direction: column;
    width: min(380px, 90vw);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f5f6f7;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .25);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .35s cubic-bezier(.22, .61, .36, 1), visibility .35s;
}

.mf-side-menu.active {
    transform: translateX(0);
    visibility: visible;
}

/* En-tête du panneau */
.mf-menu-header {
    flex: 0 0 auto;
    padding: 23px 20px 18px;
    background: var(--mf-black);
    border-bottom: 3px solid var(--mf-gold);
    color: #fff;
}

.mf-menu-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.mf-menu-logo {
    display: block;
    width: 150px;
    max-width: 65%;
    max-height: 65px;
    padding: 4px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.mf-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 39px;
    width: 39px;
    height: 39px;
    padding: 0;
    border: 1px solid #555b63;
    border-radius: 8px;
    background: #30343a;
    color: #fff;
    font-size: 19px;
    cursor: pointer;
}

.mf-menu-close:hover {
    background: var(--mf-gold);
    color: var(--mf-black);
}

.mf-menu-subtitle {
    margin-top: 14px;
    color: #c6c9cd;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Titres des rubriques */
.mf-menu-section {
    padding: 19px 20px 8px;
    color: var(--mf-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Catégories principales */
.mf-category {
    margin: 5px 12px;
    overflow: hidden;
    border: 1px solid var(--mf-border);
    border-radius: 9px;
    background: #fff;
}

.mf-category-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 13px 14px;
    border: 0;
    background: #fff;
    color: var(--mf-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.mf-category-button:hover,
.mf-category-button[aria-expanded="true"] {
    background: #f5f0dc;
    color: var(--mf-gold-dark);
}

.mf-category-button i {
    flex: 0 0 auto;
    margin-left: 12px;
    font-size: 12px;
    transition: transform .25s ease;
}

.mf-category-button[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Sous-catégories */
.mf-subcategories {
    display: none;
    padding: 4px 11px 9px;
    background: #f5f6f7;
}

.mf-subcategories.show {
    display: block;
}

.mf-subcategories a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 9px;
    border-bottom: 1px solid #e5e6e8;
    color: #41464d;
    font-size: 12px;
    text-decoration: none;
    transition: color .2s ease, padding .2s ease;
}

.mf-subcategories a:last-child {
    border-bottom: 0;
}

.mf-subcategories a:hover,
.mf-subcategories a.current {
    padding-left: 14px;
    color: var(--mf-gold-dark);
    font-weight: 700;
}

.mf-category-count {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 20px;
    background: #eee8d3;
    color: #665300;
    font-size: 10px;
    font-weight: 800;
}

/* Liens complémentaires */
.mf-menu-links {
    padding: 7px 12px 24px;
}

.mf-menu-links a,
.mf-logout-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 2px 0;
    padding: 12px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #343940;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.mf-menu-links a i,
.mf-logout-button i {
    flex: 0 0 20px;
    width: 20px;
    color: var(--mf-gold-dark);
    font-size: 15px;
    text-align: center;
}

.mf-menu-links a:hover,
.mf-logout-button:hover {
    background: #eee8d3;
    color: #765e00;
}

.mf-menu-links form {
    margin: 0;
}

/* Pied du panneau */
.mf-menu-footer {
    margin-top: auto;
    padding: 13px 20px;
    border-top: 1px solid var(--mf-border);
    color: #8a9098;
    font-size: 10px;
    text-align: center;
}

/* Focus clavier */
.mf-menu-button:focus-visible,
.mf-menu-close:focus-visible,
.mf-category-button:focus-visible,
.mf-search button:focus-visible,
.mf-account:focus-visible,
.mf-cart:focus-visible,
.mf-menu-links a:focus-visible,
.mf-logout-button:focus-visible {
    outline: 3px solid #c49e00;
    outline-offset: 2px;
}

/* ----------------------------------------------------------
   7. RESPONSIVE
---------------------------------------------------------- */

@media (max-width: 768px) {
    header.mf-site-header .mf-banner {
        max-height: 200px;
    }

    .mf-logo-overlay img {
        width: 155px;
    }

    .mf-navbar {
        gap: 7px;
        padding: 9px 10px;
    }

    .mf-nav-left,
    .mf-nav-right {
        gap: 6px;
    }

    .mf-nav-label {
        display: none;
    }

    .mf-search input {
        width: clamp(90px, 25vw, 155px);
        font-size: 12px;
    }

    .mf-account {
        padding: 10px 8px;
    }

    .mf-account span,
    .mf-cart-label {
        display: none;
    }

    .mf-cart {
        gap: 6px;
        padding: 10px;
    }

    .galerie {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 380px) {
    .mf-search input {
        width: 82px;
    }

    .mf-menu-button {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .galerie {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Respect des préférences de réduction des animations */
@media (prefers-reduced-motion: reduce) {
    .mf-side-menu,
    .mf-menu-overlay,
    .mf-menu-button,
    .mf-category-button,
    .mf-menu-links a,
    .mf-subcategories a,
    .galerie img.thumb {
        scroll-behavior: auto;
        transition: none;
    }
}


/* ----------------------------------------------------------
   8. MODALE DU PANIER - AJOUT DU MONTAGE MF-CARBON
   Elle doit passer au-dessus de la barre de navigation sticky.
---------------------------------------------------------- */

#modalOptions.w3-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 5000 !important;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px 12px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .45);
}

#modalOptions .w3-modal-content {
    position: relative;
    z-index: 5001;
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 48px);
    margin: 0 auto;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .28);
}

/* Le bandeau bleu reste visible en haut de la fenêtre. */
#modalOptions .w3-modal-content > header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 16px;
}

/* Évite qu'un style global de header/footer déforme le titre de la modale. */
#modalOptions .w3-modal-content > header h3 {
    margin: 8px 32px 8px 0;
    line-height: 1.35;
}

/* Confort de lecture sur les petits écrans. */
@media (max-width: 600px) {
    #modalOptions.w3-modal {
        padding: 12px 8px;
    }

    #modalOptions .w3-modal-content {
        max-height: calc(100vh - 24px);
    }
}


/* ----------------------------------------------------------
   9. CORRECTION DU DÉPLOIEMENT DES CATÉGORIES DU MENU
   Empêche Flexbox de comprimer les rubriques et sous-rubriques.
---------------------------------------------------------- */

.mf-side-menu {
    display: block !important;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
}

/* Chaque rubrique conserve sa hauteur naturelle. */
.mf-menu-header,
.mf-menu-section,
.mf-category,
.mf-menu-links,
.mf-menu-footer {
    flex-shrink: 0;
}

/* Les catégories ouvertes ne sont plus comprimées ni coupées. */
.mf-category {
    height: auto;
    min-height: 0;
    overflow: visible;
}

.mf-category-button {
    min-height: 48px;
    height: auto;
}

/* Affiche toutes les sous-catégories de la rubrique ouverte. */
.mf-subcategories {
    display: none;
    height: auto;
    max-height: none;
    overflow: visible;
}

.mf-subcategories.show {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
}

/* Le panneau entier défile, pas chaque rubrique séparément. */
.mf-menu-links {
    height: auto;
    overflow: visible;
}
