/* Reusable components: buttons, chips, badges, cards, inputs, modal, toast, spinner. */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 10px 18px; font-weight: 700; font-size: var(--fs-sm);
  transition: transform .05s ease, box-shadow .15s ease, background .15s ease;
  background: var(--surface-2); color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%);
  color: #fff; box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-md); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.55); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-danger { background: #fdecea; color: var(--err); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: var(--fs-md); }
.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }

/* Chips / tabs */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding: var(--sp-1) 2px var(--sp-3); scrollbar-width: thin; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-pill); padding: 8px 16px; font-weight: 700; font-size: var(--fs-sm);
  white-space: nowrap; transition: all .12s ease;
}
.chip:hover { border-color: var(--brand); color: var(--ink); }
.chip.active { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.chip .tag { font-size: 0.62rem; font-weight: 800; background: var(--brand-700); color: #fff; padding: 1px 6px; border-radius: var(--r-pill); }
.chip.active .tag { background: rgba(0,0,0,.22); }

/* Segmented control (order type). Shared by the menu bar and checkout step 1 —
   it used to be scoped under .order-mode, so on checkout the buttons fell back
   to the UA's white-on-black default and looked like a different app. */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.seg button { border: none; background: transparent; padding: 7px 15px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.seg button svg { width: 16px; height: 16px; }
.seg button.active { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%); color: #fff; }
/* Phones: three nowrap labels side by side have a min-content width of ~337px,
   which is wider than a 320px screen. Left inline-flex it cannot shrink, and
   because a 1fr grid column is min-width:auto that width propagated all the way
   up and widened the page itself. Full width with flexible buttons instead. */
@media (max-width: 640px) {
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 0; min-width: 0; justify-content: center; padding: 8px 6px; }
}
/* Smallest phones still in use (iPhone SE, 320px): the icons are decoration and
   the labels are the information. */
@media (max-width: 360px) {
  .seg button { font-size: var(--fs-xs); }
  .seg button svg { display: none; }
}

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 800; padding: 3px 9px; border-radius: var(--r-pill); }
.badge-offer { background: linear-gradient(90deg, var(--brand), var(--brand-700)); color: #fff; }
.badge-veg { border: 1px solid var(--veg); color: var(--veg); }
.badge-soft { background: var(--brand-soft); color: var(--brand-700); }
.badge-status { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); text-transform: capitalize; }
.dot { width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--veg); display: inline-block; position: relative; }
.dot::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; background: var(--veg); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-pad { padding: var(--sp-4); }

/* Inputs */
.field { display: block; margin-bottom: var(--sp-3); }
.field > label { display: block; font-size: var(--fs-sm); font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.input, .select, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font-size: var(--fs-md); font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(247,148,29,.18); }
textarea.input { resize: vertical; min-height: 72px; }
.input-row { display: flex; gap: var(--sp-2); }
/* On small phones, paired form fields stack full-width instead of squeezing. */
@media (max-width: 460px) {
  .input-row { flex-wrap: wrap; }
  .input-row > .field { flex: 1 1 100%; margin-bottom: var(--sp-2); }
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,12,6,.55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60; padding: 0;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); width: 100%; max-width: 460px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto;
  transform: translateY(20px); transition: transform .2s ease;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: var(--sp-4); }
.modal-foot { padding: var(--sp-4); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.icon-btn { border: none; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; color: var(--ink-2); display: grid; place-items: center; }
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; padding: var(--sp-4); }
  .modal { border-radius: var(--r-lg); }
}

/* Option grid (base/size selectors in item modal) */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.opt {
  border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px; text-align: center;
  background: var(--surface); font-weight: 700; transition: all .12s ease;
}
.opt small { display: block; font-weight: 800; color: var(--brand-700); margin-top: 3px; }
.opt:hover { border-color: var(--brand); }
.opt.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(247,148,29,.2) inset; }
.opt.disabled { opacity: .4; pointer-events: none; }
.opt-label { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: var(--sp-3) 0 6px; }

/* Quantity stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; }
.stepper button { border: none; background: var(--surface-2); width: 34px; height: 34px; font-size: 18px; font-weight: 800; color: var(--brand-700); }
.stepper span { min-width: 34px; text-align: center; font-weight: 800; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: 92vw; }
/* Sheets open from the bottom edge, which is exactly where the toast sits — the
   confirmation was landing on top of the options someone was still reading. */
body:has(.modal-backdrop.open) .toast-wrap { bottom: auto; top: calc(var(--header-h) + 12px); }
.toast { background: var(--dark); color: #fff; padding: 11px 16px; border-radius: var(--r-pill); box-shadow: var(--shadow-md); font-size: var(--fs-sm); font-weight: 600; animation: toastIn .2s ease; }
.toast.ok { background: #12692e; }
.toast.err { background: #b5271b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Spinner + skeleton */
.spinner { width: 22px; height: 22px; border: 3px solid rgba(247,148,29,.3); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; padding: var(--sp-7); gap: var(--sp-3); color: var(--ink-2); }
.skeleton { background: linear-gradient(90deg, #f0e6da 25%, #f7efe4 50%, #f0e6da 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-md); }
@keyframes sk { to { background-position: -200% 0; } }

/* Notice banner — shown on the landing page and the menu when the owner has
   turned online ordering off. Fixed light-red colours on purpose: it must read
   as an alert on the light menu page and on the dark landing page alike. */
.notice-banner { background: #fdecea; color: #8a1c12; border: 1px solid #f3b5ad; border-radius: var(--r-md); padding: 12px 16px; margin-bottom: var(--sp-4); font-size: var(--fs-sm); line-height: 1.5; }

/* Empty state */
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--ink-2); }
.empty .emoji { font-size: 2.4rem; margin-bottom: var(--sp-2); }
