@import url("fonts.css");
/* ═════════════════════════════════════════════════════════════
   Storismo Universe — صفحات الخادم (الدخول، التسجيل، الأخطاء، الأدوات)
   الهوية عبر CSS Variables · Mobile First · RTL/LTR بالخصائص المنطقية
   ═════════════════════════════════════════════════════════════ */

/* ───── الخطوط (مستضافة ذاتياً، OFL) ───── */
/* ───── رموز التصميم ───── */
:root {
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --cyan: #0891b2;
  --green: #059669;
  --amber: #b45309;
  --red: #dc2626;

  --bg: #f4f6fb;
  --bg-deep: #e8edf7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #d9e0ec;
  --text: #0b1530;
  --text-2: #3b4763;
  --muted: #5c6884;
  --focus: #2563eb;
  --on-brand: #ffffff;
  --shadow: 0 1px 2px rgba(11, 21, 48, .06), 0 12px 32px -12px rgba(11, 21, 48, .18);

  --radius: 14px;
  --radius-sm: 10px;
  --font-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font-lat: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060d1f; --bg-deep: #0a1530; --surface: #0e1a36; --surface-2: #12213f;
    --border: #22325a; --text: #e8eefc; --text-2: #b6c3e0; --muted: #8796b8;
    --brand: #3b82f6; --brand-strong: #60a5fa; --cyan: #22d3ee; --green: #34d399; --amber: #fbbf24; --red: #f87171;
    --focus: #60a5fa; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060d1f; --bg-deep: #0a1530; --surface: #0e1a36; --surface-2: #12213f;
  --border: #22325a; --text: #e8eefc; --text-2: #b6c3e0; --muted: #8796b8;
  --brand: #3b82f6; --brand-strong: #60a5fa; --cyan: #22d3ee; --green: #34d399; --amber: #fbbf24; --red: #f87171;
  --focus: #60a5fa; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ───── الأساس ───── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-ar); font-size: 16px; line-height: 1.7;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
}
html[lang="fr"] body, html[lang="en"] body { font-family: var(--font-lat); line-height: 1.6; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50; background: var(--brand); color: var(--on-brand); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ───── الترويسة ───── */
.topbar {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 10px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-block-end: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--cyan)); color: #fff; font-family: var(--font-lat); font-weight: 700;
}
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.2; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip-btn, .lang-link {
  min-height: 40px; min-width: 40px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.chip-btn:hover, .lang-link:hover { border-color: var(--brand); color: var(--text); }
.lang-link[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.lang-group { display: inline-flex; gap: 4px; }

/* ───── الصفحات ───── */
main { flex: 1; width: 100%; }
.auth-shell {
  display: grid; gap: 24px; padding: 24px 16px 48px; max-width: 1080px; margin: 0 auto;
}
/* على الجوال: النموذج أولاً، اللوحة الزخرفية بعده */
@media (max-width: 899px) { .auth-visual { order: 2; } }
@media (max-width: 599px) { .brand small { display: none; } .topbar { position: static; } }
@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1.05fr 1fr; align-items: center; padding-block: 56px; }
}
.auth-visual {
  position: relative; overflow: hidden; border-radius: 22px; min-height: 220px; padding: 28px;
  color: #e8eefc; isolation: isolate;
  background:
    radial-gradient(120% 80% at 85% 110%, rgba(34, 211, 238, .35), transparent 60%),
    radial-gradient(90% 70% at 10% -10%, rgba(37, 99, 235, .55), transparent 60%),
    linear-gradient(160deg, #0a1736 0%, #071022 100%);
}
.auth-visual::before { /* شبكة شوارع خفيفة */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .22;
  background-image:
    linear-gradient(rgba(148, 197, 255, .35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 197, 255, .35) 1px, transparent 1px);
  background-size: 38px 38px;
  transform: perspective(600px) rotateX(55deg) translateY(30%) scale(1.6);
  transform-origin: 50% 100%;
}
.auth-visual::after { /* الساحل */
  content: ""; position: absolute; inset-inline: -10%; bottom: -40px; height: 120px; z-index: -1;
  background: radial-gradient(60% 100% at 50% 100%, rgba(8, 145, 178, .55), transparent 70%);
}
.auth-visual h2 { margin: 0 0 8px; font-size: clamp(22px, 3.2vw, 32px); line-height: 1.35; }
.auth-visual p { margin: 0; color: #b6c3e0; max-width: 46ch; }
.district-pills { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.district-pills li {
  font-size: 13px; padding: 4px 12px; border-radius: 999px;
  background: rgba(14, 26, 54, .65); border: 1px solid rgba(96, 165, 250, .35); color: #dbe7ff;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 24px;
}
@media (min-width: 600px) { .card { padding: 32px; } }
.card h1 { font-size: 26px; line-height: 1.3; margin: 0 0 6px; }
.card .lead { color: var(--text-2); margin: 0 0 22px; }

.page { max-width: 1000px; margin: 0 auto; padding: 24px 16px 48px; }
.page h1 { font-size: 26px; margin: 0 0 16px; }

/* ───── النماذج ───── */
.field { margin-block-end: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-block-end: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-block-start: 6px; }
.input-wrap { position: relative; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="tel"], input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
input[type="email"], input[type="url"], input.ltr-input { direction: ltr; text-align: start; }
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="url"], html[dir="rtl"] input.ltr-input { text-align: right; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.field.has-error input { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13px; margin-block-start: 6px; display: flex; gap: 6px; align-items: flex-start; }
.field-error:empty { display: none; }
.pw-toggle {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  min-width: 40px; min-height: 40px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.has-toggle input { padding-inline-end: 52px; }
.check { display: flex; align-items: center; gap: 10px; margin-block: 4px 18px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.row { display: grid; gap: 0 14px; }
@media (min-width: 600px) { .row.cols-2 { grid-template-columns: 1fr 1fr; } .row.cols-3 { grid-template-columns: 2fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 22px -10px var(--brand); }
.btn-primary:hover { background: var(--brand-strong); color: var(--on-brand); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .75; cursor: progress; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; display: none; }
.btn[aria-busy="true"] .spinner { display: inline-block; }

.alt { text-align: center; margin: 18px 0 0; color: var(--text-2); font-size: 15px; }
.split-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-block: -6px 14px; }

/* ───── التنبيهات (Toasts + رسائل ثابتة) ───── */
.alert { border-radius: 12px; padding: 12px 14px; margin-block-end: 16px; border: 1px solid; font-size: 15px; }
.alert-error { background: color-mix(in srgb, var(--red) 10%, var(--surface)); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--text); }
.alert-success { background: color-mix(in srgb, var(--green) 10%, var(--surface)); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.alert-info { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-inline-start: 4px solid var(--brand);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start;
  animation: toast-in .25s ease-out;
}
.toast.success { border-inline-start-color: var(--green); }
.toast.error { border-inline-start-color: var(--red); }
.toast button { margin-inline-start: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; min-width: 32px; min-height: 32px; font-size: 18px; }

/* ───── الجداول والحالات ───── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 14px; border-block-end: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-block-end: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.badge.fail { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.badge.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.grid-cards { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid-cards { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; direction: ltr; unicode-bidi: isolate; }
.steps-log { margin: 0; padding-inline-start: 20px; color: var(--text-2); font-size: 14px; }

/* ───── صفحات الخطأ ───── */
.error-page { min-height: 70vh; display: grid; place-items: center; padding: 32px 16px; text-align: center; }
.error-code { font-family: var(--font-lat); font-size: clamp(64px, 14vw, 120px); font-weight: 700; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--brand), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { margin: 12px 0 6px; font-size: 24px; }
.error-page p { color: var(--text-2); margin: 0 0 22px; }

/* ───── التذييل ───── */
.footer { padding: 18px 16px; text-align: center; font-size: 13px; color: var(--muted); border-block-start: 1px solid var(--border); }

/* ───── الهيكل العظمي للتحميل ───── */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

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

textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
select { appearance: auto; }
.field.has-error select, .field.has-error textarea { border-color: var(--red); }
.pending-badge { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.check span a { margin-inline-start: 4px; }
