/* ==========================================================================
   THE CHOUPAL — ONLINE ORDERING PAGE
   Builds on styles.css (same colours, type and components).
   ========================================================================== */

/* Intro */
.order-hero {
  padding: calc(var(--header-h) + clamp(2.75rem, 6vw, 4.5rem)) 0 clamp(2.75rem, 6vw, 4rem);
}
.order-hero .section-title { color: var(--c-on-dark); }
.order-hero-lead { max-width: 34rem; margin: 0; font-size: 1.05rem; color: var(--c-on-dark); }
.order-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}
.order-facts li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--c-line-dark);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--c-on-dark);
}
.order-facts .icon { color: var(--c-gold); }

.order-section { padding-top: clamp(2.5rem, 5vw, 4rem); min-height: 60vh; }

/* Layout: menu + cart */
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

.order-step { margin: 0 0 clamp(2.5rem, 5vw, 3.5rem); padding: 0; border: 0; min-width: 0; }
.order-step-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 500;
  color: var(--c-charcoal);
}
.order-step-num {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--c-charcoal);
  color: var(--c-cream);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
}
.order-step-hint { margin: -0.5rem 0 1.25rem; color: var(--c-muted); }

/* Step 1: branch cards */
.branch-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.branch-option { position: relative; display: block; cursor: pointer; }
.branch-option input { position: absolute; opacity: 0; pointer-events: none; }
.branch-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  height: 100%;
  padding: 1.25rem 3rem 1.25rem 1.25rem;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.branch-option:hover .branch-card { border-color: #cdbb9f; }
.branch-option input:focus-visible + .branch-card { outline: 2px solid var(--c-gold); outline-offset: 3px; }
.branch-option input:checked + .branch-card { border-color: var(--c-gold-ink); box-shadow: 0 0 0 1px var(--c-gold-ink), var(--shadow); }
.branch-name { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; color: var(--c-charcoal); }
.branch-line { display: flex; gap: 0.5rem; font-size: 0.88rem; color: var(--c-muted); }
.branch-line .icon { margin-top: 0.25rem; color: var(--c-gold-ink); }
.branch-check {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  color: transparent;
}
.branch-option input:checked + .branch-card .branch-check { background: var(--c-gold-ink); border-color: var(--c-gold-ink); color: #fff; }
.branch-picker.needs-attention .branch-card { border-color: #a1341c; }

/* Step 2: menu */
.order-tabs { margin-bottom: 1.25rem; }
#menuStep.is-waiting .order-items { opacity: 0.6; }

.oi-group {
  margin: 1.75rem 0 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-gold-ink);
}
.oi-group:first-child { margin-top: 0.25rem; }

.oi {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--c-line);
}
.oi--sizes { align-items: start; }
.oi-name { margin: 0; font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; line-height: 1.25; color: var(--c-charcoal); }
.oi-text { min-width: 0; }
.oi-desc { margin: 0.3rem 0 0; font-size: 0.92rem; line-height: 1.45; color: var(--c-muted); }
.oi-options { display: grid; gap: 0.5rem; justify-items: end; }
.oi-variant { display: flex; align-items: center; justify-content: flex-end; gap: 0.9rem; min-height: 40px; }
.oi-size { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.oi-price { min-width: 3.5rem; font-weight: 600; text-align: right; color: var(--c-gold-ink); font-variant-numeric: tabular-nums; }
.oi-control { display: inline-flex; justify-content: flex-end; min-width: 7.25rem; }

.oi-add {
  min-height: 40px;
  min-width: 7.25rem;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--c-charcoal);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-charcoal);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.oi-add:hover { background: var(--c-charcoal); color: var(--c-cream); }

.stepper {
  display: inline-flex;
  align-items: center;
  min-width: 7.25rem;
  justify-content: space-between;
  border: 1px solid var(--c-charcoal);
  border-radius: 999px;
  background: var(--c-charcoal);
  color: var(--c-cream);
}
.stepper button {
  width: 40px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  color: inherit;
  cursor: pointer;
}
.stepper button:hover:not([disabled]) { background: rgba(255, 255, 255, 0.12); }
.stepper button[disabled] { opacity: 0.4; cursor: not-allowed; }
.stepper-qty { min-width: 1.5rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Cart */
.order-cart {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
  padding: 1.5rem;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-title { font-size: 1.6rem; }
.cart-close {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--c-charcoal);
  cursor: pointer;
}
.cart-branch { margin: 0.25rem 0 1rem; font-size: 0.85rem; color: var(--c-gold-ink); font-weight: 600; }
.cart-empty { margin: 0 0 1.25rem; font-size: 0.92rem; color: var(--c-muted); }
.cart-lines { display: grid; margin-bottom: 1rem; max-height: 50vh; overflow-y: auto; }
.cart-line { padding: 0.85rem 0; border-top: 1px solid var(--c-line); }
.cart-line-info { display: flex; justify-content: space-between; gap: 0.75rem; }
.cart-line-name { font-weight: 600; line-height: 1.35; }
.cart-line-unit { flex-shrink: 0; font-size: 0.8rem; color: var(--c-muted); }
.cart-line-controls { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.cart-line-controls .stepper, .cart-line-controls .oi-add { min-width: 6.5rem; }

/* Menu Management: sold out at this branch (no Add button) */
.oi-soldout {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; min-width: 7.25rem; padding: 0.45rem 1rem;
  border: 1px dashed #b9a48a; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #8a2a14; background: #fbf1ec;
}
.oi--soldout .oi-name, .oi--soldout .oi-price { color: var(--c-muted); }
.oi--soldout .oi-price { text-decoration: line-through; }
.oi-none { margin: 1rem 0; color: var(--c-muted); }
.order-step-hint.is-error { color: #a1341c; font-weight: 600; }

/* Branch Settings: closed branch, branch details, pickup / delivery switched off */
.branch-info { font-size: 0.82rem; color: var(--c-gold-ink); }
.branch-closed { display: block; margin-top: 0.25rem; padding: 0.55rem 0.75rem; border-radius: 4px; background: #fbf1ec; color: #8a2a14; font-size: 0.88rem; font-weight: 600; }
.branch-option.is-closed { cursor: not-allowed; }
.branch-option.is-closed .branch-card { opacity: 0.8; background: #f7f3ee; }
.branch-option.is-closed:hover .branch-card { border-color: inherit; }
.fulfil-option.is-off { cursor: not-allowed; opacity: 0.55; }
.cart-line-controls .stepper button { width: 34px; height: 32px; }
.cart-line-total { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-remove {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--c-muted);
  cursor: pointer;
}
.cart-remove:hover { color: #a1341c; }
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 0 0.25rem;
  border-top: 1px solid var(--c-line);
  font-family: var(--font-serif);
  font-size: 1.35rem;
}
.cart-total strong { font-family: var(--font-sans); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.cart-pay-note { margin: 0.25rem 0 1.25rem; font-size: 0.82rem; color: var(--c-muted); }
.order-cart .btn-block { margin-top: 0.5rem; }
.order-cart .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.cart-continue {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--c-gold-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* Mobile cart bar + backdrop (shown on small screens only) */
.cart-bar, .cart-backdrop { display: none; }

/* Checkout */
.checkout-back {
  margin: 0 0 1.5rem;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-gold-ink);
  cursor: pointer;
}
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.checkout-form .order-step-title { margin-bottom: 1.5rem; }
.checkout-summary {
  padding: 1.5rem;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}
.summary-lines { display: grid; margin: 0 0 0.5rem; }
.summary-lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--c-line);
  font-size: 0.95rem;
}
.summary-lines li > span:last-child { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-qty { color: var(--c-muted); }
.summary-note { margin: 0.75rem 0 0; font-size: 0.8rem; color: var(--c-muted); }

.pay-box {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  background: var(--c-sand);
  border-left: 3px solid var(--c-gold-ink);
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.pay-box p { margin: 0; }
.pay-box-title { margin-bottom: 0.25rem !important; font-weight: 600; color: var(--c-charcoal); }

/* Pickup or delivery */
.fulfil-picker { margin: 0 0 1.5rem; padding: 0; border: 0; min-width: 0; }
.fulfil-legend {
  margin-bottom: 0.6rem;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-charcoal);
}
.fulfil-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.fulfil-option { position: relative; display: block; cursor: pointer; }
.fulfil-option input { position: absolute; opacity: 0; pointer-events: none; }
.fulfil-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: 100%;
  padding: 0.9rem 1rem;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.fulfil-option:hover .fulfil-card { border-color: #cdbb9f; }
.fulfil-option input:focus-visible + .fulfil-card { outline: 2px solid var(--c-gold); outline-offset: 3px; }
.fulfil-option input:checked + .fulfil-card { border-color: var(--c-gold-ink); box-shadow: 0 0 0 1px var(--c-gold-ink); }
.fulfil-name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--c-charcoal); }
.fulfil-text { font-size: 0.82rem; color: var(--c-muted); }
.fulfil-picker.needs-attention .fulfil-card { border-color: #a1341c; }
.delivery-fields { margin-bottom: 1.35rem; }

/* Review step */
.review { display: flex; justify-content: center; outline: none; }
.review-intro { margin: -0.5rem 0 0; color: var(--c-muted); }
.review-card .btn-block { margin-top: 0.25rem; }
.review-card .form-status { text-align: center; }

/* Order placed */
.order-done { display: flex; justify-content: center; outline: none; }
.order-done-card {
  width: 100%;
  max-width: 40rem;
  padding: clamp(1.75rem, 5vw, 3rem);
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}
.order-done-msg { font-size: 1.05rem; }
.order-done-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 1.5rem 0; }
.order-done-meta dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-gold-ink); padding-top: 0.2rem; }
.order-done-meta dd { margin: 0; font-weight: 600; }
.order-done-card .pay-box { margin-top: 1.5rem; }

/* Unavailable */
.order-alert {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  text-align: center;
}
.order-alert h2 { margin-bottom: 0.75rem; font-size: 1.8rem; }
.order-alert-phones a { font-weight: 600; color: var(--c-gold-ink); }

.order-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
.order-footer a { color: var(--c-text); text-decoration: none; }
.order-footer a:hover { color: var(--c-gold-ink); }

/* ---------- Tablet & mobile ---------- */
@media (max-width: 900px) {
  .order-layout { grid-template-columns: minmax(0, 1fr); }   /* lets the swipeable category row scroll instead of widening the page */
  .checkout-grid { grid-template-columns: minmax(0, 1fr); }
  .checkout-summary { order: -1; }

  /* Cart becomes a slide-up panel */
  .order-cart {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 160;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    transform: translateY(105%);
    transition: transform 0.3s var(--ease);
    visibility: hidden;
  }
  .order-cart.is-open { transform: none; visibility: visible; }
  .cart-close { display: block; }
  .cart-lines { max-height: none; }

  .cart-bar:not([hidden]) {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 140;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.6rem 1.1rem;
    border: 0;
    border-radius: 999px;
    background: var(--c-charcoal);
    color: var(--c-cream);
    font-family: var(--font-sans);
    box-shadow: 0 12px 30px rgba(23, 15, 9, 0.35);
    cursor: pointer;
  }
  .cart-bar-count { font-size: 0.8rem; color: var(--c-gold-light); }
  .cart-bar-label { flex: 1; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
  .cart-bar-total { font-size: 1rem; }
  .cart-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 150; display: block; background: rgba(23, 15, 9, 0.5); }
  body.cart-open { overflow: hidden; }
  .order-section { padding-bottom: 6rem; }
}

@media (max-width: 640px) {
  .branch-options { grid-template-columns: 1fr; }
  .oi { grid-template-columns: 1fr; gap: 0.35rem; }
  .oi-options { justify-items: stretch; }
  .oi-variant { justify-content: space-between; }
  .oi-size { margin-right: auto; }
  .oi-price { text-align: left; }
  .oi-variant:not(:has(.oi-size)) .oi-price { margin-right: auto; }
  .order-done-meta { grid-template-columns: 1fr; gap: 0.1rem; }
  .order-done-meta dd { margin-bottom: 0.6rem; }
}

/* Track Order links */
.order-track-link { margin: 0.75rem 0 0; }
.order-track-link a { color: var(--c-gold, #c4a064); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.order-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

/* ------------------------------------------------------------------
   Offers & discounts
   ------------------------------------------------------------------ */
.order-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; margin: 0 0 1.25rem; }
.order-offers[hidden] { display: none; }
.offer-card { padding: 0.85rem 1rem; border: 1px dashed var(--c-gold); border-radius: 6px; background: var(--c-paper, #fffdf9); }
.offer-title { margin: 0; font-weight: 600; color: var(--c-charcoal); line-height: 1.35; }
.offer-value { display: inline-block; margin-right: 0.35rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--c-gold); color: var(--c-charcoal); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; }
.offer-desc { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--c-muted); }
.offer-how { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--c-muted); }
.offer-code { padding: 0 0.35rem; border: 1px solid var(--c-gold-ink); border-radius: 4px; color: var(--c-gold-ink); letter-spacing: 0.08em; font-weight: 700; }
.cart-promo { margin: 0.75rem 0 0.25rem; }
.cart-promo[hidden] { display: none; }
.promo-form { display: flex; gap: 0.5rem; }
.promo-form input { flex: 1 1 auto; min-width: 0; min-height: 42px; padding: 0.4rem 0.7rem; border: 1px solid var(--c-line); border-radius: 4px; font: inherit; font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em; background: #fff; }
.promo-form input::placeholder { text-transform: none; letter-spacing: 0; }
.promo-apply { min-height: 42px; padding: 0 1rem; border: 1px solid var(--c-charcoal); border-radius: 4px; background: var(--c-charcoal); color: #fff; font: inherit; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; cursor: pointer; }
.promo-status { margin: 0.4rem 0 0; font-size: 0.85rem; }
.promo-status:empty { display: none; }
.promo-status.is-ok { color: #2e7d32; font-weight: 600; }
.promo-status.is-info { color: var(--c-gold-ink); }
.promo-status.is-error { color: #a1341c; }
.promo-remove { margin-top: 0.25rem; padding: 0; border: 0; background: none; font: inherit; font-size: 0.8rem; color: var(--c-muted); text-decoration: underline; cursor: pointer; }
.promo-remove[hidden] { display: none; }
.promo-hints { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.8rem; color: var(--c-gold-ink); }
.promo-hints[hidden] { display: none; }
.price-breakdown { margin-top: 0.5rem; }
.price-breakdown[hidden] { display: none; }
.price-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.price-row > span:last-child { white-space: nowrap; }
.price-discount { color: #2e7d32; font-weight: 600; }
.track-discount { color: #2e7d32; font-weight: 600; }
