/* Design tokens — derived from the UI/UX Pro Max recommendation
   (Dark Mode OLED + "cinema dark / play red"), adapted for Arabic RTL. */
:root {
  --bg: #000000;
  --surface: #0c0c0d;
  --surface-2: #161618;
  --line: #26262b;
  --line-strong: #3a3a42;
  --text: #f8fafc;
  --text-2: #c9ced6;
  --muted: #94a3b8;
  --rec: #e11d48;
  --rec-soft: rgba(225, 29, 72, .14);
  --ok: #22c55e;
  --indigo: #1e1b4b;

  --font-display: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  --font-latin: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --z-header: 20;
  --z-overlay: 40;
  --z-toast: 50;
  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-body);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .6rem 1.3rem;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; text-decoration: none; font-weight: 500;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { border-color: var(--text); }
.btn--solid { background: var(--text); color: #000; border-color: var(--text); }
.btn--solid:hover { background: #fff; }
.btn--rec { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn--rec:hover { background: #f0305a; border-color: #f0305a; }
.btn--ghost { border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn--sm { min-height: 36px; padding: .3rem .9rem; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.icon-btn:hover { border-color: var(--text); }

/* REC dot */
.rec-dot {
  display: inline-block; width: .55em; height: .55em; border-radius: 50%;
  background: var(--rec); box-shadow: 0 0 10px rgba(225, 29, 72, .7);
  animation: rec 1.6s steps(2, jump-none) infinite;
}
@keyframes rec { 50% { opacity: .25; } }

/* forms */
.field { display: grid; gap: .4rem; }
.field > span { font-size: .9rem; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .7rem .95rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .2s var(--ease);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.7; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--text); }
.input::placeholder, .textarea::placeholder { color: #5f6570; }
.input[dir="ltr"] { text-align: left; }

/* chips */
.chip {
  min-height: 38px; padding: .35rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  font-size: .92rem; white-space: nowrap;
  transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: #000; border-color: var(--text); }

/* toast */
.toast {
  position: fixed; inset-inline: 0; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); margin-inline: auto;
  width: max-content; max-width: calc(100% - 32px);
  padding: .75rem 1.2rem; border-radius: 999px;
  background: var(--text); color: #000; font-weight: 500; z-index: var(--z-toast);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  animation: toast-in .3s var(--ease);
}
.toast--error { background: var(--rec); color: #fff; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

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