/* Tarabeza platform tokens.
   World: Cairo Metro bilingual wayfinding. Tables are stations, orders ride a line.
   Light default, dark mode via data-theme or OS. */

:root {
  --ground: #F1F0EC;
  --panel: #FFFEFA;
  --panel-2: #F8F6F1;
  --sunk: #E9E7E2;
  --ink: #1C1B19;
  --ink-2: #4F4C46;
  --ink-3: #66625B;
  --rule: #E2E0DA;
  --rule-strong: #CBC8C0;

  /* Line colours */
  --red: #D2361E;        /* Line 1: brand, primary action */
  --red-ink: #A3260F;
  --red-soft: #FBE3DE;
  --mustard: #E5A400;    /* Pending */
  --mustard-ink: #7A5600;
  --mustard-soft: #FCF0CC;
  --orange: #DF6512;     /* Preparing */
  --orange-ink: #9A4208;
  --orange-soft: #FCE5D3;
  --green: #1D8046;      /* Ready */
  --green-ink: #12603A;
  --green-soft: #DCF0E3;
  --charcoal: #2E2C28;   /* Accepted */
  --charcoal-soft: #E6E4DF;

  --on-red: #FFFFFF;
  --on-green: #FFFFFF;
  --on-mustard: #1C1B19;
  --focus: #D2361E;
  --shadow: 0 1px 2px rgba(28, 27, 25, .06), 0 6px 18px -6px rgba(28, 27, 25, .14);
  --shadow-lift: 0 2px 4px rgba(28, 27, 25, .08), 0 18px 40px -12px rgba(28, 27, 25, .28);
  --scrim: rgba(20, 19, 17, .45);

  --font: "Alexandria", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  --r-panel: 8px;
  --r-control: 6px;
  --bar: 4px;            /* route bar weight */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121210; --panel: #1C1B19; --panel-2: #23221F; --sunk: #0E0E0C;
    --ink: #F2F0EB; --ink-2: #BDB9B0; --ink-3: #8F8B83;
    --rule: #2E2C29; --rule-strong: #403D38;
    --red: #EF5236; --red-ink: #FF8A73; --red-soft: #3C1B14;
    --mustard: #F0B92A; --mustard-ink: #F6CF66; --mustard-soft: #36290A;
    --orange: #F27E2C; --orange-ink: #FFA566; --orange-soft: #3A2212;
    --green: #38B067; --green-ink: #6FD497; --green-soft: #112E1C;
    --charcoal: #D9D6CF; --charcoal-soft: #2A2925;
    --on-red: #FFFFFF; --on-green: #0B1A11; --on-mustard: #1C1B19; --focus: #FF8A73;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -8px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 20px 44px -12px rgba(0,0,0,.75);
    --scrim: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121210; --panel: #1C1B19; --panel-2: #23221F; --sunk: #0E0E0C;
  --ink: #F2F0EB; --ink-2: #BDB9B0; --ink-3: #8F8B83;
  --rule: #2E2C29; --rule-strong: #403D38;
  --red: #EF5236; --red-ink: #FF8A73; --red-soft: #3C1B14;
  --mustard: #F0B92A; --mustard-ink: #F6CF66; --mustard-soft: #36290A;
  --orange: #F27E2C; --orange-ink: #FFA566; --orange-soft: #3A2212;
  --green: #38B067; --green-ink: #6FD497; --green-soft: #112E1C;
  --charcoal: #D9D6CF; --charcoal-soft: #2A2925;
  --on-red: #FFFFFF; --on-green: #0B1A11; --on-mustard: #1C1B19; --focus: #FF8A73;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -8px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 20px 44px -12px rgba(0,0,0,.75);
  --scrim: rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
:lang(en) body, html[lang="en"] body { line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: var(--red); color: var(--on-red); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
input, textarea { caret-color: var(--red); }
.num, .tnum { font-variant-numeric: tabular-nums; }

* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 8px; }

[data-lucide], .ic { width: 20px; height: 20px; stroke-width: 2; flex: none; }

/* ---------- Signature: station roundel ---------- */
.roundel {
  --c: var(--red);
  --s: 44px;
  inline-size: var(--s); block-size: var(--s);
  border-radius: 50%;
  border: calc(var(--s) * .12) solid var(--c);
  display: grid; place-items: center;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  font-size: calc(var(--s) * .38);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
  flex: none;
  position: relative;
}
.roundel.filled { background: var(--c); color: var(--on-red); }

/* ---------- Signature: route line ---------- */
.route { --done: var(--ink); display: grid; grid-template-columns: repeat(var(--stops, 5), 1fr); position: relative; }
.route::before {
  content: ""; position: absolute; inset-inline: 10%; top: 9px; height: var(--bar);
  background: var(--rule-strong); border-radius: 4px;
}
.route .progress {
  position: absolute; inset-inline-start: 10%; top: 9px; height: var(--bar); border-radius: 4px;
  background: var(--line, var(--red)); width: 80%; transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform .9s var(--ease-out);
}
[dir="rtl"] .route .progress { transform-origin: right; }
.stop { display: grid; justify-items: center; gap: 6px; position: relative; text-align: center; }
.stop .dot {
  inline-size: 22px; block-size: 22px; border-radius: 50%;
  background: var(--panel); border: var(--bar) solid var(--rule-strong);
  transition: border-color .4s, background .4s, transform .4s var(--ease-out);
}
.stop.passed .dot { border-color: var(--line, var(--red)); background: var(--line, var(--red)); }
.stop.here .dot { border-color: var(--line, var(--red)); background: var(--panel); transform: scale(1.25); box-shadow: 0 0 0 6px color-mix(in srgb, var(--line, var(--red)) 18%, transparent); }
.stop .ar { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.stop .en { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.stop.here .ar, .stop.passed .ar { color: var(--ink); }

/* ---------- Status chips: colour + shape + word ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.status::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: currentColor; }
.status.pending { background: var(--mustard-soft); color: var(--mustard-ink); }
.status.accepted { background: var(--charcoal-soft); color: var(--charcoal); }
.status.preparing { background: var(--orange-soft); color: var(--orange-ink); }
.status.ready { background: var(--green-soft); color: var(--green-ink); }
.status.served { background: var(--sunk); color: var(--ink-2); }
.status.rejected { background: transparent; color: var(--red-ink); box-shadow: inset 0 0 0 1.5px var(--red); }
.status.pending::before { border-radius: 2px; transform: rotate(45deg); }
.status.rejected::before { border-radius: 0; inline-size: 9px; block-size: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: 44px; padding: 0 18px; border-radius: var(--r-control);
  border: 1.5px solid transparent; font-weight: 600; font-size: 15px;
  background: var(--panel); color: var(--ink); border-color: var(--rule-strong);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); color: var(--on-red); border-color: var(--red); }
.btn.primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn.go { background: var(--green); color: var(--on-green); border-color: var(--green); }
.btn.go:hover { filter: brightness(.92); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { min-block-size: 34px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn {
  inline-size: 40px; block-size: 40px; display: inline-grid; place-items: center;
  border-radius: var(--r-control); border: 1.5px solid var(--rule); background: var(--panel); color: var(--ink);
}
.icon-btn:hover { border-color: var(--rule-strong); background: var(--panel-2); }

.seg { display: inline-flex; background: var(--sunk); border-radius: var(--r-control); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

.demo-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--mustard-ink); background: var(--mustard-soft); padding: 2px 8px; border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
