/* ==========================================================================
   Squares Store — shared tokens, buttons, dialogs, toasts
   Brand colors (--brand, --brand-2, --accent) are set at runtime from
   Admin ▸ Settings ▸ Brand, so the whole site follows the logo's colors.
   ========================================================================== */
:root {
  --brand: #3B6CF6;
  --brand-2: #13B5C8;
  --accent: #F5A524;

  --bg: #070B14;
  --bg-2: #0B1120;
  --surface: #0F1729;
  --surface-2: #141E35;
  --line: rgba(148, 163, 214, .14);
  --line-2: rgba(148, 163, 214, .24);
  --text: #E8EDF8;
  --muted: #94A0BC;
  --faint: #66728F;
  --ok: #22C55E;
  --danger: #EF4444;
  --warn: #F59E0B;

  --brand-soft: color-mix(in oklab, var(--brand) 16%, transparent);
  --brand-line: color-mix(in oklab, var(--brand) 45%, transparent);
  --on-brand: #fff;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .7);

  --font: "Plus Jakarta Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Plus Jakarta Sans", system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: var(--font-ar); }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in oklab, var(--brand) 55%, transparent); }

:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons */
.btn {
  --b: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .72em 1.25em; border-radius: 12px; border: 1px solid transparent;
  background: var(--b); font-weight: 650; font-size: .95rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 70%, var(--brand-2)));
  color: var(--on-brand);
  box-shadow: 0 8px 24px -10px color-mix(in oklab, var(--brand) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { box-shadow: 0 12px 30px -10px color-mix(in oklab, var(--brand) 90%, transparent), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-wa { background: #1FAF57; color: #fff; box-shadow: 0 8px 22px -10px rgba(31,175,87,.75); }
.btn-wa:hover { background: #23BF60; }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,.04); border-color: color-mix(in oklab, var(--brand) 50%, var(--line-2)); }
.btn-soft { background: var(--brand-soft); color: color-mix(in oklab, var(--brand) 40%, #fff); border-color: var(--brand-line); }
.btn-soft:hover { background: color-mix(in oklab, var(--brand) 24%, transparent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .5em .85em; font-size: .85rem; border-radius: 10px; }
.btn-lg { padding: .95em 1.6em; font-size: 1.02rem; border-radius: 14px; }
.btn-icon { padding: .55em; border-radius: 10px; }

/* ---------- dialogs (replace alert/confirm) */
.dlg-backdrop {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 6, 14, .7); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s;
}
.dlg-backdrop.show { opacity: 1; }
.dlg {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98); transition: transform .2s;
}
.dlg-backdrop.show .dlg { transform: none; }
.dlg-title { margin: 0 0 8px; font-size: 1.15rem; }
.dlg-body { color: var(--muted); font-size: .95rem; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* ---------- toasts */
#toast-host {
  position: fixed; z-index: 1100; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: min(420px, calc(100% - 32px));
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: .92rem; opacity: 0; transform: translateY(10px); transition: .25s; width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); flex: none; }
.toast-success .toast-dot { background: var(--ok); }
.toast-error .toast-dot { background: var(--danger); }
.toast-warn .toast-dot { background: var(--warn); }

/* ---------- misc */
.logo-img { width: auto; object-fit: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.demo-ribbon {
  position: fixed; z-index: 900; bottom: 14px; inset-inline-start: 14px;
  background: color-mix(in oklab, var(--accent) 22%, var(--surface)); color: #fff;
  border: 1px solid color-mix(in oklab, var(--accent) 60%, transparent);
  font-size: .78rem; padding: 6px 12px; border-radius: 999px; font-weight: 600;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--line-2); border-top-color: var(--brand-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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