/* =========================================================
   OVERRIDES – Images en carré (thumbnail)
   ========================================================= */

/* 1) On force les conteneurs d'image "petit carré" */
:is(.photo, .thumb, .thumbnail, .img, .image, .card-photo, .card-thumb, .product-thumb, .item-thumb) {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  flex: 0 0 72px;
}

/* 2) L'image remplit le carré et se recadre proprement */
:is(.photo, .thumb, .thumbnail, .img, .image, .card-photo, .card-thumb, .product-thumb, .item-thumb) img,
img:is(.photo, .thumb, .thumbnail, .img, .image, .card-photo, .card-thumb, .product-thumb, .item-thumb) {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
  object-position: center;
}

/* 3) Si l'image manque : placeholder discret */
img[src=""], img:not([src]) { visibility: hidden; }

:is(.photo, .thumb, .thumbnail, .img, .image, .card-photo, .card-thumb, .product-thumb, .item-thumb)::after {
  content: "Photo";
  font-size: 11px;
  color: #9aa4b2;
  font-weight: 500;
}
:is(.photo, .thumb, .thumbnail, .img, .image, .card-photo, .card-thumb, .product-thumb, .item-thumb):has(img[src]):after {
  content: none;
}

/* THUMB – verrouillage total */
article.card .card-top .thumb{
  width: 72px !important;
  height: 72px !important;
  aspect-ratio: 1/1 !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  background: #f3f4f6 !important;
  padding: 0 !important;
  display: block !important;
  line-height: 0 !important;
}

article.card .card-top .thumb > img{
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 100% !important;
  min-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}


/* Empêche le layout de “tirer” la vignette */
article.card .card-top{
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
}

/* important: on neutralise les règles globales du style.css */
.card .thumb img{
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  display: block;
  object-fit: cover;
  object-position: center;
}

/* --- Toggle UI (chevrons) --- */
.toggle-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-header .chevron {
  transition: transform 0.15s ease-in-out;
}

.is-collapsed > .toggle-header .chevron {
  transform: rotate(-90deg);
}

/* --- Collapsing --- */
.collapsible-content {
  display: block;
}

.is-collapsed > .collapsible-content {
  display: none;
}

/* --- Search bar --- */
.catalog-search {
  position: sticky; /* optionnel; retire si tu ne veux pas sticky */
  top: 0;
  z-index: 50;
  background: #fff;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.catalog-search input {
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.20);
  border-radius: 10px;
  outline: none;
}

.catalog-search{ padding:12px 0; border-bottom:1px solid rgba(0,0,0,.06); background:#fff; }
.catalog-search input{ width:100%; max-width:520px; padding:10px 12px; border:1px solid rgba(0,0,0,.2); border-radius:10px; }

.toggle-header{ cursor:pointer; user-select:none; display:flex; align-items:center; gap:8px; }
.toggle-header .chevron{ transition:transform .15s ease-in-out; }
.is-collapsed > .toggle-header .chevron{ transform:rotate(-90deg); }

.collapsible-content{ display:block; }
.is-collapsed > .collapsible-content{ display:none; }

/* ===== Diff visuelle Catégorie vs Sous-catégorie (tons sobres) ===== */

/* Catégorie */
.section > .section-header{
  background: #F4F7FB;           /* bleu très clair */
  border: 1px solid #D6E2F0;
  border-left: 6px solid #0B4F8A; /* bleu “marque” */
  border-radius: 14px;
  padding: 10px 14px;
  margin-top: 18px;
}

/* Sous-catégorie */
.subsection > .subsection-header{
  background: #FFFFFF;
  border: 1px solid #E6EEF8;
  border-left: 6px solid #9BB7D6; /* bleu-gris plus doux */
  border-radius: 12px;
  padding: 8px 12px;
  margin-top: 12px;
  margin-left: 14px;            /* léger retrait visuel */
}

/* Alignement du chevron + titres */
.section .toggle-header h2,
.subsection .toggle-header h3{
  margin: 0;
}

.section .toggle-header .chevron{
  color: #0B4F8A;
}

.subsection .toggle-header .chevron{
  color: #5A6B82;
}

/* bouton toggle (cat & sous-cat) */
.toggle-btn{
  background:transparent;
  border:0;
  padding:0;
  margin:0;
  display:flex;
  align-items:center;
  gap:10px;
  font: inherit;
  cursor:pointer;
}

.toggle-title{ font-weight:800; }

.section .toggle-btn .chevron{ color:#0B4F8A; }
.subsection .toggle-btn .chevron{ color:#5A6B82; }

/* rotation chevron quand fermé */
.section.is-collapsed .section-header .chevron,
.subsection.is-collapsed .subsection-header .chevron{
  transform: rotate(-90deg);
  display:inline-block;
}
/* =========================================================
   COVER V7 – image seule + page Sommaire dédiée
   (ne touche pas au reste du thème)
   ========================================================= */

.cover-only{ background:#0B4F8A; padding:16px 0; }
.cover-wrap-only{
  width:min(980px,96vw);
  aspect-ratio:1/1.4142;
  margin:0 auto;
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 14px 40px rgba(0,0,0,.35);
}
.cover-only .cover-img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
  background:#0B4F8A;
}

/* Page sommaire (sous la cover) */
.toc-page{ background:#ffffff; padding:18px 0; }
.toc-wrap{
  width:min(980px,96vw);
  margin:0 auto;
  border-radius:14px;
  background:rgba(245,246,248,.92);
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 10px 24px rgba(0,0,0,.10);
}
.toc-page-inner{ padding:18px; }
.toc-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:10px;
  margin-top:12px;
}

/* On évite que les toc-link hérités prennent 100% de hauteur */
.toc-grid .toc-link{ margin:0; }

/* ============================
   SOMMAIRE : page compacte (supprime le grand vide)
   ============================ */

/* La section sommaire ne doit pas forcer une hauteur de cover */
.toc-page{
  padding: 12px 0 !important;
}

/* Le wrapper du sommaire : hauteur auto, pas d'aspect-ratio, pas de 100vh */
.toc-page .toc-wrap,
.toc-page .cover-wrap{
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
}

/* Un peu plus compact visuellement */
.toc-page .toc-page-inner{
  padding: 14px !important;
}

/* Grille plus serrée (optionnel) */
.toc-page .toc-grid{
  gap: 8px !important;
}

/* Si tu veux aussi réduire les boutons du sommaire */
.toc-page .toc-link{
  padding: 8px 10px !important;
  font-size: 13px !important;
}

/* ============================
   Offset scroll pour éviter le chevauchement avec la search sticky
   ============================ */

/* Hauteur de la barre de recherche (à ajuster si tu changes le design) */
:root{
  --search-offset: 64px;
}

/* Quand on navigue par ancre (#categorie / #souscat) */
.section,
.subsection{
  scroll-margin-top: var(--search-offset);
}


/* =========================================================
   PATCH HIGHLIGHT (simple et non-confusant)
   Objectif :
   - PAS de highlight auto au scroll
   - PAS de highlight "par défaut" (focus / :target)
   - Highlight UNIQUEMENT quand on clique dans le sommaire
   ========================================================= */

/* 1) Neutraliser tout style potentiel basé sur l'ancre (#hash) */
section.section:target > .section-header,
section.subsection:target > .subsection-header{
  background: inherit !important;
  border-color: inherit !important;
  box-shadow: none !important;
}

/* 2) Neutraliser un éventuel style "focus" qui ressemble à un actif */
.toc-link:focus,
.toc-link:active{
  background: inherit !important;
  border-color: inherit !important;
  box-shadow: none !important;
  outline: none !important;
}

/* 3) Style ACTIF (liste du bas) : uniquement via JS => .is-active */
section.section.is-active > .section-header{
  background:#E0ECF7 !important;
  border-color:#b7d5ee !important;
}
section.section.is-active > .section-header .toggle-title,
section.section.is-active > .section-header h2{
  color:#174669 !important;
}


/* =========================================================
   PATCH: supprimer le "hover highlight" des catégories
   Problème: quand tu scrolles, l'élément qui passe sous la souris
   prend l'état :hover -> impression de surbrillance "aléatoire".
   Objectif: garder UNIQUEMENT .is-active (clic sommaire).
   ========================================================= */

.section > .section-header:hover,
.subsection > .subsection-header:hover{
  background: inherit !important;
  border-color: inherit !important;
  box-shadow: none !important;
}

/* (Optionnel) si tu veux aussi neutraliser le hover sur le bouton */
.section .toggle-btn:hover,
.subsection .toggle-btn:hover{
  background: transparent !important;
}


/* ===== Scroll guard : neutraliser tout effet visuel quand la page scrolle ===== */
body.is-scrolling .section > .section-header:hover,
body.is-scrolling .subsection > .subsection-header:hover,
body.is-scrolling .toc-link:hover{
  background: inherit !important;
  border-color: inherit !important;
  box-shadow: none !important;
}


/* =========================================================
   FIX FINAL: supprimer "bleu aléatoire" (souvent :focus-within / styles theme)
   On verrouille le fond des headers quand la section n'est PAS .is-active
   ========================================================= */

/* Fond par défaut verrouillé (évite toute variation hover/focus/scroll) */
section.section:not(.is-active) > .section-header{
  background: #F4F7FB !important;
  border-color: #D6E2F0 !important;
}
section.subsection > .subsection-header{
  background: #FFFFFF !important;
  border-color: #E6EEF8 !important;
}

/* Neutraliser focus-within qui peut peindre en bleu dans certains thèmes */
section.section:not(.is-active) > .section-header:focus-within,
section.subsection > .subsection-header:focus-within{
  background: inherit !important;
  box-shadow: none !important;
}

/* Le bouton toggle ne doit PAS changer le fond au focus */
.section-header .toggle-btn:focus,
.section-header .toggle-btn:focus-visible,
.subsection-header .toggle-btn:focus,
.subsection-header .toggle-btn:focus-visible{
  background: transparent !important;
}

/* Si ton thème colore aussi via :active */
.section-header:active,
.subsection-header:active{
  background: inherit !important;
}
/* =========================================================
   SAFETY (anti surbrillance "fantôme")
   - On veut que la surbrillance bleue apparaisse UNIQUEMENT
     quand JS met .is-active suite à un clic Sommaire.
   - Donc on neutralise les styles focus/active du thème sur les headers.
   ========================================================= */

/* Pas d'outline/cadre noir sur les boutons/titres (le thème peut en ajouter) */
.section-header *, .subsection-header *{
  outline: none !important;
}
.section-header :focus, .section-header :focus-visible,
.subsection-header :focus, .subsection-header :focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* Empêcher un focus-within de repeindre le header */
section.section:not(.is-active) > .section-header:focus-within{
  background: #F4F7FB !important;
  border-color: #D6E2F0 !important;
  box-shadow: none !important;
}

/* Si le thème a un style sur :active (clic maintenu), on le neutralise */
section.section > .section-header:active{
  background: #F4F7FB !important;
  border-color: #D6E2F0 !important;
  box-shadow: none !important;
}
/* =========================================================
   PATCH FINAL (anti surbrillance parasite)
   Objectif: aucune surbrillance au scroll / focus / hash.
   Seule .is-active (clic sommaire) doit changer le header.
   ========================================================= */

/* Neutraliser :target (ancre) */
section.section:target > .section-header,
section.subsection:target > .subsection-header{
  background: inherit !important;
  border-color: inherit !important;
  box-shadow: none !important;
}

/* Neutraliser focus/hover/active sur les headers (hors is-active) */
section.section:not(.is-active) > .section-header:hover,
section.section:not(.is-active) > .section-header:focus,
section.section:not(.is-active) > .section-header:focus-within,
section.section:not(.is-active) > .section-header:active{
  background: #F4F7FB !important;
  border-color: #D6E2F0 !important;
  box-shadow: none !important;
  outline: none !important;
}

section.subsection > .subsection-header:hover,
section.subsection > .subsection-header:focus,
section.subsection > .subsection-header:focus-within,
section.subsection > .subsection-header:active{
  background: #FFFFFF !important;
  border-color: #E6EEF8 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Enlever les focus rings qui apparaissent "au hasard" */
.section-header *, .subsection-header *{
  outline: none !important;
  box-shadow: none !important;
}

/* =========================================
   Subsection highlight (temp + actif)
   ========================================= */

/* état actif (quand on arrive sur une sous-catégorie) */
.subsection.is-active-sub > .subsection-header{
  background: #EEF5FF !important;
  border-color: #C6DCF5 !important;
}

/* flash court (repérage visuel) */
.subsection.flash-sub > .subsection-header{
  box-shadow: 0 0 0 3px rgba(30, 102, 170, 0.18) inset !important;
}

/* ============================
   UX: zone de clic large sur les headers
   ============================ */

/* La ligne header reste en flex, le bouton prend toute la largeur dispo */
.section > .section-header,
.subsection > .subsection-header{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Le bouton devient une "bande" cliquable */
.section .toggle-btn,
.subsection .toggle-btn{
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  /* ✅ zone de clic confortable */
  padding: 10px 14px;
  border-radius: 12px;
}

/* Sous-catégorie : souvent un peu plus compact */
.subsection .toggle-btn{
  padding: 8px 12px;
}

/* Le lien Retour sommaire reste à droite, non affecté */
.section .section-header .back{
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 10px;
}

/* (optionnel) un léger feedback au survol, sans "surbrillance bleue" */
.section .toggle-btn:hover,
.subsection .toggle-btn:hover{
  background: rgba(0,0,0,0.03);
}

.section,
.subsection{
  scroll-margin-top: calc(var(--search-offset) + 12px);
}

/* =========================================================
   ===== PACK UX FINAL (AJOUTS SÛRS) =====
   - 100% CSS : aucun risque JS
   ========================================================= */

/* 1) Chevron : feedback plus clair quand ouvert/fermé */
.toggle-btn .chevron{
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.72;
}
.section:not(.is-collapsed) .toggle-btn .chevron,
.subsection:not(.is-collapsed) .toggle-btn .chevron{
  opacity: 1;
}

/* 2) Focus clavier propre (pro/SDIS), sans “bleu parasite” */
.toggle-btn:focus-visible,
.section-header .back:focus-visible,
.toc-link:focus-visible{
  outline: 2px solid #9BB7D6;
  outline-offset: 2px;
  box-shadow: none !important;
}

/* 3) Catégorie ouverte : séparation très légère (sobriété) */
.section:not(.is-collapsed) > .section-header{
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.05) !important;
}

/* 4) Carte sélectionnée : on voit immédiatement ce qui est pris */
article.card:has(.select-cb:checked){
  border-color: #0B4F8A !important;
  box-shadow: 0 0 0 2px rgba(11,79,138,0.12) !important;
}

/* 5) Bouton "Commander" désactivé (si tu actives la classe .disabled en JS) */
#orderbtn.disabled{
  opacity: 0.55;
  pointer-events: none;
}

/* 6) Message “aucun résultat” (si tu ajoutes le div en HTML/JS) */
.no-result{
  padding: 20px;
  text-align: center;
  color: #5A6B82;
  font-style: italic;
}

.orderbar-total{
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: var(--blue2);
}

/* Bouton ajout panier */
.add-to-cart-btn.is-added { transform: scale(0.98); opacity: 0.9; }

/* Modal panier */
.cartmodal.is-hidden{ display:none; }
.cartmodal{ position:fixed; inset:0; z-index:9999; }
.cartmodal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
.cartmodal-panel{
  position:relative;
  width:min(980px, calc(100vw - 24px));
  max-height:calc(100vh - 24px);
  margin:12px auto;
  background:#fff;
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 24px 70px rgba(0,0,0,.25);
  display:flex;
  flex-direction:column;
}
.cartmodal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--border);
}
.cartmodal-title{ font-weight:800; }
.cartmodal-body{ padding:12px 16px; overflow:auto; }
.cartmodal-actions{
  display:flex; gap:10px; justify-content:flex-end;
  padding:12px 16px; border-top:1px solid var(--border);
}
.cartmodal-table{ width:100%; border-collapse:collapse; font-size:13px; }
.cartmodal-table th,.cartmodal-table td{ border-bottom:1px solid var(--border); padding:10px 8px; }
.ta-r{ text-align:right; }
.cartmodal-footerline{ display:flex; justify-content:flex-end; padding-top:10px; }
.cartmodal-total{ font-weight:900; color:var(--blue2); }
.cartmodal-empty{ padding:18px 0; font-weight:700; }
.cartmodal-tablewrap.is-hidden{ display:none; }

.add-to-cart-btn.is-added { transform: scale(0.98); opacity: 0.9; }

.cartmodal.is-hidden{ display:none; }
.cartmodal{ position:fixed; inset:0; z-index:9999; }
.cartmodal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
.cartmodal-panel{
  position:relative;
  width:min(980px, calc(100vw - 24px));
  max-height:calc(100vh - 24px);
  margin:12px auto;
  background:#fff;
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 24px 70px rgba(0,0,0,.25);
  display:flex;
  flex-direction:column;
}
.cartmodal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--border);
}
.cartmodal-title{ font-weight:800; }
.cartmodal-body{ padding:12px 16px; overflow:auto; }
.cartmodal-actions{
  display:flex; gap:10px; justify-content:flex-end;
  padding:12px 16px; border-top:1px solid var(--border);
}
.cartmodal-table{ width:100%; border-collapse:collapse; font-size:13px; }
.cartmodal-table th,.cartmodal-table td{ border-bottom:1px solid var(--border); padding:10px 8px; }
.ta-r{ text-align:right; }
.cartmodal-footerline{ display:flex; justify-content:flex-end; padding-top:10px; }
.cartmodal-total{ font-weight:900; color:var(--blue2); }
.cartmodal-empty{ padding:18px 0; font-weight:700; }
.cartmodal-tablewrap.is-hidden{ display:none; }

/* Cache réellement le message "Aucun article..." quand is-hidden est présent */
.cartmodal-empty.is-hidden { display: none !important; }

/* =========================================================
   TEXTE EN MAJUSCULES – SOMMAIRE + TITRES ENCADRÉS
   (safe, sans impact sur le reste)
   ========================================================= */

/* Sommaire (pastilles blanches) */
.toc-link{
  text-transform: uppercase;
  letter-spacing: 0.02em; /* meilleure lisibilité */
}

/* Titres de catégories */
.section-header .toggle-title,
.section-header h2{
  text-transform: uppercase;
}

/* Titres de sous-catégories */
.subsection-header .toggle-title,
.subsection-header h3{
  text-transform: uppercase;
}

.actions a[href*="soazig.eu"]{
  display: none !important;
}

/* ============================
   PASTILLES / FILTRES EN MAJUSCULES
   ============================ */

/* Sous-navigation (chips catégories) */
.subnav-link{
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Tags sur les cards (ex: INOX) */
.tag{
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* (optionnel) si d'autres chips existent */
.chip,
.pill,
.filter-chip{
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
