/* =====================================================================
   MAX 77 — brand tokens & shared components
   Deep Black · Metallic Silver · Electric Blue · Dark Navy
   ===================================================================== */
:root {
  --bg: #000;
  --bg-2: #04070d;
  --navy: #07142b;
  --navy-2: #0b1d3d;
  --blue: #1e7bff;
  --blue-2: #5fb4ff;
  --blue-glow: rgba(30, 123, 255, .55);
  --silver: #d9dee6;
  --silver-2: #9aa4b2;
  --text: #eef2f8;
  --muted: #8d97a8;
  --line: rgba(190, 210, 240, .14);
  --line-strong: rgba(190, 210, 240, .28);
  --glass: rgba(14, 24, 44, .48);
  --glass-2: rgba(20, 34, 62, .6);
  --ok: #33d69f;
  --warn: #ffc24b;
  --danger: #ff5d6c;
  --radius: 22px;
  --radius-sm: 14px;
  /* one font for all text; Saira only for numbers */
  --font-h: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-b: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-num: 'Saira', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --metal: linear-gradient(180deg, #ffffff 0%, #dfe4ec 28%, #8f99a8 52%, #e9edf3 70%, #aab3c0 100%);
  --ease: cubic-bezier(.22, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-h); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: fixed; top: -100px; right: 16px; z-index: 100; background: var(--blue); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.num { font-family: var(--font-num); font-feature-settings: 'tnum'; direction: ltr; unicode-bidi: isolate; }
.metal-text {
  background: var(--metal);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------- glass ---------- */
.glass {
  background:
    linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,0) 40%),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 30px 80px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.4);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
}

/* ---------- buttons ---------- */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--h); padding: 0 1.25em;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.04); color: var(--text);
  font-family: var(--font-h); font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .25s var(--ease), background .25s, border-color .25s, box-shadow .25s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: rgba(190,215,255,.5); background: rgba(255,255,255,.08); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .5; pointer-events: none; }
.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #2b88ff, #0b56d6 60%, #0a3fa3);
  box-shadow: 0 10px 30px -10px var(--blue-glow), 0 1px 0 rgba(255,255,255,.35) inset;
  color: #fff;
}
.btn--primary:hover { background: linear-gradient(135deg, #47a0ff, #1666ea 60%, #0c48b8); box-shadow: 0 14px 40px -10px var(--blue-glow), 0 1px 0 rgba(255,255,255,.4) inset; }
.btn--metal { border-color: transparent; background: var(--metal); color: #0a0f18; box-shadow: 0 10px 30px -14px rgba(255,255,255,.4); }
.btn--ghost { background: transparent; }
.btn--danger { border-color: rgba(255,93,108,.4); color: #ffb3bb; }
.btn--danger:hover { background: rgba(255,93,108,.12); border-color: var(--danger); }
.btn--sm { --h: 36px; padding: 0 .95em; font-size: .85rem; }
.btn--lg { --h: 54px; padding: 0 1.6em; font-size: 1.02rem; }
.btn--block { width: 100%; }
.btn--icon { --h: 40px; width: var(--h); padding: 0; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: .85rem; color: var(--muted); font-weight: 500; }
.field small { color: var(--muted); font-size: .78rem; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: rgba(3, 8, 18, .6); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(30,123,255,.18); background: rgba(3, 10, 24, .8); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: #5d6778; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 18px 50%, 13px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 32px; }
input[type="time"], input[type="date"], input[type="datetime-local"] { direction: ltr; text-align: right; }
.input[type="color"] { padding: 4px; height: 48px; cursor: pointer; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch i { width: 46px; height: 26px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid var(--line-strong); position: relative; transition: background .25s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: #cfd6e2; transition: transform .25s var(--ease), background .25s; }
.switch input:checked + i { background: var(--blue); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(-20px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--blue-2); outline-offset: 2px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line-strong); background: rgba(255,255,255,.05); white-space: nowrap; }
.chip--blue { color: #a9d0ff; border-color: rgba(30,123,255,.45); background: rgba(30,123,255,.14); }
.chip--ok { color: #8ff0c9; border-color: rgba(51,214,159,.4); background: rgba(51,214,159,.12); }
.chip--warn { color: #ffd98a; border-color: rgba(255,194,75,.4); background: rgba(255,194,75,.12); }
.chip--danger { color: #ffb3bb; border-color: rgba(255,93,108,.4); background: rgba(255,93,108,.12); }

.toast-wrap { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: rgba(10,18,34,.95); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px -20px #000; font-size: .92rem; animation: toast-in .35s var(--ease); }
.toast--error { border-color: rgba(255,93,108,.5); }
.toast--ok { border-color: rgba(51,214,159,.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--blue-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.1), rgba(255,255,255,.04)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
