@import url("responsive-runtime.css");

/* ═══════════════════════════════════════════════════════════════════
   theme-core.css — light / dark foundation for the admin + POS side
   ───────────────────────────────────────────────────────────────────
   Every screen we convert pulls its colours from these variables, so
   the palette lives in one file instead of being repeated per page.

   Palettes match the storefront:
     light → white surfaces, #00312f as the brand ink
     dark  → black surfaces, orange accent, white reserved for text
   ═══════════════════════════════════════════════════════════════════ */

:root,
[data-theme="light"] {
  --sp-bg:        #f4f7f6;
  --sp-bg2:       #ffffff;
  --sp-card:      #ffffff;
  --sp-card2:     #eef3f2;
  --sp-border:    rgba(0,49,47,.11);
  --sp-border2:   rgba(0,49,47,.20);

  --sp-text:      #07201f;
  --sp-text-soft: #5b6b6a;
  --sp-muted:     #8a9a99;

  --sp-accent:    #00312f;
  --sp-accent-2:  #015450;
  --sp-on-accent: #ffffff;
  --sp-accent-soft: rgba(0,49,47,.09);

  --sp-shadow:    0 2px 14px rgba(0,49,47,.08);
  --sp-shadow-lg: 0 18px 48px rgba(0,49,47,.14);
  --sp-glow:      0 0 40px rgba(0,49,47,.18);

  --sp-r:   12px;
  --sp-r2:  20px;
  --sp-ease:   cubic-bezier(.4,0,.2,1);
  --sp-spring: cubic-bezier(.22,1.2,.36,1);

  color-scheme: light;
}

[data-theme="dark"] {
  --sp-bg:        #000000;
  --sp-bg2:       #0a0a0a;
  --sp-card:      #101010;
  --sp-card2:     #171717;
  --sp-border:    rgba(255,255,255,.10);
  --sp-border2:   rgba(255,255,255,.19);

  --sp-text:      #f5f5f5;
  --sp-text-soft: #9a9a9a;
  --sp-muted:     #6d6d6d;

  --sp-accent:    #ff8a1f;
  --sp-accent-2:  #ff6a00;
  --sp-on-accent: #0d0d0d;
  --sp-accent-soft: rgba(255,138,31,.12);

  --sp-shadow:    0 2px 16px rgba(0,0,0,.6);
  --sp-shadow-lg: 0 18px 52px rgba(0,0,0,.7);
  --sp-glow:      0 0 44px rgba(255,138,31,.26);

  color-scheme: dark;
}

/* ── Theme toggle (injected by js/theme-core.js) ─────────────────── */
.sp-toggle {
  position: relative;
  width: 58px; height: 30px; padding: 0;
  border-radius: 999px;
  border: 1px solid var(--sp-border2);
  background: var(--sp-card2);
  cursor: pointer; flex-shrink: 0;
  transition: background .25s, border-color .25s;
}
.sp-toggle:hover { border-color: var(--sp-accent); }
.sp-toggle .sp-knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sp-accent), var(--sp-accent-2));
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  transition: left .3s var(--sp-spring);
}
[data-theme="dark"] .sp-toggle .sp-knob { left: 31px; }
.sp-toggle .sp-knob svg {
  width: 13px; height: 13px;
  stroke: var(--sp-on-accent); fill: none; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Touch targets on an Android POS are fingers, not a mouse. */
@media (pointer: coarse) {
  .sp-toggle { width: 66px; height: 36px; }
  .sp-toggle .sp-knob { width: 28px; height: 28px; }
  [data-theme="dark"] .sp-toggle .sp-knob { left: 35px; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-toggle, .sp-toggle .sp-knob { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   TOGGLE PLACEMENT
   ───────────────────────────────────────────────────────────────────
   The slots sit inside two headers that were built long before this
   existed, so the button has to fit their spacing rather than the other
   way round.
   ═══════════════════════════════════════════════════════════════════ */

.tb-theme, .pos-theme { display: inline-flex; align-items: center; flex-shrink: 0; }
.tb-theme  { margin-right: 10px; }
.pos-theme { margin-right: 4px; }

/* The POS header is dark whatever the theme, so a light-mode toggle
   would vanish into it — give it its own contrast there. */
.pos-theme .sp-toggle {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
}
.pos-theme .sp-toggle:hover { border-color: rgba(255,255,255,.34); }

@media (max-width: 640px) {
  .tb-theme { margin-right: 7px; }
  .tb-theme .sp-toggle, .pos-theme .sp-toggle { width: 48px; height: 26px; }
  .tb-theme .sp-knob, .pos-theme .sp-knob { width: 20px; height: 20px; }
  [data-theme="dark"] .tb-theme .sp-knob,
  [data-theme="dark"] .pos-theme .sp-knob { left: 25px; }
}
