/* Customer ordering app — mobile-first, portrait. Reuses css/style.css's
   :root design tokens (colors/radius/font) for the reset + palette; this
   file only lays out this app's own screens. */

html, body { height: auto; min-height: 100%; overscroll-behavior: none; }
#app { display: block; height: auto; min-height: 100vh; }

.view { display: none; }
.view.active { display: block; }

/* ── Auth ── */
/* column: the auth card and the maker's credit stack, rather than sitting
   side by side as two flex items on a row. */
#auth-view.active { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
#auth-box { width: 100%; max-width: 360px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }

/* Shop picker (shared "Arcolos Bestellen" app) — reuses the auth-card look. */
#shop-view.active { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
#shop-box { width: 100%; max-width: 360px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }
#shop-box h1 { font-size: 20px; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 8px; }
#shop-box .auth-hint { text-align: center; }
#shop-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.shop-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 16px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line, #e5e7eb); background: #fff; color: var(--navy); }
.shop-choice:hover { background: var(--navy); color: #fff; }
.shop-choice-logo { max-width: 100%; max-height: 72px; object-fit: contain; }
.shop-choice-name { font-size: 16px; font-weight: 600; }
.shop-choice-name--caption { font-size: 12px; font-weight: 600; opacity: .8; }
#auth-logo { display: block; max-height: 72px; max-width: 100%; object-fit: contain; margin: 0 auto 16px; }
#auth-box h1 { font-size: 20px; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 18px; }
.auth-tabs { display: flex; background: var(--warm); border-radius: var(--radius); padding: 3px; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px 0; border: none; background: none; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text2); cursor: pointer; }
.auth-tab.active { background: var(--navy); color: #fff; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.field input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--cream); }
.btn-primary, .btn-secondary { width: 100%; padding: 12px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; }
.btn-primary { background: var(--navy); color: #fff; margin-top: 4px; }
.btn-secondary { background: #fff; color: var(--text2); border: 1px solid var(--border); }
.link-btn { display: block; width: 100%; background: none; border: none; color: var(--navy); font-size: 12px; font-weight: 600; text-align: center; padding: 10px 0 0; cursor: pointer; }
.auth-hint { font-size: 12px; color: var(--text3); margin-bottom: 14px; line-height: 1.5; }

/* ── Show/hide password toggle (login, register, reset, delete-login) ──
   The eye button sits inside the field on the right; the input gets extra
   right padding so revealed text never runs under it. */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 40px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none; cursor: pointer;
  color: var(--text3);
}
.pw-toggle:hover { color: var(--navy); }
.pw-toggle:focus { outline: none; }
.pw-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 6px; }
.pw-toggle svg { width: 20px; height: 20px; display: block; }

/* ── Main app ── */
#topbar { background: var(--navy); color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
#shop-name { font-size: 16px; font-weight: 700; }
#topbar-actions { display: flex; gap: 8px; align-items: center; }
/* #logout-btn keeps its id for anything that still targets it; both topbar
   buttons share .topbar-btn so they stay identical. */
.topbar-btn, #logout-btn { background: rgba(255,255,255,.15); color: #fff; border: none; padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.topbar-btn:active { background: rgba(255,255,255,.3); }
#tabs { display: flex; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 52px; z-index: 9; }
#tabs .tab { flex: 1; padding: 12px 0; text-align: center; background: none; border: none; font-size: 13px; font-weight: 600; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; }
#tabs .tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.main-tab { display: none; padding: 14px 14px 90px; }
.main-tab.active { display: block; }

.menu-cat-hdr { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text3); margin: 16px 4px 8px; }
.menu-cat-hdr:first-child { margin-top: 4px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.menu-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.menu-card.sold-out { opacity: .5; }
.menu-card-emoji { font-size: 30px; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.menu-card-emoji img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.menu-card-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.menu-card-price { font-size: 13px; color: var(--text2); }
.sold-out-lbl { font-size: 11px; color: var(--red); font-weight: 600; margin-top: 4px; }
.qty-stepper { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.qty-stepper button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--cream); font-size: 16px; cursor: pointer; }
.qty-stepper span { min-width: 16px; text-align: center; font-weight: 600; font-size: 14px; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--text3); font-size: 13px; }

#cart-bar { display: none; position: fixed; left: 14px; right: 14px; bottom: 14px; background: var(--navy); color: #fff; border-radius: 12px; padding: 14px 18px; align-items: center; justify-content: space-between; box-shadow: 0 4px 16px rgba(0,0,0,.2); cursor: pointer; z-index: 20; }
#cart-bar.show { display: flex; }
.cart-cta { font-weight: 700; }

.order-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.order-card-hdr { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.order-status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.status-open { background: var(--blue-bg); color: var(--blue-fg); }
.status-ready { background: var(--green-bg); color: var(--green); }
.status-collected { background: var(--warm); color: var(--text3); }
.status-cancelled { background: var(--red-bg); color: var(--red); }
.order-card-items { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.order-card-total { font-size: 13px; font-weight: 700; text-align: right; }

/* ── Checkout modal ── */
#checkout-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; align-items: flex-end; justify-content: center; }
#checkout-overlay.show { display: flex; }
#checkout-box { background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
#checkout-hdr { background: var(--navy); color: #fff; padding: 16px 20px; font-size: 15px; font-weight: 600; }
#checkout-body { padding: 16px 20px; overflow-y: auto; }
.co-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); padding: 3px 0; }
.co-total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; padding: 10px 0; margin-bottom: 8px; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
#checkout-footer { padding: 0 20px 20px; display: flex; gap: 8px; }
#checkout-footer button { flex: 1; margin-top: 0; }

/* ── Status bar (directly under the blue topbar, above the tabs) ──
   Red = ordering is closed. Green = open, with today's hours. Empty = nothing
   configured, so no bar at all and the app looks exactly as it always did.
   Deliberately not sticky: #topbar is already sticky at top:0, so a second
   sticky element would pin to the same spot and hide behind it. */
#status-bar { display: none; padding: 9px 14px; font-size: 13px; font-weight: 600; text-align: center; }
#status-bar.closed { display: block; background: #fdecea; color: #a03027; border-bottom: 1px solid #f0c4bf; }
#status-bar.open   { display: block; background: #e8f5e9; color: #1b5e20; border-bottom: 1px solid #c5e1c8; }
/* The bar still shows the basket (nothing is lost — they can order once you
   reopen), it just can't be tapped through to checkout. */
#cart-bar.offline { background: var(--text3); cursor: default; }

/* ── Payment state on an order card ── */
.order-payment { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text2); }
.order-payment.paid { color: var(--green, #2e7d32); }
.order-payment.failed, .order-payment.expired { color: var(--red, #c0392b); }
.order-payment .link-btn { display: inline; margin-left: 4px; font-size: 12px; padding: 0; }

/* ── Payment-processing overlay (returning from Mollie) ── */
#payment-wait { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; }
#payment-wait.show { display: flex; }
#payment-wait-box { background: #fff; border-radius: 14px; padding: 26px 32px; text-align: center; font-size: 14px; font-weight: 600; max-width: 80vw; }
.payment-wait-hint { margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--text3); }
.spinner { width: 26px; height: 26px; margin: 0 auto 12px; border: 3px solid var(--border); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Order-placed success screen (after a confirmed payment) ──
   Centered like the payment-wait overlay, not a bottom sheet: it's a full-stop
   moment, and both actions (uitloggen / nieuwe bestelling) live in the card. */
#success-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 250; align-items: center; justify-content: center; padding: 20px; }
#success-overlay.show { display: flex; }
#success-box { background: #fff; width: 100%; max-width: 380px; border-radius: 16px; padding: 28px 24px; text-align: center; max-height: 88vh; overflow-y: auto; }
#success-icon { font-size: 44px; line-height: 1; margin-bottom: 10px; }
#success-title { font-size: 19px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
#success-sub { font-size: 13px; color: var(--text3); line-height: 1.5; margin-bottom: 18px; }
#success-summary { text-align: left; margin-bottom: 20px; }
#success-summary:empty { display: none; }
.success-pickup { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
#success-footer { display: flex; flex-direction: column; gap: 8px; }
#success-footer button { margin-top: 0; }

/* ── Profile prompt (shown once, right after registering) ── */
#profile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; align-items: flex-end; justify-content: center; }
#profile-overlay.show { display: flex; }
#profile-box { background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
#profile-hdr { background: var(--navy); color: #fff; padding: 16px 20px; font-size: 15px; font-weight: 600; }
#profile-body { padding: 16px 20px; overflow-y: auto; }
#profile-footer { padding: 0 20px 20px; display: flex; gap: 8px; }
#profile-footer button { flex: 1; margin-top: 0; }
#profile-body input:disabled { background: var(--warm); color: var(--text3); cursor: default; }
.field-hint { display: block; margin-top: 4px; font-size: 11px; color: var(--text3); }

/* ── Toast ── */
#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a1a1a; color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 13px; opacity: 0; transition: all .3s; z-index: 300; white-space: nowrap; pointer-events: none; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
