/* ==========================================================================
   Foolad Tower — base: tokens, type, primitives
   Direction: "Soft Modern" — airy blue-grey canvas, deep navy ink,
   cobalt brand, rounded surfaces, soft layered shadows, glass details.
   ========================================================================== */

@font-face {
  font-family: 'Estedad';
  src: url('/static/fonts/estedad-arabic-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Estedad';
  src: url('/static/fonts/estedad-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face { font-family: 'Plex Mono'; src: url('/static/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/static/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  /* canvas & surfaces */
  --stone: #edf1f8;          /* page background */
  --paper: #ffffff;          /* cards */
  --paper-2: #f5f7fc;        /* inputs, subtle fills */
  /* ink */
  --ink: #14213d;
  --ink-2: #3c4968;
  --mute: #7a86a3;
  --mute-2: #b2bbd0;
  --line: #e1e6f0;
  --line-2: #eef1f7;
  /* brand (kept old token names so every template picks it up) */
  --copper: #2f5bea;
  --copper-2: #8aa4ff;
  --copper-soft: #e8eeff;
  --brand-grad: linear-gradient(135deg, #3d6bff 0%, #2448c9 55%, #14213d 100%);
  --navy-grad: linear-gradient(150deg, #1d2f57 0%, #14213d 60%, #0c1530 100%);

  --ok: #12945a;   --ok-bg: #ddf5e8;   --ok-line: #a9e2c4;
  --bad: #dc3f2b;  --bad-bg: #fde7e4;  --bad-line: #f6b8ae;
  --wait: #c27c00; --wait-bg: #fff2d4; --wait-line: #f3d68f;

  --sh-1: 0 1px 2px rgba(20,33,61,.05), 0 6px 20px -10px rgba(20,33,61,.14);
  --sh-2: 0 2px 4px rgba(20,33,61,.04), 0 18px 40px -18px rgba(20,33,61,.25);
  --sh-3: 0 40px 80px -30px rgba(20,33,61,.45);
  --sh-brand: 0 14px 30px -12px rgba(47,91,234,.6);

  --f: 'Estedad', Tahoma, sans-serif;
  --mono: 'Plex Mono', ui-monospace, monospace;

  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
  --r: 14px;
  --r-sm: 10px;
  --r-lg: 24px;
  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--stone);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.3; }
p { margin: 0; }
::selection { background: var(--copper); color: #fff; }
:focus-visible { outline: 3px solid rgba(47,91,234,.45); outline-offset: 2px; }

.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 26px; height: 26px; }

.mono { font-family: var(--mono); letter-spacing: .02em; }
.num { font-feature-settings: normal; letter-spacing: 0; }
.mute { color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* small pill label */
.tag {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  height: 28px; padding: 0 12px; border-radius: 99px;
  background: var(--copper-soft); color: var(--copper);
  font-size: 12px; font-weight: 800;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.no-rule { background: transparent; padding: 0; height: auto; color: var(--mute); font-weight: 700; }
.tag.no-rule::before { display: none; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--ink); --fg: #fff;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  background: var(--bg); color: var(--fg);
  border: 1px solid transparent; border-radius: var(--r);
  font-weight: 800; font-size: 14.5px; white-space: nowrap;
  box-shadow: 0 10px 24px -14px rgba(20,33,61,.7);
  transition: transform .25s var(--ease), box-shadow .3s var(--ease), background .3s, color .3s;
}
.btn::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--brand-grad); opacity: 0; transition: opacity .35s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh-brand); }
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0); }
.btn .i { transition: transform .35s var(--ease); }
.btn:hover .i-arrow { transform: translateX(-4px); }
.btn-brand { --bg: var(--copper); box-shadow: var(--sh-brand); }
.btn-ghost { --bg: var(--paper); --fg: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-ghost::after { background: var(--paper-2); }
.btn-ghost:hover { box-shadow: var(--sh-1); border-color: var(--mute-2); }
.btn-ok { --bg: var(--ok); box-shadow: 0 10px 22px -12px rgba(18,148,90,.7); }
.btn-ok::after { background: linear-gradient(135deg, #19b06d, #0e7a49); }
.btn-ok:hover { box-shadow: 0 14px 26px -12px rgba(18,148,90,.75); }
.btn-bad { --bg: var(--bad-bg); --fg: var(--bad); box-shadow: none; }
.btn-bad::after { background: var(--bad); }
.btn-bad:hover { color: #fff; box-shadow: 0 12px 24px -12px rgba(220,63,43,.7); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; gap: 6px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 15.5px; padding: 0 26px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

.link { color: var(--copper); font-weight: 700; transition: opacity .2s; }
.link:hover { opacity: .75; }

/* ---------- form fields: soft filled inputs ---------- */
.field { position: relative; display: block; margin-bottom: 18px; }
.field > span, .field-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px;
}
.field > span em, .field-label em { font-style: normal; font-weight: 500; color: var(--mute); font-size: 12px; }
.input, .field input:not([type=radio]):not([type=checkbox]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  background: var(--paper-2); border: 1.5px solid transparent;
  border-radius: var(--r); outline: 0; font-size: 15.5px; font-weight: 600;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field input:hover, .field select:hover, .field textarea:hover { background: #eff2fa; }
.field input:focus, .field select:focus, .field textarea:focus {
  background: #fff; border-color: var(--copper); box-shadow: 0 0 0 4px rgba(47,91,234,.12);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: 20px 23px, 15px 23px; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 36px; }
.field input::placeholder, .field textarea::placeholder { color: var(--mute-2); font-weight: 500; }
.field input.ltr, .field .ltr { text-align: left; letter-spacing: .03em; }
.field .hint { display: block; font-size: 12px; color: var(--mute); margin-top: 6px; }

.boxed {
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: var(--r-sm);
  padding: 12px 14px; min-height: 48px; width: 100%; outline: 0;
}
.boxed:focus { border-color: var(--copper); background: #fff; }

.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--copper); }

/* ---------- status chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  font-size: 12px; font-weight: 800; border-radius: 99px; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.pending, .chip.wait { background: var(--wait-bg); color: var(--wait); }
.chip.pending::before { animation: blink 1.6s infinite; }
.chip.plain::before { display: none; }
@keyframes blink { 50% { opacity: .25; } }

.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 99px; background: linear-gradient(135deg, #ff6a4d, #e0452f); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 1;
  box-shadow: 0 6px 12px -6px rgba(224,69,47,.8);
}

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; inset-block-start: 16px; inset-inline: 16px; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start;
  width: min(500px, 100%); padding: 14px 16px; border-radius: 16px;
  background: rgba(20,33,61,.94); color: #fff; font-size: 14px; line-height: 1.7; font-weight: 600;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--sh-3);
  animation: toastIn .6s var(--ease) both;
}
.toast > .i { margin-top: 2px; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: rgba(255,255,255,.12); }
.toast.ok > .i { color: #6ee7a8; background: rgba(110,231,168,.15); }
.toast.error > .i { color: #ff9b8a; background: rgba(255,155,138,.15); }
.toast.info > .i { color: #ffd479; background: rgba(255,212,121,.15); }
.toast button { margin-inline-start: auto; opacity: .6; }
.toast button:hover { opacity: 1; }
.toast.out { animation: toastOut .4s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.secret-card {
  display: grid; gap: 6px; padding: 20px 22px; margin-bottom: 26px;
  background: var(--brand-grad); color: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-brand);
}
.secret-card .tag { color: rgba(255,255,255,.8); }
.secret-card b { font-family: var(--mono); font-size: 34px; letter-spacing: .2em; direction: ltr; text-align: right; }
.secret-card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.secret-card .mute { color: rgba(255,255,255,.75) !important; }
.secret-card .btn-ghost { --bg: rgba(255,255,255,.14); --fg: #fff; border-color: rgba(255,255,255,.25); }

.errors { margin: 0 0 22px; padding: 14px 18px; list-style: none; border-radius: var(--r); background: var(--bad-bg); color: var(--bad); font-size: 13.5px; font-weight: 600; }

.grain::before { display: none; }

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