/* ==========================================================================
   COMPOSANTS — boutons, étiquettes, puces, filtres, tableaux, cartes produit
   ========================================================================== */

/* ------------------------------------------------------------------ boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2);
  min-height: 48px; padding: 0 var(--e-5);
  border: var(--trait-2) solid var(--bouton-fond); border-radius: var(--rayon-1);
  background: var(--bouton-fond); color: var(--bouton-texte);
  font-size: var(--t-1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--duree-2) var(--courbe), color var(--duree-2) var(--courbe), border-color var(--duree-2) var(--courbe);
}
.bouton:hover { background: var(--bouton-fond-survol); border-color: var(--bouton-fond-survol); color: var(--bouton-texte-survol); }
.bouton .icone { width: 18px; height: 18px; stroke-width: 2; }
.bouton--contour { background: transparent; border-color: var(--md-encre); color: var(--md-encre); }
.bouton--contour:hover { background: var(--md-encre); border-color: var(--md-encre); color: var(--md-papier); }
.bouton--large { flex: 1; }

.lien-bouton {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--md-encre); font-weight: 700;
  text-decoration: underline; text-decoration-color: var(--marque); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.lien-bouton:hover { text-decoration-color: var(--md-encre); }

/* -------------------------------------------------------------- étiquettes */
.etiquette {
  display: inline-flex; align-items: center; height: 24px; padding: 0 var(--e-2);
  border-radius: var(--rayon-1);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  white-space: nowrap;
}
.etiquette[data-type="original"] { background: var(--marque); color: var(--sur-marque); }
.etiquette[data-type="adaptable"] { background: var(--md-papier); color: var(--md-encre-2); box-shadow: inset 0 0 0 1px var(--md-trait-2); }

/* -------------------------------------------------- puces : valeurs courtes */
.puces { display: flex; flex-wrap: wrap; gap: var(--e-2); list-style: none; }
.puce {
  display: inline-flex; align-items: center; min-height: 34px; padding: var(--e-1) var(--e-3);
  border-radius: var(--rayon-1); background: var(--md-papier);
  box-shadow: inset 0 0 0 1px var(--md-trait-2);
  font-size: var(--t-1); font-weight: 600;
}
.puces--mono .puce { font-family: var(--f-mono); letter-spacing: .02em; }

/* ---------------------------------------------------- jetons de filtre */
.jetons { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.jeton {
  display: inline-flex; align-items: center; gap: var(--e-2); height: 36px; padding: 0 var(--e-4);
  border: var(--trait-1) solid var(--md-trait-2); border-radius: var(--rayon-pilule);
  background: var(--md-papier); color: var(--md-encre-2); cursor: pointer;
  font-size: var(--t-1); font-weight: 600;
  transition: border-color var(--duree-1) var(--courbe), color var(--duree-1) var(--courbe), background-color var(--duree-1) var(--courbe);
}
.jeton:hover { border-color: var(--md-encre); color: var(--md-encre); }
.jeton[aria-pressed="true"] { background: var(--nuit); border-color: var(--nuit); color: var(--md-papier); }
.jeton__n { font-family: var(--f-mono); font-size: var(--t-0); color: var(--md-encre-3); }
.jeton[aria-pressed="true"] .jeton__n { color: var(--accent-sur-nuit); }

/* ---------------------------------------------------- champ de filtrage */
.filtre { position: relative; display: flex; align-items: center; width: min(340px, 100%); }
.filtre .icone { position: absolute; left: var(--e-3); color: var(--md-encre-3); pointer-events: none; }
/* .site … : l'habillage générique des champs (habillage.css, .site :is(input[type=search]…))
   écraserait le retrait réservé à la loupe */
.site .filtre input[type], .filtre input {
  width: 100%; height: 44px; min-height: 0; padding: 0 var(--e-3) 0 2.6rem;
  border: var(--trait-1) solid var(--md-trait-2); border-radius: var(--rayon-2); background: var(--md-papier);
}
.site .filtre input[type]:focus, .filtre input:focus { outline: none; border-color: var(--md-encre); box-shadow: 0 0 0 3px var(--marque-trait); }

/* ---------------------------------------------------------------- tableaux */
/* position: relative : les textes « visuellement cachés » (absolus) restent dans le cadre défilant
   au lieu d'élargir la page sur mobile */
.tableau-cadre { position: relative; overflow-x: auto; border: var(--trait-1) solid var(--md-trait); border-radius: var(--rayon-2); }
.tableau { width: 100%; border-collapse: collapse; background: var(--md-papier); font-size: var(--t-1); }
.tableau th {
  padding: var(--e-3) var(--e-4); background: var(--md-papier-2);
  border-bottom: var(--trait-1) solid var(--md-trait); text-align: left; white-space: nowrap;
  font-family: var(--f-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--md-encre-3);
}
.tableau td { padding: var(--e-3) var(--e-4); border-bottom: var(--trait-1) solid var(--md-trait); vertical-align: middle; }
.tableau tbody tr:hover td { background: var(--marque-voile); }
.tableau__marque { font-weight: 700; white-space: nowrap; }
.tableau__num { font-family: var(--f-mono); font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.tableau__action { width: 1%; text-align: right; }
.tableau__pied {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-3);
  margin: var(--e-4) 0 0; font-size: var(--t-1); color: var(--md-encre-3);
}

/* ------------------------------------------------------- bouton « copier » */
.copier {
  display: inline-flex; align-items: center; gap: var(--e-1); height: 30px; padding: 0 var(--e-2);
  border: var(--trait-1) solid var(--md-trait-2); border-radius: var(--rayon-1);
  background: var(--md-papier); color: var(--md-encre-2); cursor: pointer;
  font-family: var(--f-texte); font-size: var(--t-0); font-weight: 600; letter-spacing: 0;
}
.copier:hover { border-color: var(--md-encre); color: var(--md-encre); }
.copier .icone { width: 14px; height: 14px; }
.copier[data-copie="oui"] { border-color: var(--etat-ok); color: var(--etat-ok); }
/* dans les tableaux, le bouton n'apparaît qu'au survol de la ligne */
.tableau .copier { opacity: 0; transition: opacity var(--duree-1) var(--courbe); }
.tableau tr:hover .copier, .tableau .copier:focus-visible, .tableau .copier[data-copie="oui"] { opacity: 1; }
@media (hover: none) { .tableau .copier { opacity: 1; } }

/* ------------------------------------------------------------ carte produit */
.carte-produit {
  position: relative; display: flex; flex-direction: column;
  /* bord et ombre marqués : la carte se détache du fond pâle des grilles */
  background: var(--md-papier); border: var(--trait-1) solid var(--md-trait-2); border-radius: var(--rayon-2);
  box-shadow: var(--ombre-1);
  overflow: hidden;
  transition: box-shadow var(--duree-2) var(--courbe), border-color var(--duree-2) var(--courbe);
}
.carte-produit:hover { border-color: var(--md-encre-3); box-shadow: var(--ombre-2); }
.carte-produit__visuel {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: var(--e-5);
  border-bottom: var(--trait-1) solid var(--md-trait); background: var(--md-papier);
}
.carte-produit__visuel img { max-height: 100%; width: auto; object-fit: contain; transition: transform var(--duree-3) var(--courbe); }
.carte-produit:hover .carte-produit__visuel img { transform: scale(1.05); }
.carte-produit__visuel .etiquette { position: absolute; top: var(--e-3); left: var(--e-3); }
.carte-produit__visuel .etiquette--destockage { top: auto; bottom: var(--e-3); }
.carte-produit__corps { display: flex; flex: 1; flex-direction: column; gap: var(--e-1); padding: var(--e-4); }
.carte-produit__ref { margin: 0; font-family: var(--f-mono); font-size: var(--t-2); font-weight: 700; }
.carte-produit__nom { margin: 0; font-family: var(--f-texte); font-size: var(--t-1); font-weight: 600; line-height: 1.35; letter-spacing: 0; color: var(--md-encre-2); }
.carte-produit__nom a { color: inherit; text-decoration: none; }
.carte-produit__nom a::after { content: ""; position: absolute; inset: 0; }   /* toute la carte est cliquable */
.carte-produit__prix { margin: auto 0 0; padding-top: var(--e-3); font-weight: 800; font-variant-numeric: tabular-nums; }
.carte-produit__prix small { font-weight: 400; color: var(--md-encre-3); }
.carte-produit__prix--visiteur { font-size: var(--t-0); font-weight: 600; color: var(--md-encre-3); }

/* ------------------------------------------------------------ fil d'Ariane */
.ariane ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-1) var(--e-3); list-style: none; font-size: var(--t-1); color: var(--md-encre-3); }
.ariane li { display: inline-flex; align-items: center; gap: var(--e-3); }
.ariane li + li::before {
  content: ""; width: 6px; height: 6px; opacity: .7;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg);
}
.ariane a { color: var(--md-encre-2); text-decoration: none; }
.ariane a:hover { color: var(--md-encre); text-decoration: underline; }
.ariane [aria-current] { color: var(--md-encre); font-weight: 600; }

/* ------------------------------------------------------------------ blocs */
.bloc { padding: var(--e-6); background: var(--md-papier); border: var(--trait-1) solid var(--md-trait); border-radius: var(--rayon-2); }
@media (max-width: 640px) { .bloc { padding: var(--e-5) var(--e-4); } }
.bloc__entete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-4); margin-bottom: var(--e-5); }
.bloc__titre { display: flex; align-items: baseline; gap: var(--e-3); margin: 0; font-size: var(--t-4); }
.bloc__compteur { font-family: var(--f-mono); font-size: var(--t-1); font-weight: 700; letter-spacing: 0; color: var(--md-encre-3); }
.bloc .jetons { margin-bottom: var(--e-4); }

/* ---------------------------------------------------------- en-tete de page */
.page-entete { padding-block: var(--e-5) var(--e-6); }
.page-entete .ariane { margin-bottom: var(--e-6); }
.page-entete h1 { margin: 0 0 var(--e-3); }
.page-entete__chapo { max-width: 62ch; margin: 0; color: var(--md-encre-2); font-size: var(--t-3); }

/* ------------------------------------------------- boutons sur fond sombre */
.surface-nuit .bouton--contour { border-color: rgba(255, 255, 255, .55); color: var(--md-papier); }
.surface-nuit .bouton--contour:hover { background: var(--md-papier); border-color: var(--md-papier); color: var(--nuit); }

/* un tableau défile dans son cadre, il n'élargit jamais la page */
.tableau-cadre { max-width: 100%; }
.bloc { min-width: 0; }

/* ------------------------------------------------ badge « Opération déstockage »
   gabarit posé par actions.php, placé à côté du titre de la page par design.js */
.titre-destockage { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-3) var(--e-5); margin-bottom: var(--e-5); }
.page-entete .titre-destockage { margin-bottom: var(--e-3); }
.site .titre-destockage > h1 { margin: 0; }
.destockage {
  --d-fond: var(--marque); --d-texte: #FFFFFF; --d-accent: #CCA817; --d-sur-accent: #161616;
  display: inline-flex; align-items: center; gap: var(--e-3);
  margin: 0; padding: var(--e-2) var(--e-2) var(--e-2) var(--e-4);
  border-radius: var(--rayon-2); background: var(--d-fond); color: var(--d-texte);
  font-family: var(--f-titre); text-decoration: none; box-shadow: var(--ombre-1);
  animation: destockage-entree .6s var(--courbe) both;
}
[data-marque="sidat"] .destockage { --d-fond: #161616; --d-accent: var(--jaune); }
.destockage:hover, .destockage:focus-visible { color: var(--d-texte); text-decoration: none; }
.destockage__icone { display: grid; color: var(--d-accent); }
.destockage__icone svg { width: 30px; height: 30px; fill: currentColor; }
.destockage__texte { display: grid; line-height: 1.05; }
.destockage__surtitre { font-size: var(--t-0); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--d-accent); }
.destockage__titre { font-size: var(--t-4); font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.destockage:not(:has(.destockage__cta)) { padding-right: var(--e-4); }
.destockage__cta {
  padding: var(--e-2) var(--e-4); border-radius: var(--rayon-1);
  background: var(--d-accent); color: var(--d-sur-accent);
  font-size: var(--t-1); font-weight: 800; white-space: nowrap;
  animation: destockage-pouls 1.2s ease-in-out 1s infinite;
  transition: transform var(--duree-2) var(--courbe);
}
.destockage:hover .destockage__cta { animation: none; transform: scale(1.06); }
@keyframes destockage-entree { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes destockage-pouls { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .destockage, .destockage__cta { animation: none; } }
/* petit écran : le badge se resserre au lieu de dépasser à droite (Sidat, 375 px) */
@media (max-width: 480px) {
  .destockage { max-width: 100%; gap: var(--e-2); padding-left: var(--e-3); }
  .destockage__icone svg { width: 24px; height: 24px; }
  .destockage__titre { font-size: var(--t-3); }
  .destockage__cta { padding: var(--e-2) var(--e-3); }
}

/* --------------------------------------------------- bouton de déconnexion
   en-tête de l'espace client (content-page.php) et carte du client connecté (accueil) */
.site a.deconnexion {
  display: inline-flex; align-items: center; gap: var(--e-2);
  padding: var(--e-2) var(--e-4); border: var(--trait-1) solid var(--md-trait-2); border-radius: var(--rayon-1);
  background: var(--md-papier); color: var(--md-encre); font-size: var(--t-1); font-weight: 700; text-decoration: none;
  transition: border-color var(--duree-2) var(--courbe), background-color var(--duree-2) var(--courbe);
}
.site a.deconnexion:hover { border-color: var(--md-encre); background: var(--md-papier-2); color: var(--md-encre); text-decoration: none; }
.site a.deconnexion .icone { width: 18px; height: 18px; }

/* étiquette « Nouvelle procédure » (documents de la gestion des retours) */
.etiquette--nouveau { margin-left: var(--e-2); background: #FDECEC; color: #B42318; vertical-align: middle; }

/* étiquette « Déstockage » : bas de la photo des cartes, sous le type sur la fiche.
   Doré et blanc chez Meat & Doria, jaune et noir chez S.I.D.A.T. ; clignote comme
   le badge de l'ancien thème (badge-pulse). */
.etiquette--destockage { background: #B8900F; color: #FFFFFF; animation: etiquette-clignote 3s infinite; }
[data-marque="sidat"] .etiquette--destockage { background: var(--jaune); color: #161616; box-shadow: inset 0 0 0 2px #161616; }   /* liseré : l'étiquette « Original » est du même jaune */
@keyframes etiquette-clignote { 0%, 10%, 20%, 100% { opacity: 1; } 5%, 15% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .etiquette--destockage { animation: none; } }

/* ----------------------------------------------------- remonter en haut de la page
   (pied.html.twig) : bouton rond fixe, aux couleurs des boutons de la marque */
.haut-de-page {
  position: fixed; z-index: 50; right: var(--e-5); bottom: var(--e-5);
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 50%; background: var(--bouton-fond); color: var(--bouton-texte);
  box-shadow: 0 6px 18px rgba(14, 23, 38, .25); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity var(--duree-2) var(--courbe), transform var(--duree-2) var(--courbe), visibility var(--duree-2), background-color var(--duree-2) var(--courbe);
}
.haut-de-page.est-visible { opacity: 1; visibility: visible; transform: none; }
.haut-de-page:hover { background: var(--bouton-fond-survol); color: var(--bouton-texte-survol); }
.haut-de-page .icone { width: 22px; height: 22px; stroke-width: 2.4; transform: rotate(-90deg); }
@media (max-width: 640px) { .haut-de-page { right: var(--e-4); bottom: var(--e-4); width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) { .haut-de-page { transition: none; } }

/* ajout au panier depuis les cartes (ce-add-to-cart de mdf-api : quantité + bouton,
   envoi au panier). Au-dessus du lien qui rend toute la carte cliquable. Le « + » du
   composant prix n'est qu'une icône : masqué dans les cartes pour ne pas tromper. */
.site .carte-produit .meat-cart-icon { display: none; }
.carte-produit__panier { position: relative; z-index: 1; }
.carte-produit__panier form.cart { display: flex; gap: var(--e-2); margin: var(--e-3) 0 0; }
.site .carte-produit__panier .quantity input.qty { width: 52px; height: 40px; padding: 0 var(--e-1); }
.site .carte-produit__panier .single_add_to_cart_button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2);
  min-width: 0; min-height: 40px; padding: 0 var(--e-2); font-size: 0; white-space: nowrap;
}
/* le libellé du composant (« Ajouter au panier ») ne tient pas dans une carte : icône + « Ajouter » */
.site .carte-produit__panier .single_add_to_cart_button::before {
  content: ""; width: 18px; height: 18px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4h2.2l2.4 11.1a2 2 0 0 0 2 1.6h7.8a2 2 0 0 0 1.9-1.5L20.8 8H5.9'/%3E%3Ccircle cx='10' cy='20.3' r='1.2'/%3E%3Ccircle cx='17' cy='20.3' r='1.2'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4h2.2l2.4 11.1a2 2 0 0 0 2 1.6h7.8a2 2 0 0 0 1.9-1.5L20.8 8H5.9'/%3E%3Ccircle cx='10' cy='20.3' r='1.2'/%3E%3Ccircle cx='17' cy='20.3' r='1.2'/%3E%3C/svg%3E") no-repeat center / contain;
}
.site .carte-produit__panier .single_add_to_cart_button::after { content: "Ajouter"; font-size: var(--t-0); }

/* ------------------------------------------------- visionneuse PDF (PDF.js, en modale)
   ouverte par design.js sur un lien [data-pdf] : « Feuilleter en ligne » du catalogue */
.visionneuse { position: fixed; inset: 0; z-index: 200; display: grid; padding: var(--e-4); background: rgba(14, 23, 38, .78); }
.visionneuse[hidden] { display: none; }
.visionneuse__cadre {
  display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; max-width: 1400px; margin: 0 auto;
  overflow: hidden; border-radius: var(--rayon-2); background: var(--md-papier); box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.visionneuse__barre {
  display: flex; align-items: center; justify-content: space-between; gap: var(--e-3);
  padding: var(--e-2) var(--e-2) var(--e-2) var(--e-5); background: var(--nuit); color: var(--md-papier);
}
.visionneuse__titre { margin: 0; overflow: hidden; font-family: var(--f-titre); font-size: var(--t-2); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; color: var(--md-papier); }
.visionneuse__actions { display: flex; flex: none; gap: var(--e-2); }
.visionneuse__bouton {
  display: inline-flex; align-items: center; gap: var(--e-2); padding: var(--e-2) var(--e-4);
  border: var(--trait-1) solid rgba(255, 255, 255, .4); border-radius: var(--rayon-1);
  background: transparent; color: var(--md-papier); font-size: var(--t-1); font-weight: 700; text-decoration: none; cursor: pointer;
}
.visionneuse__bouton:hover { border-color: var(--md-papier); background: rgba(255, 255, 255, .12); color: var(--md-papier); }
.visionneuse__bouton .icone { width: 18px; height: 18px; }
.visionneuse__page { width: 100%; height: 100%; border: 0; background: #525659; }
@media (max-width: 640px) { .visionneuse { padding: 0; } .visionneuse__cadre { border-radius: 0; } .visionneuse__libelle { display: none; } }
html.visionneuse-ouverte { overflow: hidden; }
