/* Components of the owner's and the restaurant's screens: chips, switches, badges, blocks, rows with a photo, forms, the code keypad, the QR box. The customers' menu is in menu.css.
   Only tokens.css values here (no raw colours) so that both themes work and the contrast tests cover them. */

.stack { display: grid; gap: var(--s2); }
.small { font-size: var(--t-meta); }
.mono { font-family: var(--mono); }
.danger-text { color: var(--danger); }
.field-hint { color: var(--muted); font-size: var(--t-meta); }
.field-hint.wide { margin-top: var(--s1); }
.btn.icon-only { width: 48px; padding: 0; flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.select { appearance: auto; min-height: 48px; }

/* ---- chips: a toggle you tap (allergens, features, filters, starting sections) */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); font-size: var(--t-sm); font-weight: 600; color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
@media (hover: hover) { .chip:hover { filter: brightness(.97); } }

/* ---- the choice of the look of the menu (the profile): one card for each template, a group of radio buttons */
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.look-wrap { display: grid; gap: var(--s2); align-content: start; }
.look { display: grid; gap: 4px; align-content: start; text-align: left; padding: var(--s2); border-radius: var(--r-l); background: var(--surface); border: 2px solid var(--line); }
.look[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.look img, .look-none { width: 100%; aspect-ratio: 9 / 16; max-height: 260px; object-fit: cover; object-position: top; border-radius: var(--r-m); background: var(--surface-2); }
.look-none { display: grid; place-items: center; color: var(--muted); }
.look-name { padding: 0 var(--s1); font-weight: 700; }
.look-text { padding: 0 var(--s1) var(--s1); font-size: var(--t-meta); color: var(--muted); }
a.btn { text-decoration: none; }

/* ---- switch */
.switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: var(--r-pill); background: var(--border); transition: background var(--d2); }
.switch::after { content: ""; position: absolute; inset: -8px -4px; }                  /* a bigger place to tap than the drawing */
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform var(--d2) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); background: var(--accent-contrast); }
.switch[disabled] { opacity: .5; pointer-events: none; }
.switch.small { width: 46px; height: 28px; margin-left: var(--s1); }
.switch.small i { width: 22px; height: 22px; }
.switch.small[aria-checked="true"] i { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s2) 0; }
.switch-text { display: grid; gap: 2px; min-width: 0; font-weight: 600; }
.switch-text small { color: var(--muted); font-weight: 400; font-size: var(--t-meta); }

/* ---- badges */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-cap); font-weight: 700; line-height: 1.5; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---- blocks and rows of values */
.group { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.group-title { font-size: var(--t-sm); font-weight: 700; color: var(--muted); }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.copy-text { display: grid; gap: 1px; min-width: 0; }
.copy-label { font-size: var(--t-meta); color: var(--muted); }
.copy-value { font-weight: 600; overflow-wrap: anywhere; font-size: var(--t-sm); line-height: 1.35; }
.copy-value.mono { font-size: var(--t-body); }
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.actions-grid .btn { flex-direction: column; gap: var(--s1); min-height: 76px; padding: var(--s2) var(--s1); font-size: var(--t-sm); text-align: center; line-height: 1.2; }
.status-line { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.cred { display: grid; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-m); }
.cred-head { display: flex; align-items: flex-start; gap: var(--s3); }
.cred-head > div { display: grid; gap: 2px; min-width: 0; }
.cred-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.banner button { flex: none; align-self: center; }
.toolbar { display: grid; }
.row-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rest-row { align-items: flex-start; }
.rest-row .row-text { font-weight: 700; }
.rest-row > svg { margin-top: 6px; }
.list-head .head-actions { display: flex; align-items: center; gap: var(--s1); }
.event { display: grid; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.bars i { flex: 1; min-height: 4px; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .85; }
.code-big { font: 700 40px/1.1 var(--mono); letter-spacing: .08em; text-align: center; padding: var(--s5); border-radius: var(--r-l); background: var(--surface-2); user-select: all; -webkit-user-select: all; }

/* ---- the menu editor: sections and dishes */
.cat-block { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.cat-block.is-hidden { opacity: .7; }
.cat-head { display: flex; align-items: center; gap: var(--s2); }
.cat-head h2 { flex: 1; min-width: 0; font-size: var(--t-title); line-height: 1.25; overflow-wrap: anywhere; }
.cat-empty { padding: 0 var(--s1); }
.item-row { position: relative; display: flex; align-items: center; gap: var(--s2); padding-right: var(--s3); border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s3); padding: 10px 0 10px 10px; text-align: left; }
.thumb { flex: none; width: 56px; height: 56px; border-radius: var(--r-m); object-fit: cover; background: var(--surface-2); }
.thumb.none { display: grid; place-items: center; color: var(--muted); }       /* not .empty: that is the empty-state block of app.css */
.item-row.soldout .row-text { opacity: .7; }
.soldout-tag { position: absolute; top: -9px; right: var(--s3); padding: 1px 8px; border-radius: var(--r-pill); background: var(--warn-soft); color: var(--warn); font-size: 11px; font-weight: 700; }
.move { display: flex; }

/* ---- forms: a bar of actions at the bottom (part of the layout, not fixed: it stays above the keyboard by itself) */
.savebar { flex: none; display: flex; gap: var(--s2); padding: 10px calc(var(--sar) + var(--s4)) calc(10px + var(--sab)) calc(var(--sal) + var(--s4)); background: var(--bg); border-top: 1px solid var(--line); }
html[data-kb] .savebar { padding-bottom: 10px; }
.savebar .btn.block { flex: 1; }
.page > .field { max-width: 100%; }
.picker { position: relative; display: grid; align-items: end; min-height: 150px; border: 1px dashed var(--border); border-radius: var(--r-l); overflow: hidden; background: var(--surface-2); }
.picker.item { aspect-ratio: 4 / 3; min-height: 0; }
.picker.cover { aspect-ratio: 16 / 9; min-height: 0; }
.picker.logo { width: 160px; aspect-ratio: 1; min-height: 0; }
.picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker.logo img { object-fit: contain; padding: var(--s2); }
.picker-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.picker-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s2); }
.picker-actions .btn { background: var(--surface); box-shadow: var(--shadow); }
.picker.uploading::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 60%, transparent); }
.picker.uploading::before { content: ""; position: absolute; z-index: 2; top: calc(50% - 14px); left: calc(50% - 14px); width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.prices { display: grid; gap: var(--s2); }
.price-row { display: grid; grid-template-columns: 1fr 128px 36px; gap: var(--s2); align-items: center; }
.price-value { position: relative; }
.price-value .input { padding-right: 34px; text-align: right; }
.currency { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.icon-spacer { width: 36px; }
.swatches { display: flex; flex-wrap: wrap; gap: var(--s3); }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.color-custom { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: var(--t-sm); }
.color-input { width: 56px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-s); background: none; }

/* ---- the shortcut from a customer's menu to the editor (shown to the restaurant's own administrators only) */
.m-edit { position: absolute; z-index: 3; top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); background: var(--surface); color: var(--text); font-size: var(--t-sm); font-weight: 600; box-shadow: var(--shadow); }

/* ---- the QR code and the card to print */
.qr-box { display: grid; place-items: center; padding: var(--s4); border-radius: var(--r-l); background: #fff; }      /* white in both themes: a scanner needs the contrast */
.qr-img { width: min(280px, 100%); height: auto; aspect-ratio: 1; }
.printcard { display: grid; gap: var(--s3); justify-items: center; text-align: center; padding: var(--s4); border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.printcard h2 { font-size: var(--t-large); line-height: 1.2; }
.print-text { font-weight: 600; font-size: var(--t-title); }
.print-link { color: var(--muted); overflow-wrap: anywhere; }
@media print {
  html, body { background: #fff !important; overflow: visible !important; height: auto !important; }
  #app { position: static !important; height: auto !important; display: block !important; }
  #layer, .bar, .seg, .copy-row, .actions-grid, .page > p, .savebar, .toasts { display: none !important; }
  .scroll { overflow: visible !important; }
  .page { max-width: none !important; padding: 0 !important; }
  .printcard { border: 0; box-shadow: none; padding: 20mm 10mm; color: #000; background: #fff; }
  .printcard h2 { font-size: 34pt; } .print-text { font-size: 22pt; } .print-link { font-size: 14pt; color: #333; }
  .qr-box { padding: 0; } .qr-img { width: 110mm; }
}

/* ---- the code keypad: big keys, no phone keyboard */
.pin-label { font-size: var(--t-meta); font-weight: 600; color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: var(--s3); margin: var(--s1) 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); transition: background var(--d1), border-color var(--d1), transform var(--d1); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.pin-message { min-height: 22px; font-size: var(--t-sm); color: var(--danger); }
.pin-message[data-tone="info"] { color: var(--muted); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 300px; margin: 0 auto; }
.pin-key { height: 62px; border-radius: 20px; background: var(--surface-2); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; transition: transform var(--d1) var(--ease), background var(--d1); }
.pin-key:active { transform: scale(.94); background: var(--accent-soft); }
.pin-key.quiet { background: none; color: var(--muted); display: grid; place-items: center; }
.pin-pad.off, .pin-pad.working { opacity: .5; pointer-events: none; }
