/* =================================================================
   HKThaï — Tunnel de commande (Click & Collect)
   Réutilise les tokens et fonts de /css/styles.css. Layout app-like.
   ================================================================= */

.order-body {
  min-height: 100svh;
  background: var(--cream, #fffaf5);
  color: var(--text, #1f1610);
  font-family: var(--body);
  padding-bottom: 5rem; /* place pour la barre mobile éventuelle */
}

/* --------- HEADER --------- */
.order-header {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem clamp(1rem, 2vw, 1.6rem);
  background: var(--ink, #160e0c);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 8px 24px -16px rgba(0,0,0,0.6);
}
.order-brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: #fff; text-decoration: none; font-family: var(--display);
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
}
.order-brand img { border-radius: 8px; }
.order-pickup {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 1rem; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  font-weight: 500; font-size: 0.92rem; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  justify-self: center;
  max-width: 100%;
}
.order-pickup:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.28); }
.order-pickup svg { width: 1em; height: 1em; opacity: 0.9; }
.order-pickup.is-set { background: linear-gradient(115deg, rgba(239,51,64,0.2), rgba(0,36,125,0.2)); border-color: rgba(239,51,64,0.4); }

.order-cart-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(115deg, #ef3340 0%, #00247d 100%);
  color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(0,36,125,0.5);
  transition: transform 0.2s;
}
.order-cart-btn:hover { transform: translateY(-2px); }
.order-cart-btn svg { width: 1.1em; height: 1.1em; }
.order-cart-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #fff; color: var(--ink, #160e0c);
  border-radius: 10px; font-size: 0.72rem; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.order-cart-count.is-zero { display: none; }

/* --------- NAV CATÉGORIES --------- */
.order-catnav {
  position: sticky; top: 64px; z-index: 40;
  background: var(--cream, #fffaf5);
  border-bottom: 1px solid var(--line, #ead9c5);
}
.order-catnav-scroller {
  display: flex; gap: 0.5rem;
  overflow-x: auto; overflow-y: hidden;
  padding: 0.7rem clamp(1rem, 2vw, 1.6rem);
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.order-catnav-scroller::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-pill);
  background: #fff; color: var(--muted, #75554a);
  border: 1px solid var(--line, #ead9c5);
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; white-space: nowrap;
}
.cat-tab:hover { border-color: #ef3340; color: var(--text, #1f1610); }
.cat-tab.is-active { background: linear-gradient(115deg, #ef3340 0%, #00247d 100%); color: #fff; border-color: transparent; }

/* --------- LAYOUT --------- */
.order-layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 2vw, 1.6rem);
  gap: 1.5rem;
}
@media (min-width: 960px) {
  .order-layout {
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
    gap: 2rem;
  }
}

/* --------- CATALOG --------- */
.order-catalog { min-width: 0; }
.order-loading { padding: 4rem 1rem; text-align: center; color: var(--muted); }

.cat-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 130px;
}
.cat-section-head {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin-bottom: 1rem;
}
.cat-section-head h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem);
  letter-spacing: -0.01em; margin: 0;
}
.cat-section-head .note {
  color: var(--muted); font-size: 0.85rem; font-style: italic;
}

.order-items { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .order-items { grid-template-columns: repeat(2, 1fr); } }

.order-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line, #ead9c5);
  border-radius: var(--radius, 16px);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.order-item:hover { border-color: #ef3340; transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(0,0,0,0.15); }
.order-item.is-disabled { opacity: 0.55; cursor: not-allowed; }
.order-item.is-disabled:hover { transform: none; border-color: var(--line); box-shadow: none; }

.oi-info { min-width: 0; }
.oi-name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; margin: 0 0 0.25rem; }
.oi-desc { color: var(--muted); font-size: 0.85rem; line-height: 1.35; margin: 0; }
.oi-meta { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.oi-badge { display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 4px; }
.oi-badge.lunch { background: rgba(0,36,125,0.1); color: #00247d; }
.oi-badge.popular { background: rgba(239,51,64,0.12); color: #c8102e; }
.oi-badge.choice { background: var(--cream-2, #faeed8); color: var(--muted); }

.oi-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.oi-price { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--text); white-space: nowrap; }
.oi-add {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(115deg, #ef3340 0%, #00247d 100%);
  color: #fff; font-size: 1.4rem; font-weight: 300; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px -4px rgba(0,36,125,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.oi-add:hover { transform: scale(1.08); box-shadow: 0 6px 16px -4px rgba(0,36,125,0.55); }
.oi-add:active { transform: scale(0.95); }

/* --------- CART (panier) --------- */
.order-cart {
  background: #fff;
  border: 1px solid var(--line, #ead9c5);
  border-radius: var(--radius, 16px);
  display: flex; flex-direction: column;
  position: sticky; top: 130px;
  max-height: calc(100svh - 150px);
  overflow: hidden;
}
.order-cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--line);
}
.order-cart-head h2 { font-family: var(--display); font-size: 1.15rem; margin: 0; }
.order-cart-close { display: none; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.order-cart-close:hover { color: #ef3340; }

.order-cart-pickup {
  padding: 0.75rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(115deg, rgba(239,51,64,0.06), rgba(0,36,125,0.06));
  font-size: 0.85rem;
}
.order-cart-pickup:empty { display: none; }
.order-cart-pickup strong { display: block; color: var(--text); margin-top: 0.15rem; }

.order-cart-list { list-style: none; margin: 0; padding: 0.5rem; overflow-y: auto; flex: 1; }
.order-cart-list:empty { display: none; }

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  transition: background 0.2s;
}
.cart-line:hover { background: var(--cream-2, #faeed8); }
.cart-line + .cart-line { border-top: 1px solid var(--line); }
.cl-name { font-weight: 600; font-size: 0.95rem; }
.cl-opts { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.cl-qty {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--cream-2, #faeed8); border-radius: var(--radius-pill);
  padding: 0.15rem;
}
.cl-qty button {
  width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: #fff; cursor: pointer; font-weight: 700; font-size: 0.85rem;
  color: var(--text); display: grid; place-items: center;
}
.cl-qty button:hover { background: #ef3340; color: #fff; }
.cl-qty span { min-width: 1.3em; text-align: center; font-weight: 700; font-size: 0.85rem; }
.cl-price { font-weight: 700; white-space: nowrap; align-self: end; }
.cl-remove { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 0.75rem; text-decoration: underline; padding: 0; margin-top: 0.15rem; }
.cl-remove:hover { color: #ef3340; }

.order-cart-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.order-cart-empty p { margin: 0.3rem 0; }
.order-cart-empty .hint { font-size: 0.85rem; }
.order-cart-empty[hidden] { display: none; }

.order-cart-note {
  padding: 0.85rem 1.2rem;
  border-top: 1px solid var(--line);
  background: var(--cream, #fffaf5);
}
.order-cart-note label {
  display: block;
  cursor: pointer;
  margin-bottom: 0.45rem;
}
.order-cart-note .ocn-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}
.order-cart-note .ocn-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.order-cart-note textarea {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: var(--body);
  font-size: 0.88rem;
  line-height: 1.4;
  background: #fff;
  color: var(--text);
}
.order-cart-note textarea:focus {
  outline: none;
  border-color: #ef3340;
  box-shadow: 0 0 0 3px rgba(239,51,64,0.13);
}

.order-cart-foot {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--line);
  background: var(--cream, #fffaf5);
}
.order-cart-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.85rem;
  font-size: 1.05rem;
}
.order-cart-total strong { font-family: var(--display); font-size: 1.35rem; }
.order-checkout { width: 100%; justify-content: center; }
.order-checkout:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* --------- CART MOBILE (drawer) --------- */
@media (max-width: 959px) {
  .order-cart {
    position: fixed;
    inset: 0;
    z-index: 60;
    max-height: 100svh;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
  }
  .order-cart.is-open { transform: none; }
  .order-cart-close { display: block; }
}

/* --------- MODALES --------- */
.order-modal {
  /* Centrage explicite — ne dépend pas du default UA du <dialog> */
  position: fixed;
  top: 50%; left: 50%;
  right: auto; bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 0; padding: 0;
  border-radius: var(--radius, 16px);
  background: #fff;
  max-width: 540px; width: calc(100vw - 2rem);
  max-height: calc(100svh - 2rem);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.4);
  overflow: hidden;
}
.order-modal::backdrop { background: rgba(15,7,5,0.6); backdrop-filter: blur(4px); }
.modal-form {
  display: flex; flex-direction: column;
  max-height: calc(100svh - 2rem);
  min-height: 0;   /* autorise les régions internes à défiler au lieu de déborder */
}
.modal-close {
  position: absolute; top: 0.75rem; right: 0.85rem;
  background: rgba(0,0,0,0.05); border: 0;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--text);
  display: grid; place-items: center;
  z-index: 2;
}
.modal-close:hover { background: rgba(0,0,0,0.1); }
.order-modal h3 {
  font-family: var(--display); font-size: 1.5rem; line-height: 1.15;
  margin: 0; padding: 1.4rem 3rem 0.4rem 1.5rem;
}
.modal-desc { padding: 0 1.5rem; color: var(--muted); font-size: 0.92rem; margin: 0; }
.modal-options, .modal-step-content, .sm-section {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}
.modal-options { flex: 1; }

.opt-group { margin-bottom: 1.2rem; }
.opt-group:last-child { margin-bottom: 0; }
.opt-group-title {
  font-weight: 700; font-size: 0.92rem;
  margin-bottom: 0.55rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.opt-required { color: #ef3340; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.opt-optional { color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.opt-choices { display: grid; gap: 0.45rem; }

.opt-choice {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--cream, #fffaf5);
  border: 1.5px solid var(--line, #ead9c5);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.opt-choice:hover { border-color: #ef3340; }
.opt-choice input { accent-color: #ef3340; }
.opt-choice .oc-name { flex: 1; font-weight: 500; }
.opt-choice .oc-extra { font-size: 0.85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.opt-choice:has(input:checked) { border-color: #ef3340; background: rgba(239,51,64,0.04); }
.opt-choice:has(input:checked) .oc-extra { color: #ef3340; }

.modal-qty {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.5rem;
  border-top: 1px solid var(--line);
}
.modal-qty-label { font-weight: 600; }
.qty-control {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--cream-2, #faeed8);
  border-radius: var(--radius-pill);
  padding: 0.25rem;
}
.qty-control button {
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: #fff; cursor: pointer; font-weight: 700; font-size: 1.1rem;
  color: var(--text);
}
.qty-control button:hover { background: #ef3340; color: #fff; }
.qty-control span { min-width: 1.5em; text-align: center; font-weight: 700; }

.modal-add, .sm-section + .sm-disclaimer + .btn, #pkConfirm, #smPay {
  margin: 0; border-radius: 0;
  padding: 1.1rem 1.5rem;
  width: 100%; justify-content: center;
  font-size: 1rem;
}

/* Stepper (formules) */
.modal-stepper {
  list-style: none; margin: 0; padding: 0.6rem 1.5rem 0;
  display: flex; gap: 0.4rem;
  font-size: 0.78rem;
}
.modal-stepper li {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: var(--cream-2, #faeed8);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  border-top: 3px solid var(--line);
  transition: all 0.2s;
}
.modal-stepper li.is-done { background: rgba(239,51,64,0.08); color: var(--text); border-top-color: #ef3340; }
.modal-stepper li.is-current { background: #fff; color: var(--text); border-top-color: #00247d; box-shadow: 0 0 0 1px var(--line); }
.modal-step-foot {
  display: flex; gap: 0.6rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
}
.modal-step-foot .btn { flex: 1; justify-content: center; }
.modal-step-foot .btn[hidden] { display: none; }
#fmPrev:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modale pickup */
.pickup-options { display: grid; gap: 0.7rem; padding: 0.5rem 1.5rem 1rem; }
.pickup-opt {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1.5px solid var(--line, #ead9c5);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.pickup-opt:hover { border-color: #ef3340; }
.pickup-opt.is-active { border-color: #ef3340; background: rgba(239,51,64,0.04); }
.pickup-opt:disabled { opacity: 0.45; cursor: not-allowed; }
.pickup-opt:disabled:hover { border-color: var(--line); }
.pk-title { font-weight: 700; margin-bottom: 0.2rem; }
.pk-sub { font-size: 0.85rem; color: var(--muted); }

.pickup-sched {
  padding: 0 1.5rem 1rem;
  /* Zone défilante : sur petit écran, les créneaux scrollent ici et le bouton
     « Valider le créneau » reste toujours visible et accessible en bas. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pickup-sched[hidden] { display: none; }
.pk-label { display: block; margin-bottom: 1rem; }
.pk-label span { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.92rem; }
.pk-label select {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 0.95rem; font-family: var(--body);
  cursor: pointer;
}
.pk-slots-label { font-weight: 600; margin-bottom: 0.5rem; font-size: 0.92rem; }
.pk-slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.4rem;
}
.pk-slot {
  padding: 0.55rem 0.4rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem; font-weight: 600;
  transition: all 0.15s;
}
.pk-slot:hover:not(:disabled) { border-color: #ef3340; }
.pk-slot.is-active { background: linear-gradient(115deg, #ef3340 0%, #00247d 100%); color: #fff; border-color: transparent; }
.pk-slot:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

.pickup-error {
  margin: 0 1.5rem 1rem; padding: 0.7rem 1rem;
  background: rgba(239,51,64,0.1);
  border: 1px solid rgba(239,51,64,0.3);
  color: #a91421;
  border-radius: 8px; font-size: 0.88rem;
}

/* Summary modal */
.sm-section { padding: 1rem 1.5rem; border-top: 1px solid var(--line); }
.sm-section:first-of-type { border-top: 0; }
.sm-section h4 { margin: 0 0 0.7rem; font-family: var(--display); font-size: 1.05rem; }
.sm-items { list-style: none; margin: 0; padding: 0; }
.sm-items li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.8rem; font-size: 0.92rem; }
.sm-items li:last-child { border-bottom: 0; }
.sm-items .sl-opts { color: var(--muted); font-size: 0.78rem; grid-column: 1 / -1; }
.sm-items .sl-qty { color: var(--muted); font-size: 0.85rem; }
.sm-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 0.7rem; font-size: 1.05rem; }
.sm-total strong { font-family: var(--display); font-size: 1.4rem; }
.sm-field { margin-bottom: 0.85rem; }
.sm-field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.35rem; }
.sm-field input, .sm-field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 0.95rem; font-family: var(--body);
}
.sm-field input:focus, .sm-field textarea:focus {
  outline: none; border-color: #ef3340;
  box-shadow: 0 0 0 4px rgba(239,51,64,0.13);
}
.sm-disclaimer {
  margin: 0.5rem 1.5rem; padding: 0.85rem 1.1rem;
  background: rgba(0,36,125,0.06);
  border: 1px solid rgba(0,36,125,0.18);
  border-radius: 8px;
  font-size: 0.85rem; line-height: 1.45;
}

/* --------- TOAST --------- */
.order-toast {
  position: fixed;
  bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--ink, #160e0c); color: #fff;
  padding: 0.85rem 1.4rem; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 0.92rem;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.4);
  z-index: 100;
  animation: toastIn 0.25s ease;
}
.order-toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* --------- BODY scroll lock quand modale ouverte --------- */
body:has(dialog[open]) { overflow: hidden; }
