/*
 * Public layout (templates/layouts/public.html): the pages customers and waiters share,
 * the item page and the order (cart) page. Tokens come from tokens.css, components from app.css.
 * Mobile first; the order bar sticks to the bottom of the screen on phones.
 */

body.app-public { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== Header ===== */
.pub-header { position: sticky; top: 0; z-index: 1030; background: var(--pub-header-bg, var(--color-surface)); color: var(--pub-header-ink, var(--color-text)); border-bottom: 1px solid var(--color-border); }
.pub-header__inner { display: flex; align-items: center; gap: var(--space-3); max-width: 72rem; margin: 0 auto; padding: var(--space-2) var(--space-4); min-height: 3.5rem; }
.pub-header__spacer { flex: 1 1 auto; }
.pub-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--pub-header-ink, var(--color-heading)); text-decoration: none; }
.pub-brand__logo { display: block; width: auto; height: 40px; }
.pub-brand__name { font-family: var(--font-display); font-weight: 800; font-size: var(--text-md); letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0.2rem 0.65rem; border-radius: var(--radius-pill); background: var(--color-primary-tint); color: var(--color-primary-ink); font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.pub-nav { display: flex; align-items: center; gap: var(--space-2); }
.pub-nav__link { align-items: center; min-height: var(--touch-target); padding: 0 var(--space-3); color: var(--pub-header-ink, var(--color-text)); font-weight: 700; text-decoration: none; border-radius: var(--radius-md); }
.pub-nav__link:hover { background: rgb(128 128 128 / 0.18); color: inherit; text-decoration: underline; }
.pub-header .btn-ghost { --bs-btn-color: var(--pub-header-ink, var(--color-text-muted)); }
.pub-cart { position: relative; }
.pub-cart__count { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 0.4rem; border-radius: var(--radius-pill); background: #fff; color: var(--color-primary-ink); font-size: var(--text-sm); font-weight: 800; font-variant-numeric: tabular-nums; }
.pub-cart__count[hidden] { display: none; }
@media (max-width: 575.98px) {
  .pub-header__inner { padding-inline: var(--space-3); gap: var(--space-2); }
  .pub-brand__name { max-width: 10rem; }
}

/* ===== Page frame ===== */
.pub-main { flex: 1 0 auto; width: 100%; max-width: 72rem; margin: 0 auto; padding: var(--space-4); }
@media (min-width: 768px) { .pub-main { padding: var(--space-5) var(--space-5) var(--space-6); } }
.pub-footer { padding: var(--space-4); text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); border-top: 1px solid var(--color-border); background: var(--color-surface); }

/* ===== Quantity stepper (buttons are wired by static/js/app.js) ===== */
.qty-stepper { display: flex; align-items: stretch; width: fit-content; }
.qty-stepper__btn { width: var(--touch-target); min-height: var(--touch-target); padding: 0; font-size: 1.1rem; }
.qty-stepper__btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.qty-stepper__btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.qty-stepper__input { width: 4rem; min-height: var(--touch-target); border-radius: 0; border-left: 0; border-right: 0; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.qty-stepper__input::-webkit-outer-spin-button, .qty-stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* A tick that shows when a choice is selected (status is never colour alone) */
.choice-label__check { display: none; }
.choice-input:checked + .choice-label .choice-label__check { display: inline; }
.choice-label__price { font-weight: 600; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.choice-input:checked + .choice-label .choice-label__price { color: inherit; }
.choice-group--stack { flex-direction: column; align-items: stretch; }
.choice-group--stack .choice-label { justify-content: space-between; }

/* ===== Item page ===== */
.meal { display: grid; gap: var(--space-4); }
@media (min-width: 768px) { .meal { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-5); align-items: start; } }
.meal__media { border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface-muted); aspect-ratio: 16 / 9; box-shadow: var(--shadow-sm); }
.meal__media--empty { display: none; }  /* no photo: on a phone the form comes first */
@media (min-width: 768px) { .meal__media { aspect-ratio: 4 / 3; } .meal__media--empty { display: block; } }
.meal__image { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal__placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--mc-ink-500); font-size: 4rem; }
.meal__category { margin: 0 0 var(--space-1); font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.meal__title { margin: 0; font-size: var(--text-2xl); }
.meal__desc { margin: var(--space-2) 0 0; color: var(--color-text-muted); }
.meal__price { margin: var(--space-3) 0 var(--space-4); font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.meal__field { margin: 0 0 var(--space-4); padding: 0; border: 0; min-width: 0; }
.meal__field legend { float: none; width: auto; padding: 0; }
.meal__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); margin: var(--space-5) calc(var(--space-4) * -1) calc(var(--space-4) * -1); background: var(--color-surface); border-top: 1px solid var(--color-border); position: sticky; bottom: 0; z-index: 5; }
@media (min-width: 768px) { .meal__bar { position: static; margin: var(--space-5) 0 0; border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); } }
.meal__total-label { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.meal__total { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); line-height: 1.15; font-variant-numeric: tabular-nums; }
.meal__added { padding: var(--space-5) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); text-align: center; }
.meal__added[hidden] { display: none; }
.meal__added-icon { font-size: 2.5rem; color: var(--color-success); }
.meal__added-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-4); }

/* ===== Order (cart) page ===== */
.cart { display: grid; gap: var(--space-4); align-items: start; }
@media (min-width: 992px) { .cart { grid-template-columns: minmax(0, 1fr) 21rem; } .cart__summary { position: sticky; top: calc(3.5rem + var(--space-4)); } }
.cart__summary { order: -1; }
@media (min-width: 992px) { .cart__summary { order: 0; } }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-lines li + li { border-top: 1px solid var(--color-border); }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); }
.cart-line__name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cart-line__meta, .cart-line__extras, .cart-line__note { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.cart-line__note { font-style: italic; }
.cart-line__total { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.cart-line__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cart-line__actions form { margin: 0; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 var(--space-4); }
.cart-total__label { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.cart-total__value { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: var(--text-2xl); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cart-target { margin: 0 0 var(--space-3); color: var(--color-text-muted); }
.cart-actions { display: grid; gap: var(--space-3); }
.cart-thanks { padding: var(--space-6) var(--space-4); text-align: center; }
.cart-thanks[hidden], [data-cart-body][hidden] { display: none; }
.cart-thanks__icon { font-size: 3rem; color: var(--color-success); }

/* Headings that receive focus from script (after adding an item, after sending the order) are not controls: no ring */
h2[tabindex="-1"]:focus { outline: none; }

/* ===== Sign-in, sign-up, profile and notice pages ===== */
.auth { display: grid; justify-items: center; padding: var(--space-4) 0 var(--space-6); }
.auth-card { width: 100%; max-width: 30rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.auth-card--wide { max-width: 46rem; }
.auth-card__head { padding: var(--space-5) var(--space-5) 0; text-align: center; }
.auth-card__head h1 { font-size: var(--text-xl); margin: var(--space-3) 0 var(--space-1); }
.auth-card__head p { margin: 0; }
.auth-logo { display: block; width: 3.5rem; height: 3.5rem; margin: 0 auto; object-fit: contain; }
.auth-card__body { padding: var(--space-5); }
.auth-card__foot { padding: var(--space-4) var(--space-5); text-align: center; border-top: 1px solid var(--color-border); background: var(--color-surface-muted); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.auth-card__foot a { font-weight: 700; }
.auth-icon { font-size: 3rem; color: var(--color-primary); }
.auth-error { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0 0 var(--space-4); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-danger-tint); color: var(--color-danger-ink); font-weight: 600; }
.auth-error[hidden] { display: none; }
.auth-error .bi { flex: none; margin-top: 0.15em; }

.profile-grid { display: grid; gap: var(--space-4); align-items: start; }
@media (min-width: 992px) { .profile-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.profile-grid > section.panel, .profile-grid > section.panel + section.panel { margin: 0; }

/* ===== Your table (templates/my_table.html) ===== */
.guest-orders { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); }
.guest-order__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.guest-order__head .panel__title { margin-right: auto; }
.guest-order__time { color: var(--color-text-muted); font-size: var(--text-sm); }
.guest-lines { list-style: none; margin: 0; padding: var(--space-2) var(--space-4); }
.guest-line { display: grid; grid-template-columns: 2.5rem 1fr auto; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.guest-line:last-child { border-bottom: 0; }
.guest-line__qty { font-weight: 800; font-variant-numeric: tabular-nums; }
.guest-line__note { display: block; color: var(--color-text-muted); font-size: var(--text-sm); }
.guest-line__price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.guest-order__total { display: flex; justify-content: space-between; gap: var(--space-3); }
.guest-bill { max-width: 32rem; margin-inline: auto; }
.guest-bill__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); font-size: var(--text-md); }
.guest-bill__total { font-size: var(--text-xl, 1.5rem); font-variant-numeric: tabular-nums; }
.guest-bill__note { margin: var(--space-3) 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }
