/* Clutch — glass buttons
   Same values as web/src/app/globals.css and web/src/components/ui.tsx, in plain CSS (no Tailwind).
   Theme: put class="dark" on <html> or any wrapper. Without it you get the light theme.
   Direction: works in both dir="rtl" and dir="ltr". */

/* ── Tokens ── */
:root, .light {
  --bg: #efeee9;
  --bg-a: #e3e7ea;
  --bg-b: #ece6da;
  --surface: rgb(255 255 255 / 0.72);
  --surface-2: rgb(255 255 255 / 0.92);
  --line: rgb(11 18 16 / 0.1);
  --line-strong: rgb(11 18 16 / 0.18);
  --text: #0b1210;
  --muted: rgb(11 18 16 / 0.6);
  --accent: #d7f26b;
  --accent-ink: #0b1210;
  --danger: #c8323f;
  --danger-soft: rgb(200 50 63 / 0.1);
  --shadow: 0 1px 2px rgb(11 18 16 / 0.06), 0 8px 24px -12px rgb(11 18 16 / 0.18);
}
.dark {
  --bg: #0b1210;
  --bg-a: #1b2a35;
  --bg-b: #14201b;
  --surface: rgb(255 255 255 / 0.06);
  --surface-2: rgb(255 255 255 / 0.1);
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.2);
  --text: #f3f4f1;
  --muted: rgb(243 244 241 / 0.62);
  --danger: #ff8a8a;
  --danger-soft: rgb(255 138 138 / 0.12);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 12px 32px -16px rgb(0 0 0 / 0.6);
}

/* ── The glass itself ── */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
}

/* ── Button base ── */
.btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: 600 14px/1 "IBM Plex Sans Arabic", system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform .15s, background .15s, opacity .15s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Sizes */
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-lg { height: 56px; padding: 0 24px; font-size: 15px; }

/* Variants */
.btn-glass   { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
               -webkit-backdrop-filter: blur(22px) saturate(1.2); backdrop-filter: blur(22px) saturate(1.2); }
.btn-glass:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -10px rgb(215 242 107 / .7); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger  { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }

/* Round icon button (theme, message) and the back arrow */
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-back { width: 40px; height: 40px; padding: 0; }
.btn-step { width: 44px; height: 44px; padding: 0; }
.btn-back svg { width: 20px; height: 20px; }
[dir="ltr"] .btn-back svg { transform: scaleX(-1); }

/* Small pill with icon (language) */
.btn-pill { height: 36px; padding: 0 12px; gap: 6px; font-size: 12px; }

/* Filter chip */
.chip {
  box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 0; border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line);
  font: 500 13px/1 "IBM Plex Sans Arabic", system-ui, sans-serif; white-space: nowrap; cursor: pointer; transition: background .15s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control */
.segmented { display: flex; padding: 4px; border-radius: 999px; }
.segmented button {
  flex: 1; height: 40px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--muted);
  font: 600 14px/1 "IBM Plex Sans Arabic", system-ui, sans-serif; cursor: pointer; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] { background: var(--text); color: var(--bg); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Toggle */
.toggle { position: relative; width: 48px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: all .15s; }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { inset-inline-start: 24px; background: var(--accent-ink); }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mobile tab bar */
.tabbar { display: flex; align-items: center; padding: 6px; border-radius: 999px; }
.tabbar button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font: 600 12px/1 "IBM Plex Sans Arabic", system-ui, sans-serif; cursor: pointer; transition: all .15s;
}
.tabbar button span { display: none; }
.tabbar button svg { width: 18px; height: 18px; flex: none; }
.tabbar button[aria-current="page"] { flex: 1.6; padding: 0 12px; background: var(--accent); color: var(--accent-ink); }
.tabbar button[aria-current="page"] span { display: inline; }
.tabbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .btn, .chip, .toggle, .toggle::after, .segmented button, .tabbar button { transition: none; } }
