@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Tajawal:wght@400;500;700&display=swap');

/* Theme colours. These are the "Gold noir" defaults; each salon's /theme.css
   overrides them (generated by src/theme.js — keep the variable names in sync). */
:root {
  --bg: #0e0d11;
  --text: #f5f1ea;
  --muted: #a89e8e;
  --faint: #8b857c;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --line-3: rgba(255, 255, 255, 0.24);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.08);
  --glass-3: rgba(255, 255, 255, 0.12);
  --card-top: rgba(255, 255, 255, 0.065);
  --card-bottom: rgba(255, 255, 255, 0.025);
  --field: rgba(0, 0, 0, 0.25);
  --sheet-top: #221e22;
  --sheet-bottom: #121116;
  --toast-bg: #24222a;
  --option-bg: #17161c;
  --ticket-bg: #181619;
  --backdrop: rgba(5, 5, 8, 0.6);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --accent: #e6a85a;
  --accent-text: #eec28c;
  --accent-rgb: 230, 168, 90;
  --on-accent: #1b1208;
  --grad-1: #f7dba8;
  --grad-2: #e6a85a;
  --grad-3: #e2789c;
  --grad: linear-gradient(135deg, #f7dba8 0%, #e6a85a 48%, #e2789c 100%);
  --grad-soft: linear-gradient(135deg, rgba(247, 219, 168, 0.18), rgba(226, 120, 156, 0.14));
  --glow-1: rgba(230, 168, 90, 0.2);
  --glow-2: rgba(226, 120, 156, 0.16);
  --glow-3: rgba(226, 190, 120, 0.12);
  --free: #3ddc97;
  --free-text: #9ef0c8;
  --free-bg: rgba(61, 220, 151, 0.10);
  --free-line: rgba(61, 220, 151, 0.28);
  --few: #f7b84b;
  --few-text: #ffd690;
  --few-bg: rgba(247, 184, 75, 0.12);
  --few-line: rgba(247, 184, 75, 0.35);
  --full: #f2706d;
  --full-text: #ffb0ae;
  --full-bg: rgba(242, 112, 109, 0.12);
  --full-line: rgba(242, 112, 109, 0.38);
  --done: #7dd3fc;
  --done-text: #bfe8ff;
  --done-bg: rgba(125, 211, 252, 0.10);
  --done-line: rgba(125, 211, 252, 0.30);
  --walk-text: #c7c2ff;
  --walk-bg: rgba(140, 130, 255, 0.10);
  --walk-line: rgba(140, 130, 255, 0.35);
  /* Older names, still used by the admin and landing pages. */
  --gold: var(--accent);
  --gold-soft: var(--accent-text);
  --prog: var(--few);
  --prog-text: var(--few-text);
  --prog-bg: var(--few-bg);
  --prog-line: var(--few-line);

  --radius: 22px;
  --radius-sm: 14px;
  /* Tajawal draws the Arabic letters; browsers only download it on pages that have Arabic text. */
  font-family: 'Outfit', 'Tajawal', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(55rem 38rem at 8% -12%, var(--glow-1), transparent 60%),
    radial-gradient(48rem 36rem at 108% 8%, var(--glow-2), transparent 60%),
    radial-gradient(42rem 30rem at 50% 115%, var(--glow-3), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(560px, 100% - 32px); }

/* ---------- Header ---------- */
.top { padding: 26px 0 8px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  width: 46px; height: 46px; border-radius: 15px; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent);
  box-shadow: 0 10px 30px -8px rgba(var(--accent-rgb), 0.6);
}
.logo svg { width: 24px; height: 24px; }
.logo.has-img { background: #fff; padding: 4px; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--free-bg); border: 1px solid var(--free-line);
  color: var(--free-text); font-size: 13px; font-weight: 500;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--free); position: relative; }
.live i::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--free); animation: ping 1.8s ease-out infinite;
}
.live.off { background: var(--full-bg); border-color: var(--full-line); color: var(--full-text); }
.live.off i { background: var(--full); }
.live.off i::after { display: none; }

/* ---------- Cards ---------- */
/* minmax(0, 1fr): a wide row inside a card (the date strip, the load chart) must scroll
   inside the card, never widen the page — a wider page makes phones zoom everything out. */
main { padding: 12px 0 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.card { min-width: 0; }
.card {
  position: relative;
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
main > .card:nth-child(2) { animation-delay: 0.06s; }
main > .card:nth-child(3) { animation-delay: 0.12s; }
main > .card:nth-child(4) { animation-delay: 0.18s; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); margin: 6px 0; }
.error { color: var(--full-text); font-size: 14px; min-height: 1.2em; margin: 6px 0 0; }
/* A gentle "are you sure?" box (full slot, second booking the same day). */
.bk-warn {
  margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px;
  color: var(--full-text); background: var(--full-bg); border: 1px solid var(--full-line);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--glass-2);
  font-weight: 500; font-size: 15px; white-space: nowrap; text-decoration: none; color: inherit;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { background: var(--glass-3); border-color: var(--line-3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary {
  background: var(--grad); color: var(--on-accent); border-color: transparent; font-weight: 600;
  box-shadow: 0 10px 28px -10px rgba(var(--accent-rgb), 0.75);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 14px 32px -10px rgba(var(--accent-rgb), 0.9); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.danger { color: var(--full-text); }
.btn.danger:hover { background: var(--full-bg); border-color: var(--full-line); }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Form fields ---------- */
label.field { display: grid; gap: 7px; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--line-2); background: var(--field); color: var(--text);
  font-size: 16px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { height: auto; min-height: 110px; padding: 12px 16px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18);
}
.field select option { background: var(--option-bg); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Dialog (bottom sheet on phones) ---------- */
dialog {
  border: 1px solid var(--line-2); border-radius: 26px; padding: 0;
  width: min(480px, 100% - 24px); max-height: calc(100vh - 32px);
  background: linear-gradient(180deg, var(--sheet-top), var(--sheet-bottom)); color: var(--text);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.6);
}
dialog[open] { animation: sheet 0.35s cubic-bezier(0.2, 0.9, 0.2, 1); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(6px); }
.sheet { padding: 26px; display: grid; gap: 16px; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 600; }
.sheet .sub { margin: -10px 0 0; color: var(--muted); }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }
@media (max-width: 600px) {
  dialog { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 26px 26px 0 0; border-bottom: 0; }
  dialog[open] { animation: sheet-up 0.35s cubic-bezier(0.2, 0.9, 0.2, 1); }
}

/* ---------- Tokens ---------- */
.token {
  display: inline-grid; place-items: center; flex: none;
  min-width: 52px; height: 40px; padding: 0 10px; border-radius: 12px;
  font-weight: 600; font-size: 16px; letter-spacing: 0.02em;
  background: var(--glass-2); border: 1px solid var(--line-2);
}
.token.in_progress { background: var(--prog-bg); border-color: var(--prog-line); color: var(--prog-text); }
.token.done { background: var(--done-bg); border-color: var(--done-line); color: var(--done-text); }
.token.no_show, .token.cancelled { color: var(--faint); text-decoration: line-through; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 13px 20px; border-radius: 14px; max-width: calc(100% - 32px);
  background: var(--toast-bg); color: var(--text); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--full-line); }

/* ---------- Appearance editor (owner dashboard and admin panel) ---------- */
.te { display: grid; gap: 18px; }
.te-label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.te-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.te-preset {
  display: grid; gap: 6px; justify-items: center; padding: 10px 6px; border-radius: 14px; cursor: pointer;
  background: var(--glass); border: 1.5px solid var(--line); font-size: 12px; color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.te-preset:hover { border-color: var(--line-3); }
.te-preset[aria-pressed='true'] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.te-sw { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(128, 128, 128, 0.35); }
.te-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.te-row input[type='color'] {
  width: 46px; height: 36px; padding: 2px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--field); cursor: pointer;
}
.te-row input[type='color']:disabled { opacity: 0.35; cursor: default; }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); gap: 4px; }
.seg button {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--muted);
}
.seg button[aria-pressed='true'] { background: var(--glass-3); color: var(--text); font-weight: 500; }
.te-logo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.te-logo .logo { width: 52px; height: 52px; }
.te-logo input[type='file'] { display: none; }

/* ---------- Touch and phones (almost every customer is on a phone) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, .slot, .date, summary, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.text-toggle {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--glass-2);
  font-weight: 700; font-size: 18px; letter-spacing: -0.02em;
}
.text-toggle[aria-pressed='true'] { background: var(--grad); color: var(--on-accent); border-color: transparent; }
/* EN | عربي switch: shows the other language's name. */
.lang-toggle { width: auto; min-width: 46px; padding: 0 12px; font-size: 16px; letter-spacing: 0; }
.lang-toggle:lang(ar) { font-family: 'Tajawal', system-ui, sans-serif; font-size: 17px; }

/* Text-style button (Forgot password?, Back to login). */
.link-btn {
  background: none; border: 0; padding: 10px 6px; margin-top: 4px; cursor: pointer; font: inherit; font-size: 15px;
  color: var(--gold-soft, var(--accent)); text-decoration: underline; text-underline-offset: 3px; min-height: 44px;
}
.link-btn:hover { color: var(--text); }
.forgot-step { width: 100%; display: grid; justify-items: center; gap: 6px; }
.forgot-sent b { font-size: 18px; }

/* ---------- Arabic (right to left) ---------- */
[dir='rtl'] body { font-family: 'Tajawal', 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
/* Letter spacing and capitals break Arabic letters apart. */
[dir='rtl'] * { letter-spacing: 0 !important; }
/* Arrows point the way of reading. */
[dir='rtl'] #prevDay, [dir='rtl'] #nextDay, [dir='rtl'] #prevMonth, [dir='rtl'] #nextMonth { transform: scaleX(-1); }
/* Emails, phone numbers, web addresses, and code read left to right in any language. */
[dir='rtl'] input[type='email'], [dir='rtl'] input[type='tel'], [dir='rtl'] input[inputmode='tel'],
[dir='rtl'] input[type='url'], [dir='rtl'] .code-box, [dir='rtl'] .slug-input, [dir='rtl'] .find-input { direction: ltr; }


@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrap, .narrow { width: calc(100% - 24px); }
  .top { padding: max(18px, env(safe-area-inset-top)) 0 6px; }
  .brand { gap: 12px; }
  .brand h1 { font-size: 22px; line-height: 1.2; }
  .brand p { font-size: 15px; }
  .logo { width: 50px; height: 50px; border-radius: 16px; }
  main { gap: 14px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .card { padding: 18px 16px; border-radius: 20px; }
  .card-head { margin-bottom: 14px; align-items: center; }
  .card h2 { font-size: 20px; }
  .eyebrow { font-size: 14px; letter-spacing: 0.1em; }
  .small { font-size: 15px; }
  .error { font-size: 16px; }

  .btn { height: 54px; font-size: 17px; border-radius: 16px; }
  .btn.sm { height: 46px; font-size: 16px; padding: 0 16px; border-radius: 13px; }
  .live { font-size: 14px; padding: 7px 12px; }

  label.field { font-size: 16px; gap: 8px; }
  .field input, .field select, .field textarea { height: 56px; font-size: 18px; border-radius: 16px; }
  .field textarea { font-size: 17px; }
  .check { font-size: 17px; }
  .check input { width: 24px; height: 24px; }
  .grid-2 { grid-template-columns: 1fr; }

  .sheet { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); gap: 18px; }
  .sheet h2 { font-size: 24px; }
  .sheet .sub { font-size: 16px; }
  dialog { max-height: calc(100vh - 12px); }

  .token { min-width: 56px; height: 44px; font-size: 18px; }
  .toast { font-size: 16px; padding: 15px 20px; bottom: calc(20px + env(safe-area-inset-bottom)); }

  .te-label { font-size: 16px; }
  .te-preset { font-size: 14px; padding: 12px 6px; }
  .seg button { padding: 11px 14px; font-size: 15px; }
}

/* "A+" larger text: scales the whole page up, remembered per phone. */
html.text-lg body { zoom: 1.15; min-height: calc(100vh / 1.15); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2); opacity: 0; } }
@keyframes sheet { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shimmer { to { background-position: 200% center; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- "Add to your website" codes (owner and admin) ---------- */
.embed-dialog { width: min(560px, 100% - 24px); }
.embed-tabs { justify-self: start; }
.embed-pane { display: grid; gap: 10px; }
.embed-pane p { margin: 0; line-height: 1.55; font-size: 15px; }
.embed-pane code { font-size: 13px; padding: 1px 5px; border-radius: 6px; background: var(--glass-2); }
.code-box {
  width: 100%; resize: none; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--field); color: var(--accent-text); line-height: 1.6;
  font: 13px/1.6 ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.code-box + .btn { justify-self: start; }
@media (max-width: 600px) {
  .embed-dialog { width: 100%; }
  .embed-pane p { font-size: 16px; }
  .code-box { font-size: 14px; }
  .code-box + .btn { justify-self: stretch; }
}

/* ---------- Services editor (owner and admin) ---------- */
.svc-list { display: grid; gap: 10px; }
.svc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 120px auto 40px; gap: 8px; align-items: center;
  padding: 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
}
.svc-row input, .svc-row select {
  height: 44px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--field); color: var(--text); font-size: 15px; min-width: 0; outline: none;
}
.svc-row input:focus, .svc-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.svc-row select option { background: var(--option-bg); }
.svc-price { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.svc-min { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.svc-min input { width: 100%; -moz-appearance: textfield; }
.svc-min input::-webkit-inner-spin-button { opacity: 0.4; }
.svc-price input { width: 100%; }
.svc-overlap { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.svc-overlap input { width: 20px; height: 20px; accent-color: var(--accent); }
.svc-remove { width: 40px; height: 40px; font-size: 20px; }
.svc-add { justify-self: start; margin-top: 4px; }
.svc-help { margin: 4px 0 0; line-height: 1.5; }
dialog.wide-sheet { width: min(720px, 100% - 24px); }
@media (max-width: 640px) {
  .svc-row { grid-template-columns: 1fr 1fr 40px; }
  .svc-name { grid-column: 1 / 3; }
  .svc-remove { grid-column: 3; grid-row: 1; }
  .svc-overlap { grid-column: 1 / -1; font-size: 15px; }
  .svc-row input, .svc-row select { height: 48px; font-size: 16px; }
}

/* ---------- Choice chips (start sheet: chair and staff) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  min-height: 46px; padding: 8px 14px; border-radius: 13px; cursor: pointer; text-align: start;
  border: 1.5px solid var(--line-2); background: var(--glass); color: var(--text); font-size: 15px; font-weight: 500;
  display: grid; gap: 1px;
}
.chip-btn small { font-size: 12px; font-weight: 400; color: var(--muted); }
.chip-btn[aria-pressed='true'] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }
.chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }
