/*
 * Eazi Order — customer components.
 * Requires css/tokens.css. Mobile-first; breakpoints at 640px, 900px, 1200px.
 * --accent / --accent-ink can be overridden per restaurant (its brand colour).
 */

/* ---------- Base ---------- */
:root {
    --accent: var(--brand);
    --accent-hover: var(--brand-hover);
    --accent-ink: var(--brand-ink);
    --accent-soft: var(--brand-soft);
    --appbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--appbar-h) + 64px); }

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

[hidden]:not(.cart-bar) { display: none !important; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
/* No double-tap zoom or tap delay on phones, so quick +/− taps register */
button, a, .chip, input, select, textarea { touch-action: manipulation; }
h1, h2, h3 { line-height: var(--leading-tight); letter-spacing: -0.01em; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: var(--space-3); top: -60px; z-index: 1000;
    background: var(--ink); color: #fff; padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm); text-decoration: none; font-weight: var(--weight-semibold);
}
.skip-link:focus { top: var(--space-3); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 900px) { .container { padding: 0 var(--space-6); } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--tap); padding: 0 var(--space-5);
    border-radius: var(--radius-pill); border: 1px solid transparent;
    font-weight: var(--weight-semibold); font-size: var(--text-sm); text-decoration: none;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-3); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--muted); }
.btn-lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn .fa-spinner { animation: spin 0.8s linear infinite; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; position: relative;
    width: var(--tap); height: var(--tap); border-radius: var(--radius-pill);
    color: var(--ink); transition: background-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--muted); }
.icon-btn.on-media { background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm); }

.badge-count {
    position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-ink);
    font-size: 11px; font-weight: var(--weight-bold); display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
}
.badge-count[hidden] { display: none; }
.badge-count.bump { animation: bump var(--dur-slow) var(--ease); }

/* ---------- App bar & navigation ---------- */
.appbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.4) blur(8px);
    -webkit-backdrop-filter: saturate(1.4) blur(8px);
}
.appbar-inner { display: flex; align-items: center; gap: var(--space-2); height: var(--appbar-h); }
.appbar-title { flex: 1; min-width: 0; }
.appbar-title strong { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title span:not(.brand-mark) { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.appbar-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; text-decoration: none; }
.brand-mark {
    width: 36px; height: 36px; border-radius: var(--radius-pill); flex-shrink: 0; overflow: hidden;
    background: var(--accent); color: var(--accent-ink);
    display: inline-flex; align-items: center; justify-content: center; font-weight: var(--weight-bold);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.table-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    border-radius: var(--radius-pill); background: var(--muted); color: var(--ink-2);
    font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap;
}

.crumbs { display: none; }
@media (min-width: 900px) {
    .crumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--ink-3); padding-top: var(--space-5); }
    .crumbs a { color: var(--ink-3); text-decoration: none; }
    .crumbs a:hover { color: var(--ink); text-decoration: underline; }
    .crumbs [aria-current] { color: var(--ink); font-weight: var(--weight-medium); }
}

.chip-nav {
    position: sticky; top: var(--appbar-h); z-index: 40;
    background: rgba(250, 248, 246, 0.96); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip-row {
    display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-3) 0;
    scrollbar-width: none; scroll-snap-type: x proximity;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; scroll-snap-align: start;
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 40px; padding: 0 var(--space-4);
    border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface);
    font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-2);
    text-decoration: none; white-space: nowrap;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active, .chip[aria-current="page"], .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Search ---------- */
.search-field { position: relative; }
.search-field .fa-magnifying-glass, .search-field .fa-search { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-field input {
    width: 100%; height: 48px; padding: 0 var(--space-4) 0 44px;
    border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface);
    font-size: var(--text-base); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-field input::placeholder { color: var(--ink-3); }
.search-field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Landing ---------- */
.landing { min-height: 100svh; display: flex; flex-direction: column; background: var(--ink); color: #fff; position: relative; overflow: hidden; }
.landing-media { position: absolute; inset: 0; }
.landing-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.landing-media::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(28,25,23,0.25) 0%, rgba(28,25,23,0.35) 40%, rgba(28,25,23,0.92) 100%);
}
.landing-media.no-photo { background: radial-gradient(120% 80% at 20% 0%, var(--accent) 0%, transparent 60%), var(--ink); }
.landing-media.no-photo::after { background: linear-gradient(180deg, transparent 30%, rgba(28,25,23,0.85) 100%); }
.landing-top { position: relative; display: flex; justify-content: space-between; align-items: center; padding: var(--space-4); }
.landing-top .table-chip { background: rgba(255,255,255,0.16); color: #fff; backdrop-filter: blur(6px); }
.landing-body { position: relative; margin-top: auto; padding: var(--space-6) var(--space-5) var(--space-7); max-width: 640px; }
.landing-logo {
    width: 72px; height: 72px; border-radius: var(--radius-pill); overflow: hidden; margin-bottom: var(--space-5);
    border: 3px solid rgba(255,255,255,0.9); background: var(--accent); color: var(--accent-ink);
    display: flex; align-items: center; justify-content: center; font-size: 1.75rem; font-weight: var(--weight-bold);
}
.landing-logo img { width: 100%; height: 100%; object-fit: cover; }
.landing-eyebrow { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.landing h1 { font-size: clamp(2rem, 7vw, 3.25rem); font-weight: var(--weight-bold); margin: var(--space-2) 0 var(--space-3); }
.landing-intro { color: rgba(255,255,255,0.86); font-size: var(--text-lg); max-width: 34ch; }
.landing-stats { display: flex; gap: var(--space-5); margin: var(--space-5) 0 var(--space-6); font-size: var(--text-sm); color: rgba(255,255,255,0.8); }
.landing-stats strong { display: block; font-size: var(--text-xl); color: #fff; }
.landing-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.landing-actions .btn-secondary { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.35); color: #fff; }
.landing-actions .btn-secondary:hover { background: rgba(255,255,255,0.2); }
@media (min-width: 640px) {
    .landing-actions { flex-direction: row; }
    .landing-body { padding: var(--space-8) var(--space-7) var(--space-8); }
}

/* ---------- Page headings ---------- */
.page-head { padding: var(--space-5) 0 var(--space-4); }
.page-head h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.page-head p { color: var(--ink-3); margin-top: var(--space-1); }
@media (min-width: 900px) { .page-head h1 { font-size: var(--text-3xl); } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: var(--space-6) 0 var(--space-4); }
.section-title h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.section-title span { color: var(--ink-3); font-size: var(--text-sm); }

/* ---------- Image fallback ---------- */
.img-fallback {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--space-2);
    background: linear-gradient(135deg, var(--accent-soft), var(--muted));
    color: var(--accent); font-size: 2rem;
}
.img-fallback span { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-3); letter-spacing: 0.04em; }

/* ---------- Category cards ---------- */
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding-bottom: var(--space-8); }
@media (min-width: 640px) { .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); } }
@media (min-width: 1100px) { .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); } }

.category-card {
    position: relative; display: flex; flex-direction: column; text-decoration: none;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.category-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--muted); }
.category-media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease); }
.category-body { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-4); }
.category-text { flex: 1; min-width: 0; }
.category-name { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.category-meta { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.category-desc { display: none; }
.category-arrow { color: var(--ink-3); font-size: var(--text-sm); transition: transform var(--dur) var(--ease), color var(--dur) var(--ease); }
.category-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-2px); }
.category-card:hover .category-media img { transform: scale(1.04); }
.category-card:hover .category-arrow { transform: translateX(3px); color: var(--accent); }
.category-card:focus-visible { box-shadow: var(--focus-ring), var(--shadow-md); }
@media (min-width: 640px) {
    .category-body { padding: var(--space-4); }
    .category-name { font-size: var(--text-lg); }
    .category-desc {
        display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        font-size: var(--text-sm); color: var(--ink-3); margin-top: var(--space-1);
    }
}

/* Category banner on the items page */
.category-banner { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5) 0 var(--space-2); }
.category-banner-media { width: 72px; height: 72px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; background: var(--muted); }
.category-banner-media img { width: 100%; height: 100%; object-fit: cover; }
.category-banner-media .img-fallback { font-size: 1.5rem; }
.category-banner h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.category-banner p { color: var(--ink-3); font-size: var(--text-sm); margin-top: 2px; }
@media (min-width: 900px) {
    .category-banner-media { width: 96px; height: 96px; }
    .category-banner h1 { font-size: var(--text-3xl); }
}

.toolbar { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) 0 var(--space-4); }
.toolbar .search-field { flex: 1; max-width: 480px; }

/* ---------- Menu item cards ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding-bottom: var(--space-8); }
@media (min-width: 720px) { .menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); } }
@media (min-width: 1100px) { .menu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); } }

.menu-item {
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.menu-item:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.menu-item[hidden] { display: none; }
/* Only the photo and the name open the details sheet */
.menu-item-media { display: block; width: 100%; padding: 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--muted); cursor: pointer; }
.menu-item-media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease); }
.menu-item:hover .menu-item-media img { transform: scale(1.03); }
.menu-item-body { display: flex; flex-direction: column; flex: 1; padding: var(--space-3); gap: 2px; }
.menu-item-name {
    text-align: left; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.3; cursor: pointer;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.menu-item-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.menu-item-name:focus-visible { box-shadow: var(--focus-ring); }
.menu-item-source { position: relative; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item-source .fa-store { color: var(--ink-3); margin-right: 2px; }
.menu-item-desc {
    display: none; font-size: var(--text-sm); color: var(--ink-3);
    -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.menu-item-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }
.menu-item-price { font-weight: var(--weight-bold); font-size: var(--text-base); color: var(--ink); white-space: nowrap; }
.menu-item-actions { position: relative; }
@media (min-width: 720px) {
    .menu-item-body { padding: var(--space-4); gap: var(--space-1); }
    .menu-item-name { font-size: var(--text-base); }
    .menu-item-desc { display: -webkit-box; }
}

.add-to-cart {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; min-width: 36px; padding: 0 var(--space-3);
    border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-ink);
    font-size: var(--text-sm); font-weight: var(--weight-semibold);
    transition: background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.add-to-cart::before { content: ''; position: absolute; inset: -4px; } /* 44px touch area */
.add-to-cart { position: relative; }
.add-to-cart:hover { background: var(--accent-hover); }
.add-to-cart:active { transform: scale(0.94); }
.add-to-cart.added { animation: pop var(--dur-slow) var(--ease); }
.add-to-cart .label { display: none; }
@media (min-width: 720px) { .add-to-cart .label { display: inline; } }

.stepper {
    display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 2px;
    border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--ink);
}
.stepper .quantity-btn {
    width: 32px; height: 32px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--ink); font-size: 12px; box-shadow: var(--shadow-xs); position: relative;
}
.stepper .quantity-btn::before { content: ''; position: absolute; inset: -6px; }
.stepper .quantity-btn:hover { color: var(--accent); }
.stepper .quantity { min-width: 24px; text-align: center; font-weight: var(--weight-semibold); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

.card-stepper { display: none; }
.menu-item.in-cart .add-to-cart { display: none; }
.menu-item.in-cart .card-stepper { display: inline-flex; }
.menu-item.in-cart { border-color: var(--accent); }

/* ---------- Empty, loading & notice states ---------- */
.empty-state {
    text-align: center; padding: var(--space-8) var(--space-5); color: var(--ink-3);
    display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
}
.empty-state .empty-icon {
    width: 64px; height: 64px; border-radius: var(--radius-pill); background: var(--muted); color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.empty-state h2, .empty-state h3 { color: var(--ink); font-size: var(--text-lg); }
.grid-empty { grid-column: 1 / -1; }

.notice {
    display: flex; gap: var(--space-3); align-items: flex-start;
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
    background: var(--info-soft); color: var(--info); font-size: var(--text-sm);
}
.notice.error { background: var(--danger-soft); color: var(--danger); }

.skeleton {
    background: linear-gradient(90deg, var(--muted) 25%, #ebe6e1 50%, var(--muted) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm);
}

/* ---------- Dialogs: cart drawer & item sheet ---------- */
.dialog-backdrop, .cart-modal {
    position: fixed; inset: 0; z-index: 900; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(28, 25, 23, 0.5); opacity: 0; visibility: hidden;
    transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.dialog-backdrop.active, .cart-modal.active { opacity: 1; visibility: visible; }
.dialog-panel, .cart-panel {
    width: 100%; max-height: 92svh; display: flex; flex-direction: column;
    background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(24px); transition: transform var(--dur-slow) var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
}
.active > .dialog-panel, .active > .cart-panel { transform: none; }
.dialog-panel::before, .cart-panel::before {
    content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: var(--space-2) auto 0;
}
@media (min-width: 720px) {
    .dialog-backdrop { align-items: center; }
    .dialog-panel { max-width: 560px; border-radius: var(--radius-xl); max-height: 88vh; }
    .dialog-panel::before { display: none; }
    .cart-modal { justify-content: flex-end; align-items: stretch; }
    .cart-panel { max-width: 420px; max-height: none; height: 100%; border-radius: 0; transform: translateX(32px); }
    .cart-panel::before { display: none; }
}
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.dialog-body { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.dialog-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); background: var(--surface); }

/* Item detail sheet */
.sheet-media { aspect-ratio: 16 / 10; background: var(--muted); overflow: hidden; }
.sheet-media img { width: 100%; height: 100%; object-fit: cover; }
.sheet-content { padding: var(--space-5); }
.sheet-content h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.sheet-source { font-size: var(--text-sm); color: var(--ink-3); margin-top: var(--space-1); }
.sheet-price { font-size: var(--text-xl); font-weight: var(--weight-bold); margin-top: var(--space-3); }
.sheet-desc { color: var(--ink-2); margin-top: var(--space-3); white-space: pre-line; }
.sheet-actions { display: flex; gap: var(--space-3); align-items: center; }
.sheet-actions .btn { flex: 1; }
.sheet-close { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 2; }
.dialog-panel { position: relative; }

/* Cart contents */
.cart-items { padding: var(--space-2) var(--space-5); }
.cart-item { display: flex; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.cart-item:last-child { border-bottom: 0; }
.cart-item-image { width: 64px; height: 64px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; background: var(--muted); }
.cart-item-image img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-image .img-fallback { font-size: 1.1rem; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: var(--weight-semibold); font-size: var(--text-sm); line-height: 1.3; }
.cart-item-restaurant { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.cart-item-unit { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.cart-item-controls { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-2); gap: var(--space-2); }
.cart-item-total { font-weight: var(--weight-bold); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.remove-item { color: var(--ink-3); width: 36px; height: 36px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; }
.remove-item:hover { color: var(--danger); background: var(--danger-soft); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-3); font-weight: var(--weight-semibold); }
.cart-total strong { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.cart-note { font-size: var(--text-xs); color: var(--ink-3); margin-bottom: var(--space-3); }

/* Mobile cart bar */
.cart-bar {
    position: fixed; left: var(--space-3); right: var(--space-3); bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); z-index: 60;
    display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: 0 var(--space-4) 0 var(--space-3);
    background: var(--ink); color: #fff; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); text-align: left;
    transform: translateY(0); transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}
.cart-bar[hidden] { display: flex; transform: translateY(140%); opacity: 0; pointer-events: none; }
.cart-bar-count {
    min-width: 32px; height: 32px; border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-ink);
    display: inline-flex; align-items: center; justify-content: center; font-weight: var(--weight-bold); font-size: var(--text-sm);
}
.cart-bar-label { flex: 1; font-weight: var(--weight-semibold); }
.cart-bar-total { font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
body.has-cart-bar main { padding-bottom: 88px; }
@media (min-width: 900px) { .cart-bar { display: none !important; } body.has-cart-bar main { padding-bottom: 0; } }

/* ---------- Toasts ---------- */
/* Phones: above the order bar so navigation stays visible. Desktop: top right. */
.toast-container {
    position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%);
    bottom: calc(84px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: var(--space-2); width: min(92vw, 380px); pointer-events: none;
}
@media (min-width: 900px) {
    .toast-container { left: auto; right: var(--space-5); transform: none; bottom: auto; top: calc(var(--appbar-h) + var(--space-4)); }
}
.toast {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
    background: var(--ink); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    font-size: var(--text-sm); pointer-events: auto; animation: toast-in var(--dur-slow) var(--ease);
}
.toast-icon { font-size: 1rem; }
.toast.success .toast-icon { color: #6EE7A0; }
.toast.error { background: var(--danger); }
.toast.error .toast-icon, .toast.warning .toast-icon { color: #fff; }
.toast.warning { background: var(--warning); }
.toast.info .toast-icon { color: #9CC3FF; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }

/* ---------- Forms ---------- */
.field { margin-bottom: var(--space-4); }
.field-label { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: var(--space-2); }
.field-label .req { color: var(--danger); }
.field-hint { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-1); }
.input {
    width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface);
    font-size: var(--text-base); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea.input { resize: vertical; min-height: 96px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { display: flex; gap: 6px; align-items: center; font-size: var(--text-sm); color: var(--danger); margin-top: var(--space-2); }
.field-error[hidden] { display: none; }
.input-group { display: flex; }
.input-prefix {
    display: inline-flex; align-items: center; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--muted); color: var(--ink-2); font-weight: var(--weight-medium);
}
.input-group .input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ---------- Cards & checkout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-pad { padding: var(--space-5); }
.card h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); margin-bottom: var(--space-4); }

.checkout-grid { display: grid; gap: var(--space-4); padding-bottom: var(--space-8); }
@media (min-width: 900px) { .checkout-grid { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; gap: var(--space-6); } .checkout-summary { position: sticky; top: calc(var(--appbar-h) + var(--space-4)); } }

.restaurant-section { padding-bottom: var(--space-3); margin-bottom: var(--space-3); border-bottom: 1px dashed var(--line-strong); }
.restaurant-section:last-child { border-bottom: 0; margin-bottom: 0; }
.restaurant-header { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-2); }
.order-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; }
.order-item-details { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.order-item-image { width: 44px; height: 44px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; background: var(--muted); }
.order-item-image img { width: 100%; height: 100%; object-fit: cover; }
.order-item-image .img-fallback { font-size: 0.9rem; }
.order-item-info { display: flex; flex-direction: column; min-width: 0; }
.order-item-name { font-weight: var(--weight-medium); font-size: var(--text-sm); }
.order-item-quantity { font-size: var(--text-xs); color: var(--ink-3); }
.order-item-price { font-weight: var(--weight-semibold); font-size: var(--text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.restaurant-subtotal { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--ink-3); padding-top: var(--space-1); }
.order-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--space-4); margin-top: var(--space-2); border-top: 1px solid var(--line); font-weight: var(--weight-semibold); }
.order-total strong { font-size: var(--text-2xl); font-variant-numeric: tabular-nums; }
.payment-note { display: flex; gap: var(--space-2); font-size: var(--text-xs); color: var(--ink-3); margin: var(--space-3) 0 var(--space-4); }

/* Order processing overlay */
#order-skeleton-overlay {
    display: none; position: fixed; inset: 0; z-index: 950; background: rgba(250, 248, 246, 0.94);
    align-items: center; justify-content: center; flex-direction: column; gap: var(--space-5);
}
#order-skeleton-overlay.active { display: flex; }
.processing-card { width: min(92vw, 400px); padding: var(--space-6); }
.processing-card .skeleton { height: 14px; margin-bottom: var(--space-3); }
.processing-text { font-weight: var(--weight-semibold); color: var(--ink-2); }

/* ---------- Confirmation ---------- */
.confirm-hero { text-align: center; padding: var(--space-7) 0 var(--space-5); }
.confirm-icon {
    width: 72px; height: 72px; margin: 0 auto var(--space-4); border-radius: var(--radius-pill);
    background: var(--success-soft); color: var(--success); display: flex; align-items: center; justify-content: center; font-size: 2rem;
    animation: pop var(--dur-slow) var(--ease);
}
.confirm-hero h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.confirm-hero p { color: var(--ink-3); margin-top: var(--space-2); }
.receipt { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); padding-bottom: var(--space-8); }
.receipt-head { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; margin-bottom: var(--space-3); }
.receipt-head h2 { font-size: var(--text-base); margin: 0; display: flex; gap: var(--space-2); align-items: center; }
.receipt-head span { font-size: var(--text-xs); color: var(--ink-3); }
.receipt-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; font-size: var(--text-sm); }
.receipt-row .qty { color: var(--ink-3); margin-left: var(--space-1); }
.receipt-row.total { border-top: 1px solid var(--line); margin-top: var(--space-2); padding-top: var(--space-3); font-weight: var(--weight-bold); }
.receipt-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-3); }
.grand-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: var(--weight-semibold); }
.grand-total strong { font-size: var(--text-2xl); }
.receipt-actions { display: flex; flex-direction: column; gap: var(--space-3); }
@media (min-width: 640px) { .receipt-actions { flex-direction: row; } .receipt-actions .btn { flex: 1; } }

/* ---------- Restaurant list ---------- */
.restaurant-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding-bottom: var(--space-8); }
@media (min-width: 720px) { .restaurant-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); } }
@media (min-width: 1100px) { .restaurant-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.restaurant-card { display: flex; flex-direction: column; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.restaurant-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.restaurant-media { aspect-ratio: 1 / 1; background: var(--muted); overflow: hidden; }
.restaurant-media img { width: 100%; height: 100%; object-fit: cover; }
.restaurant-info { padding: var(--space-3) var(--space-4) var(--space-4); }
.restaurant-name { font-weight: var(--weight-semibold); }
.restaurant-cuisine { font-size: var(--text-xs); color: var(--ink-3); }

/* ---------- Restaurant Discovery Grid & Cards ---------- */
.restaurant-discovery-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: var(--space-4);
    padding-bottom: var(--space-8);
}
@media (min-width: 600px) {
    .restaurant-discovery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-5);
    }
}
@media (min-width: 1024px) {
    .restaurant-discovery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-6);
    }
}
.discovery-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.discovery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
}
.discovery-cover {
    position: relative;
    height: 180px;
    background: var(--muted);
    overflow: hidden;
}
.discovery-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}
.discovery-card:hover .discovery-cover img {
    transform: scale(1.05);
}
.discovery-cover-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--ink-4);
    background: radial-gradient(circle at 50% 50%, var(--brand-soft), var(--canvas));
}
.discovery-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(28, 25, 23, 0.65) 0%, rgba(28, 25, 23, 0.1) 60%, transparent 100%);
}
.discovery-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    background: rgba(28, 25, 23, 0.85);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}
.discovery-content {
    position: relative;
    padding: var(--space-4) var(--space-5) var(--space-5);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.discovery-logo {
    position: absolute;
    top: -28px;
    left: var(--space-5);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    border: 3px solid var(--surface);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: var(--weight-bold);
    color: var(--brand);
}
.discovery-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.discovery-details {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    flex-grow: 1;
}
.discovery-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--ink);
    margin-bottom: var(--space-1);
    line-height: 1.25;
}
.discovery-cuisine {
    font-size: var(--text-sm);
    color: var(--ink-3);
    line-height: 1.4;
}
.discovery-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--brand);
    transition: gap var(--dur) var(--ease);
}
.discovery-card:hover .discovery-cta {
    gap: var(--space-3);
}

/* ---------- Standalone restaurant header ---------- */
.menu-hero { background: var(--accent); color: var(--accent-ink); }
.menu-hero-inner { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5) 0; }
.menu-hero .landing-logo { width: 64px; height: 64px; margin: 0; flex-shrink: 0; font-size: 1.5rem; border-color: rgba(255,255,255,0.7); }
.menu-hero h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.menu-hero p { opacity: 0.85; font-size: var(--text-sm); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
