/* LatiTech - demos.css
   Shared styles for the interactive demo pages in /demos. Builds on style.css. */

:root { --warn: #b25000; --card: #ffffff; }
@media (prefers-color-scheme: dark) { :root { --warn: #ffb340; --card: #1c1c1e; } }

.demo-main { padding: 40px 0 100px; }
.demo-main h1 { margin-top: 18px; font-size: clamp(2rem, 4.5vw, 2.75rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.demo-main .detail-lead { max-width: 40em; }

.demo-notice {
  margin-top: 20px; display: inline-flex; align-items: center; gap: 8px;
  font-size: .88rem; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 980px; padding: 6px 14px 6px 10px;
}
.demo-notice svg { width: 16px; height: 16px; flex: none; color: var(--blue); }

/* Window-style frame around each demo app (matches the "Insights" panel on the home page) */
.demo-frame {
  margin-top: 32px; background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.demo-frame .dash-title { display: flex; gap: 8px; align-items: center; }
.demo-frame .dash-title small { font-weight: 500; color: var(--ink-2); opacity: .8; }
.demo-app { padding: clamp(18px, 3vw, 32px); }

.demo-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .demo-cols { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px;
}
.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.panel h2 { display: flex; align-items: center; gap: 10px; }
.step-num {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  display: grid; place-content: center; font-size: .8rem; font-weight: 700;
  background: var(--bg-alt); color: var(--ink-2); border: 1px solid var(--line);
}
.step-num.done { background: var(--blue); color: #fff; border-color: var(--blue); }
.panel .hint { margin-top: 4px; font-size: .88rem; color: var(--ink-2); }
.sticky { position: sticky; top: 92px; }
@media (max-width: 900px) { .sticky { position: static; } }

/* Selectable option buttons */
.opt-grid { margin-top: 16px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.opt {
  font: inherit; text-align: left; color: var(--ink); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: grid; gap: 2px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.opt:hover:not(:disabled) { border-color: var(--blue); transform: translateY(-1px); }
.opt[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.opt:disabled { cursor: not-allowed; opacity: .45; }
.opt strong { font-weight: 600; }
.opt span { font-size: .85rem; color: var(--ink-2); }

.chips { margin-top: 14px; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chip {
  font: inherit; flex: none; cursor: pointer; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 12px; min-width: 62px; text-align: center; line-height: 1.2;
  transition: border-color .15s, background .15s;
}
.chip small { display: block; font-size: .72rem; color: var(--ink-2); text-transform: capitalize; }
.chip b { display: block; font-size: 1.05rem; }
.chip:hover:not(:disabled) { border-color: var(--blue); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip[aria-pressed="true"] small { color: rgba(255,255,255,.85); }
.chip:disabled { cursor: not-allowed; opacity: .4; }

.slots { margin-top: 14px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.slot {
  font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 980px; padding: 8px 6px;
  transition: border-color .15s, background .15s;
}
.slot:hover:not(:disabled) { border-color: var(--blue); }
.slot[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.slot:disabled { cursor: not-allowed; color: var(--ink-2); text-decoration: line-through; opacity: .55; }
.legend-line { margin-top: 10px; font-size: .8rem; color: var(--ink-2); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 980px; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: .86rem; cursor: pointer; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 980px; padding: 6px 14px;
  transition: background .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* Form fields */
.fields { margin-top: 16px; display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.fields .full { grid-column: 1 / -1; }
.fields label { display: grid; gap: 6px; font-size: .88rem; font-weight: 500; }
.fields input, .fields textarea { padding: 11px 14px; border-radius: 12px; }
.fields textarea { min-height: 80px; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }

/* Summary rows */
.rows { margin-top: 14px; display: grid; gap: 10px; }
.row { display: flex; justify-content: space-between; gap: 12px; font-size: .94rem; }
.row span:first-child { color: var(--ink-2); }
.row span:last-child { text-align: right; font-weight: 500; }
.row.total { padding-top: 12px; border-top: 1px solid var(--line); font-size: 1.05rem; }
.row.total span { font-weight: 700; color: var(--ink); }
.empty { margin-top: 14px; font-size: .92rem; color: var(--ink-2); }

.panel .btn { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg-alt); }

/* Confirmation / success */
.success { text-align: center; padding: 20px 0 8px; }
.success-ico {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-content: center; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok);
}
.success-ico svg { width: 30px; height: 30px; }
.success h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; justify-content: center; }
.success .code { margin-top: 6px; color: var(--ink-2); font-size: .92rem; }
.success .rows { max-width: 420px; margin: 20px auto 0; text-align: left; }
.success-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.success-actions .btn { width: auto; margin: 0; }

/* Qty stepper */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 980px; }
.qty button {
  font: inherit; width: 32px; height: 32px; border: 0; background: transparent; color: var(--blue);
  cursor: pointer; font-size: 1.1rem; line-height: 1; border-radius: 50%;
}
.qty button:hover { background: var(--bg-alt); }
.qty output { min-width: 22px; text-align: center; font-weight: 600; font-size: .92rem; }

/* Status label (always text + icon, never color alone) */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.err { color: var(--err); }
.status.info { color: var(--blue); }

.demo-main .detail-cta { margin-top: 40px; }

@media (max-width: 620px) {
  .demo-main { padding: 28px 0 72px; }
  .panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .opt, .chip, .slot { transition: none; }
}

/* ---------- Ordering demo ---------- */
.menu-list { margin-top: 18px; display: grid; gap: 10px; }
.menu-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px;
}
.menu-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); }
.menu-ico svg { width: 24px; height: 24px; }
.menu-txt { display: block; line-height: 1.35; }
.menu-txt strong { font-weight: 600; }
.menu-txt span:not(.menu-tag) { display: block; font-size: .86rem; color: var(--ink-2); margin-top: 2px; }
.menu-txt b { display: block; margin-top: 4px; font-size: .92rem; font-weight: 600; }
.menu-tag { font-size: .7rem; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); border-radius: 980px; padding: 1px 8px; vertical-align: 2px; }
.add-btn { padding: 7px 16px; font-size: .9rem; }
.cart-lines { margin-top: 14px; display: grid; gap: 10px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 70px; gap: 10px; align-items: center; font-size: .92rem; }
.cart-amt { text-align: right; font-weight: 500; }
.mini-h { margin: 18px 0 8px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.cart-fab {
  display: none; position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  font: inherit; font-weight: 600; color: #fff; background: var(--btn); border: 0; border-radius: 980px; padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); cursor: pointer;
}
@media (max-width: 900px) { .cart-fab { display: block; } }

.tracker { list-style: none; padding: 0; margin: 26px auto 14px; max-width: 560px; display: grid; grid-template-columns: repeat(4, 1fr); }
.tracker li { position: relative; display: grid; justify-items: center; gap: 8px; font-size: .82rem; color: var(--ink-2); text-align: center; }
.tracker li::before { content: ""; position: absolute; top: 8px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.tracker li:first-child::before { display: none; }
.tracker li.done::before, .tracker li.now::before { background: var(--blue); }
.tracker .dot { position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-alt); border: 2px solid var(--line); }
.tracker li.done .dot { background: var(--blue); border-color: var(--blue); }
.tracker li.now { color: var(--ink); font-weight: 600; }
.tracker li.now .dot { border-color: var(--blue); box-shadow: 0 0 0 5px color-mix(in srgb, var(--blue) 22%, transparent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--blue) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tracker li.now .dot { animation: none; } }
@media (max-width: 480px) { .menu-item { grid-template-columns: 36px minmax(0, 1fr); } .menu-ico { width: 36px; height: 36px; } .menu-act { grid-column: 2; } }

/* ---------- Dashboard demo ---------- */
.dash-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.small-btn { padding: 6px 14px; font-size: .86rem; }
.kpis { margin: 18px 0 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.kpi-l { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.kpi-v { margin-top: 4px; font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-d { margin-top: 6px; font-size: .78rem; color: var(--ink-2); }
.delta { font-weight: 600; color: var(--ink); white-space: nowrap; }
.delta.up span[aria-hidden] { color: var(--ok); }
.delta.down span[aria-hidden] { color: var(--err); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.link-btn { font: inherit; font-size: .86rem; color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.chart-box { position: relative; margin-top: 14px; }
.chart { display: block; max-width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; opacity: .6; }
.chart .base { stroke: var(--ink-2); stroke-width: 1; opacity: .5; }
.chart .axis { font-family: var(--font); font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--blue); transition: opacity .15s; }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip {
  position: absolute; top: -6px; pointer-events: none; z-index: 2;
  background: var(--ink); color: var(--bg); border-radius: 10px; padding: 6px 10px;
  font-size: .78rem; line-height: 1.3; display: grid; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tip[hidden] { display: none; }
.tip b { font-size: .92rem; }

.dash-cols { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-cols .panel + .panel { margin-top: 0; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }

.hbars { margin-top: 16px; display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: .88rem; }
.hbar-track { height: 10px; border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.hbar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.tbl-wrap { margin-top: 12px; overflow-x: auto; max-height: 340px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .76rem; font-weight: 600; color: var(--ink-2); padding: 8px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.ordered { font-size: .84rem; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
@media (max-width: 480px) { .hbar { grid-template-columns: 96px minmax(0, 1fr) 46px; } }

/* ---------- Fixes ---------- */
.step-num svg { width: 14px; height: 14px; }
.slots { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.slot { white-space: nowrap; }
.demo-cols > *, .dash-cols > *, .kpis > * { min-width: 0; }
.dash-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 900px) { .dash-cols { grid-template-columns: minmax(0, 1fr); } }
.cart-fab.hide { opacity: 0; pointer-events: none; transform: translateY(12px); }
.cart-fab { transition: opacity .2s, transform .2s; }
.inv-st { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
@media (max-width: 560px) { .tbl td, .tbl th { padding-inline: 5px; } .inv-st { justify-content: flex-start; } }
