/*
 * theme.css — FreshMart 3D. A supermarket brand: confident retail blue with a
 * sunshine-yellow spark (price tags, savings), on a cool, clean ground — closer
 * to a Walmart / DMart shop floor than a boutique. HUD panels float over a 3D
 * scene, so surfaces are crisp and shadows soft.
 */

:root {
  --canvas: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #e8eef8;
  --border: #d3dbe8;
  --border-strong: #9aa8bf;
  --ink: #0e1a2e;
  --muted: #4f5d76;
  --accent: #0a58ca;
  --accent-hover: #0846a3;
  --accent-ink: #ffffff;
  --accent-text: #0a4fb5;
  --accent-strong: #083b8a;
  --accent-soft: #dbe7fb;
  --accent-border: #a7c1ee;
  --success: #12804a;
  --success-ink: #ffffff;
  --success-soft: #dcf2e5;
  --success-strong: #0d6b3d;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #fdf0d5;
  --warning-strong: #8f4207;
  --danger: #c81e2a;
  --danger-ink: #ffffff;
  --danger-soft: #fbe1e3;
  --danger-strong: #a3141f;
  --chart-1: #0a58ca;
  --chart-2: #f2a900;
  --chart-3: #12804a;
  --chart-4: #c81e2a;
  --chart-5: #7a3fc7;
  --chart-6: #0f8fa3;

  --x-spark: #ffc220;
  --x-spark-ink: #1a1300;
  --x-hud: #ffffff;
  --x-hud-ink: #0e1a2e;

  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 800;
  --display-tracking: -0.025em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 999px;
  --radius-card: 18px;
  --radius-input: 12px;
  --btn-weight: 700;
  --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.18), 0 2px 6px -2px rgba(0, 0, 0, 0.08);
  --shadow-raised: 0 24px 60px -20px rgba(0, 0, 0, 0.35), 0 6px 16px -6px rgba(0, 0, 0, 0.15);
  --shadow-btn: 0 6px 16px -8px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] {
  --canvas: #0a1120;
  --surface: #111a2c;
  --surface-2: #19243c;
  --border: #25324d;
  --border-strong: #3b4c70;
  --ink: #eef3fb;
  --muted: #9dabc4;
  --accent: #4d8df5;
  --accent-hover: #6ea2f7;
  --accent-ink: #04101f;
  --accent-text: #86b3ff;
  --accent-strong: #b3cdff;
  --accent-soft: #14284d;
  --accent-border: #2d4b82;
  --success: #2fb36f;
  --success-ink: #03140a;
  --success-soft: #0f2b1d;
  --success-strong: #6fd6a0;
  --warning: #e08a1e;
  --warning-ink: #1a0d00;
  --warning-soft: #33230d;
  --warning-strong: #f2b766;
  --danger: #ef5560;
  --danger-ink: #1f0306;
  --danger-soft: #3a1418;
  --danger-strong: #ff9aa1;
  --chart-1: #4d8df5;
  --chart-2: #ffc220;
  --chart-3: #2fb36f;
  --chart-4: #ef5560;
  --chart-5: #a57ef0;
  --chart-6: #35c3d6;

  --x-spark: #ffc220;
  --x-spark-ink: #1a1300;
  --x-hud: #111a2c;
  --x-hud-ink: #eef3fb;
}

/* app.css — FreshMart 3D: the HUD over the 3D store, and the store manager. */

body { font-family: var(--font-body); }
.font-display { font-family: var(--font-display); font-weight: var(--display-weight); }
.spark-text { color: var(--accent-text); margin-left: 0.15em; }
.save-text { color: var(--success-strong); }

.brand-mark {
  display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: inset 0 -4px 0 var(--x-spark), var(--shadow-btn);
}
.brand-mark .icon { width: 1.5rem; height: 1.5rem; }
.brand-mark-sm { width: 2.25rem; height: 2.25rem; border-radius: 11px; }
.brand-mark-sm .icon { width: 1.15rem; height: 1.15rem; }

/* ================= 3D store ================= */
.store-body { overflow: hidden; height: 100dvh; touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
.stage { position: fixed; inset: 0; background: var(--surface-2); }
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.stage.is-looking canvas { cursor: grabbing; }
.stage.is-hovering canvas { cursor: pointer; }
.stage.is-dragging canvas { cursor: grabbing; }

.hud-glass {
  background: color-mix(in srgb, var(--x-hud) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--shadow-card);
  color: var(--x-hud-ink);
}

.hud-top {
  position: fixed; top: 0.75rem; left: 0.75rem; right: 0.75rem; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem; border-radius: 20px;
  background: color-mix(in srgb, var(--x-hud) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--shadow-card);
}
.here-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--success); margin-right: 0.15rem; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.hud-money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; padding: 0 0.6rem; font-variant-numeric: tabular-nums; }
.cart-btn { position: relative; }
.count-bubble {
  min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--x-spark); color: var(--x-spark-ink); font-size: 0.75rem; font-weight: 800;
}
.count-bubble.bump { animation: bump 450ms var(--ease-out, ease-out); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.5); } 100% { transform: scale(1); } }
.checkout-btn { background: var(--x-spark); border-color: var(--x-spark); color: var(--x-spark-ink); }
.checkout-btn:hover { background: color-mix(in srgb, var(--x-spark) 85%, black); border-color: color-mix(in srgb, var(--x-spark) 85%, black); }

.crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25); z-index: 5; pointer-events: none; }

.tip {
  position: fixed; z-index: 25; pointer-events: none; transform: translate(-50%, calc(-100% - 18px));
  padding: 0.55rem 0.8rem; border-radius: 14px; min-width: 10rem; text-align: left;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow-raised);
  font-size: 0.8rem; line-height: 1.3;
}
.tip b { display: block; font-size: 0.9rem; }
.tip .tip-price { display: flex; align-items: baseline; gap: 0.4rem; margin-top: 0.2rem; }
.tip .tip-price strong { font-size: 1.05rem; }
.tip s { color: var(--muted); }
.tip .tip-off { color: var(--success-strong); font-weight: 700; }

.drop-hint {
  position: fixed; left: 50%; bottom: 7.5rem; transform: translateX(-50%); z-index: 22;
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; border-radius: 999px;
  background: var(--x-spark); color: var(--x-spark-ink); font-weight: 700; box-shadow: var(--shadow-raised);
  animation: float 1.2s ease-in-out infinite;
}
@keyframes float { 50% { transform: translate(-50%, -6px); } }
.fly-toast {
  position: fixed; left: 50%; top: 5.5rem; transform: translateX(-50%); z-index: 30;
  padding: 0.55rem 1rem; border-radius: 999px; background: var(--success); color: var(--success-ink);
  font-weight: 700; font-size: 0.9rem; box-shadow: var(--shadow-raised); animation: toast-in 260ms ease-out both;
}

.counter-prompt {
  position: fixed; left: 50%; top: 5.5rem; transform: translateX(-50%); z-index: 21;
  display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0.6rem 0.6rem 0.75rem; border-radius: 18px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--accent-border); box-shadow: var(--shadow-raised);
  animation: pop-in 220ms ease-out both; max-width: calc(100vw - 1.5rem);
}
.kbd { font-family: var(--font-mono); font-size: 0.7rem; padding: 0 0.35rem; border-radius: 6px; background: color-mix(in srgb, var(--accent-ink) 20%, transparent); }

.minimap {
  position: fixed; left: 0.75rem; bottom: 0.75rem; z-index: 20; width: 170px; height: 170px; border-radius: 18px;
  background: color-mix(in srgb, var(--x-hud) 86%, transparent); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--shadow-card); cursor: pointer;
}
.pad {
  position: fixed; left: 50%; bottom: 0.75rem; transform: translateX(-50%); z-index: 20;
  display: grid; grid-template-columns: repeat(3, 3rem); grid-template-rows: repeat(2, 3rem); gap: 0.35rem;
}
.pad-btn {
  display: grid; place-items: center; border-radius: 14px; touch-action: none;
  background: color-mix(in srgb, var(--x-hud) 86%, transparent); color: var(--x-hud-ink);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); box-shadow: var(--shadow-card);
  transition: transform 120ms, background-color 120ms;
}
.pad-btn:active, .pad-btn.is-down { transform: scale(0.92); background: var(--accent); color: var(--accent-ink); }
.pad-btn .icon { width: 1.35rem; height: 1.35rem; }

.cart-dock {
  position: fixed; right: 0.75rem; bottom: 0.75rem; z-index: 20; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem; border-radius: 18px; min-width: 9.5rem;
  background: color-mix(in srgb, var(--x-hud) 86%, transparent); color: var(--x-hud-ink);
  border: 2px dashed transparent; box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform 180ms, border-color 180ms, background-color 180ms;
}
.cart-dock .icon { width: 1.6rem; height: 1.6rem; color: var(--accent-text); }
.cart-dock.is-target { border-color: var(--x-spark); transform: scale(1.06); }
.cart-dock.is-over { background: var(--x-spark); color: var(--x-spark-ink); transform: scale(1.12); }
.cart-dock.is-over .icon { color: var(--x-spark-ink); }

/* Loader */
.loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; overflow-y: auto;
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--x-spark) 35%, transparent), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%),
    color-mix(in srgb, var(--canvas) 92%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.loader.is-gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
.loader-card { width: min(46rem, 100%); padding: 2rem; border-radius: 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-raised); }
.hint-tile { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.8rem; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.hint-tile .icon { color: var(--accent-text); }
.hint-tile b { color: var(--ink); }

/* Dialog bits */
.modal-x { position: absolute; top: 0.6rem; right: 0.6rem; }
.product-modal { position: fixed; }
.product-art { border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; }
.product-art img { width: 100%; height: 100%; object-fit: contain; }
.mrp { text-decoration: line-through; }
.off-badge { padding: 0.15rem 0.5rem; border-radius: 8px; background: var(--x-spark); color: var(--x-spark-ink); font-weight: 800; font-size: 0.8rem; }
.off-badge:empty { display: none; }
.stepper { display: inline-flex; align-items: center; height: 3rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); }
.stepper button { width: 2.75rem; height: 100%; display: grid; place-items: center; color: var(--ink); border-radius: 999px; }
.stepper button:hover { background: var(--surface-2); }
.stepper span { min-width: 2rem; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper-sm { height: 2.1rem; }
.stepper-sm button { width: 2rem; }

.cart-list { display: grid; gap: 0.75rem; }
.cart-line { display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 0.75rem; align-items: center; padding: 0.6rem; border-radius: 14px; background: var(--surface-2); animation: fade-up 260ms ease-out both; }
.cart-line img { width: 3.5rem; height: 3.5rem; object-fit: contain; border-radius: 10px; background: var(--surface); }
.cart-line .meta { min-width: 0; }
.cart-line .meta p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-line .right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.cart-foot { display: block; }
.sum-row { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; padding: 0.15rem 0; }

.dir-list { display: grid; gap: 0.5rem; }
.dir-item { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.75rem; border-radius: 14px; background: var(--surface-2); text-align: left; transition: transform 140ms, background-color 140ms; }
.dir-item:hover { transform: translateX(4px); background: var(--accent-soft); }
.dir-swatch { width: 2.5rem; height: 2.5rem; border-radius: 10px; display: grid; place-items: center; color: white; font-weight: 800; flex-shrink: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }

.scan-screen { position: relative; border-radius: 16px; background: var(--ink); color: var(--canvas); padding: 0.75rem 1rem; height: 12rem; overflow: hidden; font-family: var(--font-mono); font-size: 0.8rem; }
.scan-list { display: grid; gap: 0.3rem; }
.scan-list li { display: flex; justify-content: space-between; gap: 1rem; animation: fade-up 200ms ease-out both; }
.scan-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-laser { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); box-shadow: 0 0 12px 2px var(--danger); top: 0; animation: laser 1.4s ease-in-out infinite alternate; opacity: 0.8; }
@keyframes laser { to { top: 100%; } }

.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: grid; gap: 0.15rem; padding: 0.85rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); height: 100%; transition: border-color 150ms, background-color 150ms; }
.choice > span .icon { color: var(--accent-text); width: 1.3rem; height: 1.3rem; }
.choice small { color: var(--muted); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { box-shadow: var(--ring); }

.done { display: grid; justify-items: center; text-align: center; gap: 0.6rem; padding: 1rem 0; }
.done-check { width: 5rem; height: 5rem; border-radius: 999px; display: grid; place-items: center; background: var(--success); color: var(--success-ink); animation: pop 600ms cubic-bezier(.2, 1.6, .4, 1) both; }
.done-check .icon { width: 2.5rem; height: 2.5rem; }
@keyframes pop { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
.done-code { font-family: var(--font-mono); font-size: 1.1rem; padding: 0.4rem 0.9rem; border-radius: 10px; background: var(--surface-2); }
.truck-lane { position: relative; width: 100%; height: 3rem; border-bottom: 2px dashed var(--border-strong); overflow: hidden; }
.truck { position: absolute; bottom: 0.25rem; left: -3rem; color: var(--accent-text); animation: drive 3.2s ease-in-out infinite; }
.truck .icon { width: 2.2rem; height: 2.2rem; }
@keyframes drive { to { left: 100%; } }

@media (width < 40rem) {
  .hud-top { top: 0.5rem; left: 0.5rem; right: 0.5rem; padding: 0.4rem; border-radius: 16px; }
  .hud-money { padding: 0 0.25rem; }
  .minimap { width: 110px; height: 110px; left: 0.5rem; bottom: 0.5rem; }
  .pad { grid-template-columns: repeat(3, 2.75rem); grid-template-rows: repeat(2, 2.75rem); bottom: 0.5rem; }
  .cart-dock { min-width: 0; padding: 0.6rem; right: 0.5rem; bottom: 0.5rem; }
  .cart-dock > div { display: none; }
  .loader-card { padding: 1.25rem; }
  .counter-prompt { flex-direction: column; align-items: stretch; }
}

html.reduced-motion .drop-hint, html.reduced-motion .scan-laser, html.reduced-motion .truck, html.reduced-motion .here-dot { animation: none; }

/* ================= Store manager ================= */
.admin-shell { display: grid; grid-template-columns: 16rem 1fr; min-height: 100vh; }
.admin-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 0.75rem; padding: 1.25rem 1rem; background: var(--surface); border-right: 1px solid var(--border); }
.side-label { margin-top: 1rem; padding: 0 0.5rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--eyebrow-tracking); color: var(--muted); }
.side-nav { display: grid; gap: 0.25rem; }
.side-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.75rem; border-radius: 12px; color: var(--muted); font-weight: 600; transition: background-color 140ms, color 140ms; }
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.side-count { font-size: 0.75rem; padding: 0 0.45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.side-link.is-active .side-count { background: var(--accent); color: var(--accent-ink); }
.admin-main { min-width: 0; padding: 2rem; max-width: 84rem; }
.stat-tile { display: flex; align-items: center; gap: 1rem; }
.stat-tile > * + * { margin-top: 0; }
.stat-ic { width: 2.75rem; height: 2.75rem; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex-shrink: 0; }
.chips { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; scrollbar-width: thin; }
.chips .chip { flex-shrink: 0; }
.sec-dot { width: 0.6rem; height: 0.6rem; border-radius: 999px; }
.pack-swatch { width: 2.5rem; height: 2.5rem; border-radius: 10px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
tr.is-off { opacity: 0.55; }
.color-input { padding: 0.25rem; cursor: pointer; }
.section-card { position: relative; overflow: hidden; }
.section-band { margin: calc(var(--card-pad, 1.5rem) * -1) calc(var(--card-pad, 1.5rem) * -1) 1rem; padding: 0.6rem 1.25rem; color: white; font-weight: 800; letter-spacing: 0.04em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.ad-preview { position: relative; display: grid; gap: 0.25rem; padding: 1.5rem; border-radius: 18px; min-height: 11rem; align-content: end; color: white; overflow: hidden; box-shadow: var(--shadow-card); }
.ad-preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), transparent 45%, rgba(0, 0, 0, 0.35)); }
.ad-preview > * { position: relative; }
.ad-live { position: absolute; top: 1rem; left: 1rem; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
.ad-title { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; letter-spacing: -0.02em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.ad-sub { opacity: 0.92; }
.ad-del { position: absolute; top: 1rem; right: 1rem; background: rgba(0, 0, 0, 0.35); border-color: transparent; color: white; }
.ad-del:hover { background: rgba(0, 0, 0, 0.55); border-color: transparent; }
.order-items { display: grid; gap: 0.25rem; padding: 0.75rem 1rem; border-radius: 12px; background: var(--surface-2); font-size: 0.9rem; }
.order-items li { display: flex; justify-content: space-between; gap: 1rem; }
.order-status { width: auto; height: 2rem; font-size: 0.85rem; }

@media (width < 56rem) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: nowrap; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0.75rem; }
  .side-label { display: none; }
  .side-nav { display: flex; gap: 0.25rem; }
  .side-link { white-space: nowrap; padding: 0.5rem 0.7rem; }
  .side-link .side-count { display: none; }
  .admin-side > .btn { margin-top: 0; width: auto; margin-left: auto; flex-shrink: 0; }
  .admin-main { padding: 1.25rem; }
}
