/*
 * Samirla Community Marketplace - shared styles for the customer site.
 *
 * Design tokens and component shapes come straight off the design canvas
 * (design/*.dc.html). This file exists so five pages that repeat the same
 * card, chip, button and banner do not each redefine them, and so the
 * operator UI (workstream D) gets the same tokens without redoing the work.
 * Fonts are loaded per page with a <link>, not from here, per the front-end
 * conventions in CONTRACT.md.
 */

:root {
  --bg: #FAF8F3;
  --panel: #FFFFFF;
  --panel2: #F2EDE3;
  --line: #E9E2D5;
  --text: #241F1A;
  --muted: #73695B;
  --accent: #6B4F2E;
  --accent-dark: #4A351D;
  --green: #4E6A38;
  --green-bg: #EDF2E7;
  --green-text: #3D5A2C;
  --terracotta: #B0532E;
  --terracotta-bg: #FBEDE7;
  --terracotta-line: #EFD3C6;
  --gold: #A07338;
  --gold-bg: #F6EFE0;
  --warn-bg: #FBF1E4;
  --warn-line: #EBD9BE;
  --quiet-line: #D9CDB6;
  --quiet-text: #C5B99F;
  --disabled-icon: #A09079;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

button { font-family: inherit; }

/* Numerals that must not jitter as digits change: prices, counts, codes. */
.tnum { font-variant-numeric: tabular-nums; }

.serif { font-family: 'Fraunces', Georgia, serif; }

img, svg { max-width: 100%; }

/* Fluid mobile-first: 390px design width, centred and capped on wider glass. */
.screen {
  min-height: 100%;
  background: var(--bg);
  padding: 0 0 28px;
  max-width: 560px;
  margin: 0 auto;
}

/* ── Header bar (back arrow + title), reused on every screen but the first ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-back {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.topbar-back:hover { background: var(--panel2); }
.topbar-title-group { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.topbar-title { font-family: 'Fraunces', Georgia, serif; font-size: 16px; font-weight: 600; }
.topbar-subtitle { font-size: 12px; color: var(--muted); }

/* ── Buttons ── */
.btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #FFFFFF;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-secondary:not(:disabled):hover { background: var(--panel2); }
.btn-quiet {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  height: 44px;
}

.stepper-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.card-shadow { box-shadow: 0 4px 12px rgba(36, 31, 26, .07); }
.card-pad { padding: 16px; }
.card-pad-lg { padding: 20px; }

/* ── Chips (size selection) ── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.size-chip {
  flex: 1 1 0;
  height: 62px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}
.size-chip .code { font-size: 14px; font-weight: 600; }
.size-chip .price { font-size: 11px; opacity: .72; }
.size-chip.is-active {
  background: var(--accent);
  color: #FFFFFF;
  border: 1.5px solid var(--accent);
}

/* ── Segmented control (which door you are signing in through) ── */
.segment {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.segment-item {
  flex: 1 1 0;
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.segment-item.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(36, 31, 26, .1);
}

/* ── Badges / pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-lg { padding: 6px 11px; font-size: 12.5px; }
.pill-green { background: var(--green-bg); color: var(--green-text); }
.pill-neutral { background: var(--panel2); color: var(--muted); }
.pill-gold { background: var(--gold-bg); color: var(--gold); }
.pill-ribbon {
  padding: 7px 16px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}

/* ── Inputs ── */
.field-label { font-size: 14px; font-weight: 600; }
.input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
}
.input:focus, .size-chip:focus-visible,
.btn:focus-visible, .stepper-btn:focus-visible, .topbar-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.input::placeholder { color: var(--muted); }

/* ── Progress bar ── */
.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--panel2);
  overflow: hidden;
}
.progress-track.lg { height: 8px; }
.progress-fill { height: 100%; background: var(--accent); }

/* ── Banners ── */
.banner {
  border-radius: 13px;
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner-note { background: var(--panel2); }
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.banner-warn .title { font-size: 14px; font-weight: 600; color: var(--accent); }
.banner-warn .body { font-size: 13px; color: var(--muted); }
.banner-error { background: var(--terracotta-bg); border: 1px solid var(--terracotta-line); color: #8A6455; }
.banner-error strong { font-weight: 600; color: var(--accent); }

/* ── Loading / empty / error states ── */
.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid var(--panel2);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 528px;
  margin: 0 auto;
  background: var(--text);
  color: #FFFFFF;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(36, 31, 26, .22);
  z-index: 50;
}
.toast.is-error { background: var(--terracotta); }

.opacity-muted { opacity: .62; }
.opacity-quiet { opacity: .55; }

/* ── Shared layout utilities ──────────────────────────────────
   Added for the payment, collect and operator screens. Small, composable
   pieces rather than per-page classes, so every screen that shows a label
   beside a figure lines up the same way. */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}
.row-top { align-items: flex-start; }

.muted { color: var(--muted); }
.strong { font-weight: 600; }
.small { font-size: 12.5px; }
.green { color: var(--green); }
.accent { color: var(--accent); }
.terracotta { color: var(--terracotta); }

.divider {
  height: 1px;
  background: var(--panel2);
  margin: 12px 0;
}

.amount {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.1;
  margin-top: 2px;
}
.total { font-size: 20px; font-weight: 700; }

/* The pickup code is the one thing read aloud across a counter, so it is
   sized to be legible at arm's length and spaced so characters cannot run
   together. */
.pickup-code { display: flex; align-items: center; gap: 16px; }
.pickup-code > :first-child { flex: 1 1 auto; }
.code { font-size: 30px; font-weight: 700; letter-spacing: 3px; }
.code-lg { font-size: 58px; font-weight: 700; letter-spacing: 9px; line-height: 1.15; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
  padding: 26px 18px;
  border: 1.5px dashed var(--quiet-line);
  border-radius: 14px;
  background: #FDFBF7;
  cursor: pointer;
  text-align: center;
}

.photo-frame {
  margin-top: 12px;
  height: 132px;
  border-radius: 12px;
  background: var(--panel2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #A09079;
  overflow: hidden;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

/* A two-column figure grid, used by the operator overview. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 17px; }
.tile-value { font-size: 27px; font-weight: 700; letter-spacing: -.6px; line-height: 1.2; margin-top: 4px; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--panel2);
}
.list-item:last-child { border-bottom: none; }
.list-item-body { flex: 1 1 auto; min-width: 0; }

.btn-row { display: flex; gap: 9px; margin-top: 14px; }
.btn-row > * { flex: 1 1 0; }

.section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  margin: 18px 0 13px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--gold);
}

.big-number { font-size: 38px; font-weight: 700; letter-spacing: -1px; line-height: 1; }

/* ── Account sheet ────────────────────────────────────────────
   Where a customer switches between shopping and whichever console their
   roles let them open. A sheet rather than a dropdown: it is reachable with
   a thumb, which is how every neighbour in the pilot will open it. */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 26, .38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  padding: 8px 0 14px;
  box-shadow: 0 -8px 30px rgba(36, 31, 26, .2);
}
.sheet-head { padding: 12px 20px 10px; border-bottom: 1px solid var(--panel2); }
.sheet-item {
  display: block;
  width: 100%;
  padding: 15px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--panel2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item:hover { background: var(--panel2); }
.sheet-item-quiet { color: var(--muted); font-weight: 500; }

/* Several blocks here are display:flex or display:grid, which beat the
   `hidden` attribute's default display:none. Without this, hiding a loading
   or error block by setting `.hidden = true` silently does nothing. */
[hidden] { display: none !important; }
