/* ==========================================================================
   css/style.css — Apparence de la mini-boutique (mobile d'abord)
   ========================================================================== */

:root {
  --vert: #1f5a41;
  --vert-fonce: #17452f;
  --vert-clair: #e6f3ea;
  --creme: #fbf7ee;
  --encre: #22281f;
  --gris: #4d5549;
  --bord: #b9c4b0;
  --rouge: #a3231a;
  --or: #b36b00;
}

* { box-sizing: border-box; }

/* Cache les éléments x-cloak tant qu'Alpine n'a pas démarré */
[x-cloak] { display: none !important; }

body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif; background: var(--creme); color: var(--encre); line-height: 1.5; }

/* Icônes SVG en ligne : elles prennent la couleur du texte */
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.grande { width: 64px; height: 64px; stroke-width: 1.5; color: var(--vert); }

/* ---- En-tête ---- */
.entete {
  background: linear-gradient(rgba(23,69,47,.86), rgba(23,69,47,.86)), url("../medias/antalaha-ravenala-paysage.svg") center / cover;
  color: #fff;
}
.entete-contenu { max-width: 1100px; margin: 0 auto; padding: 20px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.entete h1 { margin: 0; font-size: 1.5rem; }
.entete p { margin: 4px 0 0; }

.btn-panier { position: relative; background: #fff; color: var(--vert); border: 0; border-radius: 50%; width: 52px; height: 52px; display: grid; place-items: center; cursor: pointer; flex: none; }
.btn-panier .ic { width: 28px; height: 28px; }
.pastille { position: absolute; top: -4px; right: -4px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--rouge); color: #fff; font-size: .85rem; font-weight: 700; display: grid; place-items: center; }

.avertissement { margin: 0; padding: 10px 16px; background: #fff3cd; color: #5c4400; border-bottom: 2px solid var(--or); font-weight: 600; }

/* ---- Contenu ---- */
.contenu { max-width: 1100px; margin: 0 auto; padding: 16px; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, button { font: inherit; }
input[type="search"], select { width: 100%; padding: 10px; border: 2px solid var(--bord); border-radius: 8px; background: #fff; color: var(--encre); }
/* Focus visible (clavier) : ne jamais le retirer */
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }

.outils { display: grid; gap: 12px; margin-bottom: 8px; }
.rangee { display: flex; gap: 8px; }
.rangee input { flex: 1; min-width: 0; }

.filtres { display: flex; flex-wrap: wrap; gap: 8px; }
.filtre { padding: 8px 14px; border-radius: 999px; border: 2px solid var(--vert); background: #fff; color: var(--vert); font-weight: 600; cursor: pointer; }
.filtre.actif { background: var(--vert); color: #fff; }

button.principal, button.secondaire { padding: 10px 14px; border-radius: 8px; border: 2px solid var(--vert); font-weight: 600; cursor: pointer; }
button.principal { background: var(--vert); color: #fff; width: 100%; }
button.principal:hover:not(:disabled) { background: var(--vert-fonce); }
button.principal:disabled { background: #6d7a70; border-color: #6d7a70; cursor: not-allowed; }
button.secondaire { background: #fff; color: var(--vert); }
button.secondaire:hover { background: var(--vert-clair); }
button.lien { background: none; border: 0; padding: 4px; color: var(--vert); text-decoration: underline; cursor: pointer; }

.compteur { color: var(--gris); margin: 8px 0; }
.vide { background: #fff; border: 2px dashed var(--bord); border-radius: 12px; padding: 16px; text-align: center; }

/* ---- Grille de produits : 1 colonne sur mobile, plus en grand ---- */
.grille { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
.carte-produit { background: #fff; border: 1px solid var(--bord); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.vignette { position: relative; height: 120px; display: grid; place-items: center; }
.etiquette { position: absolute; top: 8px; left: 8px; background: var(--rouge); color: #fff; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.corps { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.corps h2 { margin: 0; font-size: 1.05rem; }
.note { margin: 0; color: #8a5a00; letter-spacing: 2px; }
.description { margin: 0; color: var(--gris); font-size: .92rem; flex: 1; }
.prix { margin: 4px 0; }
.prix strong { font-size: 1.15rem; color: var(--vert); }
.deja { margin: 0; text-align: center; font-size: .9rem; color: var(--vert); font-weight: 600; }

/* ---- Message temporaire ---- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--encre); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; text-align: center; }

/* ---- Tiroir du panier ---- */
.fond { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
.panier { position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 420px); background: #fff; z-index: 50; display: flex; flex-direction: column; box-shadow: -4px 0 20px rgba(0,0,0,.3); }
.panier-tete { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--bord); }
.panier-tete h2 { margin: 0; font-size: 1.2rem; }
.icone-btn { background: none; border: 0; padding: 8px; cursor: pointer; color: var(--encre); }
.merci { padding: 24px 16px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.panier-corps { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lignes { list-style: none; margin: 0; padding: 0 16px; overflow-y: auto; flex: 1; }
.ligne { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid #e4e9df; }
.ligne-info { display: flex; flex-direction: column; grid-column: 1 / -1; }
.ligne-info small { color: var(--gris); }
.quantite { display: flex; align-items: center; gap: 10px; }
.rond { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--vert); background: #fff; color: var(--vert); font-size: 1.2rem; font-weight: 700; cursor: pointer; line-height: 1; }
.rond:disabled { opacity: .4; cursor: not-allowed; }
.ligne-prix { display: flex; flex-direction: column; align-items: flex-end; }
.pied { padding: 16px; border-top: 1px solid var(--bord); display: grid; gap: 8px; justify-items: center; }
.total { margin: 0; width: 100%; display: flex; justify-content: space-between; font-size: 1.2rem; }

/* ---- Transitions du tiroir (classes citées dans index.html) ---- */
.glisse-entree { transition: transform .25s ease-out; }
.glisse-hors { transform: translateX(100%); }
.glisse-dans { transform: translateX(0); }

@media (min-width: 640px) {
  .grille { grid-template-columns: repeat(2, 1fr); }
  .outils { grid-template-columns: 2fr 1fr; align-items: end; }
  .filtres { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .grille { grid-template-columns: repeat(3, 1fr); }
}
/* Respecte les personnes qui demandent moins d'animations */
@media (prefers-reduced-motion: reduce) {
  .glisse-entree { transition: none; }
}
