/* ═══════════════════════════════════════════════════════════
   MODULE « COMMANDER EN LIGNE » — commande.css
   Styles de la section commande, du panier et du formulaire.
   Couleurs et polices : tokens du bloc :root de styles.css.
   ═══════════════════════════════════════════════════════════ */

/* ─── Section ─── */
.order { position: relative; background: var(--bg); }
.order-head { text-align: center; max-width: 680px; margin: 0 auto 40px; padding: 0 var(--gutter); }
.order-head .mono { font: 600 12px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--accent-deep); }
.order-title { font: 500 clamp(30px, 4vw, 46px)/1.12 var(--serif); letter-spacing: -.01em; margin: 14px 0 12px; }
.order-sub { color: var(--muted); }

/* bandeau d'infos : une ligne d'icônes fines (retrait / livraison / paiement / horaires) */
.order-infos {
  list-style: none; display: flex; gap: 28px;
  margin: 0 auto 30px; padding: 16px 0; max-width: calc(var(--wrap) - 2 * var(--gutter)); width: calc(100% - 2 * var(--gutter));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.order-info { flex: 1 1 0; display: flex; align-items: center; gap: 10px; min-width: 0; }
.order-info svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.oi-text { display: flex; flex-direction: column; line-height: 1.3; }
.oi-text b { font-size: 11px; font-weight: 600; letter-spacing: .16em; color: var(--accent-deep); }
.oi-long { font-size: 14px; }
.oi-short { display: none; font-size: 13px; white-space: nowrap; }

/* filtres par catégorie */
.order-filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 auto 32px; padding: 0 var(--gutter); }
.chip {
  font: 500 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  background: var(--white); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 13px 18px; cursor: pointer; transition: background .25s, border-color .25s, color .25s;
}
.chip:hover { border-color: var(--primary); }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--white); }

/* grille des plats */
.order-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
}
.dish { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .3s, transform .3s; }
.dish:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.dish[hidden] { display: none; }
.dish.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.dish-img { aspect-ratio: 4 / 3; overflow: hidden; }
.dish-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.dish:hover .dish-img img { transform: scale(1.05); }
.dish-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.dish-name { font: 500 19px/1.25 var(--serif); }
.dish-cat { color: var(--muted); font-size: 13.5px; }
.dish-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; }
.dish-price { font-size: 17px; font-weight: 600; color: var(--accent-deep); }

/* bouton + / stepper */
.add {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 0; background: var(--primary); color: var(--white);
  font: 400 22px/1 var(--sans); cursor: pointer; transition: transform .2s var(--ease-out), background .2s;
}
.add:hover { transform: scale(1.08); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--text); font: 400 19px/1 var(--sans);
}
.stepper button:hover { background: var(--white); }
.stepper b { min-width: 22px; text-align: center; font-weight: 600; font-size: 16px; }

/* ─── Barre panier flottante ─── */
.cartbar {
  position: fixed; left: 50%; bottom: 18px; z-index: 120;
  transform: translate(-50%, 160%);
  display: flex; align-items: center; gap: 14px;
  background: var(--primary); color: var(--white);
  border: 0; border-radius: 999px; padding: 8px 8px 8px 22px;
  cursor: pointer; font: inherit;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  transition: transform .6s var(--ease-out);
}
.cartbar.is-on { transform: translate(-50%, 0); }
.cartbar .mono { white-space: nowrap; }
.cartbar-go { background: var(--accent); color: var(--text); border-radius: 999px; padding: 11px 18px; font-weight: 600; }
.cartbar .mono { font-weight: 500; }

/* ─── Panneau de commande ─── */
.checkout { position: fixed; inset: 0; z-index: 200; visibility: hidden; }
.checkout.is-open { visibility: visible; }
.checkout-veil { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .4s; }
.checkout.is-open .checkout-veil { opacity: 1; }
.checkout-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(520px, 100%); background: var(--white); color: var(--text);
  transform: translateX(100%); transition: transform .55s var(--ease-out);
  display: flex; flex-direction: column;
}
.checkout.is-open .checkout-panel { transform: translateX(0); }
.checkout-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.checkout-top h3 { font: 500 26px/1.2 var(--serif); }
.x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; font: 400 18px/1 var(--sans); color: var(--text); }
.checkout .mono.ash { color: var(--accent-deep); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.checkout-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 24px; -webkit-overflow-scrolling: touch; }

.co-block { padding: 20px 0; border-bottom: 1px solid var(--line); }
.co-block:last-child { border-bottom: 0; }
.co-label { display: block; color: var(--accent-deep); margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }

.line { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.line img { width: 54px; height: 54px; object-fit: cover; border-radius: 3px; }
.line-name { flex: 1; font-size: 16px; line-height: 1.25; }
.line-name small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.line .stepper { background: var(--bg); }
.co-sub { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); margin-top: 8px; }
.co-sub small { font-size: 12px; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 20px; }
.co-total b { font-weight: 500; }
.co-note { color: var(--muted); font-size: 14px; margin-top: 6px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid transparent; border-radius: 4px;
  padding: 13px 14px; outline: none; transition: border-color .2s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field.is-bad select, .field.is-bad input, .field.is-bad textarea { border-color: #c0392b; }
.err { color: #c0392b; font-size: 13px; margin-top: 5px; display: none; }
.field.is-bad .err, .opts.is-bad + .err { display: block; }

/* choix segmentés (mode, paiement, heure) */
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
  display: block; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; padding: 13px 10px;
  font-size: 15px; transition: border-color .2s, background .2s;
}
.opt span small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.opt input:checked + span { border-color: var(--primary); background: var(--bg); box-shadow: inset 0 0 0 1px var(--primary); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.opts.is-bad .opt span { border-color: #c0392b; }

.sub-fields { margin-top: 14px; }
.sub-fields[hidden] { display: none; }

.closed-note { background: var(--bg); border-left: 3px solid var(--accent); padding: 12px 14px; font-size: 14px; margin-top: 16px; }
.closed-note[hidden] { display: none; }

.checkout-foot { padding: 16px 24px 22px; border-top: 1px solid var(--line); background: var(--white); }
.send {
  width: 100%; border: 0; cursor: pointer; border-radius: 999px;
  background: #1fa855; color: #fff; font: 500 16px/1 var(--sans); padding: 17px 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.send:hover { filter: brightness(.95); }
.send svg { width: 20px; height: 20px; }
.send-hint { text-align: center; color: var(--muted); margin-top: 10px; font-size: 13px; }

.done { text-align: center; padding: 8vh 8px; }
.done h4 { font: 500 26px/1.2 var(--serif); margin: 14px 0 10px; }
.done p { color: var(--muted); font-size: 16px; }
.done .ref { color: var(--text); font-weight: 600; }
.done-actions { display: grid; gap: 10px; margin-top: 26px; }
.ghost { font: inherit; font-size: 15px; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 14px; cursor: pointer; color: var(--text); }

html.co-lock, html.co-lock body { overflow: hidden; }

/* ─── Responsive ─── */
@media (max-width: 1080px) { .order-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  /* mobile : une seule ligne compacte qui défile de côté */
  .order-infos { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; gap: 22px; padding: 10px 0; margin-bottom: 18px; }
  .order-infos::-webkit-scrollbar { display: none; }
  .order-info { flex: none; gap: 8px; }
  .order-info svg { width: 18px; height: 18px; }
  .oi-long { display: none; }
  .oi-short { display: block; }
  .order-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .order-grid { gap: 12px; }
  .order-filters { gap: 8px; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
  .order-filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .chip { padding: 10px 14px; font-size: 13px; }
  .dish-body { padding: 12px 12px 14px; }
  .dish-name { font-size: 16px; }
  .dish-price { font-size: 15px; }
  .add { width: 36px; height: 36px; }
  .stepper button { width: 28px; height: 28px; }
  .dish-foot { flex-wrap: wrap; gap: 8px; }
  .cartbar { width: calc(100% - 20px); justify-content: space-between; bottom: 10px; }
  .checkout-top, .checkout-foot { padding-left: 18px; padding-right: 18px; }
  .checkout-scroll { padding: 4px 18px 20px; }
}

.order button, .checkout button, .opt span, .cartbar { -webkit-tap-highlight-color: transparent; }

.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-color: var(--bg);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
