/* أمان | نظام التصميم
   اللون مستوحى من بحر الخليج واللؤلؤ، والخط عربي أولاً */

:root {
  --ink: #10233A;
  --ink-soft: #45586E;
  --ink-faint: #7A8899;
  --paper: #F3F5F4;
  --surface: #FFFFFF;
  --sand: #E7E1D4;
  --line: #DCE2E0;

  --teal: #0E6E63;
  --teal-deep: #0A544B;
  --teal-wash: #E3F0EC;

  --amber: #A85F00;
  --amber-wash: #FBEEDA;
  --red: #A9231C;
  --red-wash: #FBE7E4;
  --slate: #46586A;
  --slate-wash: #EAEEF1;

  --r-card: 14px;
  --r-chip: 4px;
  --r-btn: 10px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(16, 35, 58, .06), 0 8px 24px rgba(16, 35, 58, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
  padding-bottom: 76px;
}

h1, h2, h3 { line-height: 1.35; margin: 0 0 var(--sp-3); font-weight: 600; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 18px; }
p { margin: 0 0 var(--sp-4); }
a { color: var(--teal-deep); text-underline-offset: 3px; }

.wrap { max-width: 34rem; margin: 0 auto; padding: 0 var(--sp-4); }
.wrap-wide { max-width: 62rem; margin: 0 auto; padding: 0 var(--sp-4); }

/* الترويسة */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-in {
  max-width: 34rem; margin: 0 auto; padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--teal); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.topbar-actions { display: flex; align-items: center; gap: var(--sp-3); font-size: 15px; }

/* البطاقات */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.card-quiet { background: transparent; border-style: dashed; }
.card-tight { padding: var(--sp-3) var(--sp-4); }

/* صندوق الفحص وهو بطل الصفحة */
.scanbox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--sp-4);
  margin: var(--sp-4) 0 var(--sp-5);
}
.scanbox textarea {
  width: 100%; border: 0; resize: vertical; min-height: 120px;
  font-family: var(--font); font-size: 17px; line-height: 1.7;
  color: var(--ink); background: transparent; padding: var(--sp-2) 0;
}
.scanbox textarea:focus { outline: none; }
.scanbox-foot { display: flex; align-items: center; gap: var(--sp-3); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.scanbox-hint { font-size: 14px; color: var(--ink-faint); flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  background: var(--teal); color: #fff; border: 0; border-radius: var(--r-btn);
  padding: 13px 22px; font-family: var(--font); font-size: 17px; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 48px;
}
.btn:hover { background: var(--teal-deep); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--teal-deep); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--teal-wash); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #8C1C16; }
.btn-sm { padding: 8px 14px; font-size: 15px; min-height: 40px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], select, textarea.field {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-btn);
  font-family: var(--font); font-size: 17px; background: var(--surface); color: var(--ink);
  min-height: 48px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
label { display: block; font-size: 15px; color: var(--ink-soft); margin-bottom: var(--sp-2); font-weight: 500; }
.field-row { margin-bottom: var(--sp-4); }

/* شريط الحكم وهو العنصر الأبرز في التطبيق */
.verdict {
  border-radius: var(--r-card);
  padding: var(--sp-5) var(--sp-4);
  border-inline-start: 8px solid;
  margin-bottom: var(--sp-4);
}
.verdict-word { font-size: 30px; font-weight: 700; line-height: 1.25; margin: 0 0 var(--sp-2); }
.verdict-line { font-size: 18px; line-height: 1.7; margin: 0; }
.verdict.v-VERIFIED { background: var(--teal-wash); border-color: var(--teal); color: var(--teal-deep); }
.verdict.v-CLEAN { background: var(--slate-wash); border-color: var(--slate); color: #23384B; }
.verdict.v-SUSPICIOUS { background: var(--amber-wash); border-color: var(--amber); color: #7A4600; }
.verdict.v-MALICIOUS { background: var(--red-wash); border-color: var(--red); color: #7E1A14; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-chip);
  background: var(--slate-wash); color: var(--slate);
}
.pill.v-VERIFIED { background: var(--teal-wash); color: var(--teal-deep); }
.pill.v-CLEAN { background: var(--slate-wash); color: var(--slate); }
.pill.v-SUSPICIOUS { background: var(--amber-wash); color: #7A4600; }
.pill.v-MALICIOUS { background: var(--red-wash); color: #7E1A14; }

/* الأسباب */
.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li {
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--line);
  display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 16px;
}
.reasons li:last-child { border-bottom: 0; }
.reason-mark { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 9px; background: var(--ink-faint); }
.reason-mark.w-high { background: var(--red); }
.reason-mark.w-mid { background: var(--amber); }
.reason-mark.w-low { background: var(--ink-faint); }
.reason-mark.w-ok { background: var(--teal); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); font-size: 15px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; word-break: break-all; }

.urlbox {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-chip);
  padding: var(--sp-3); font-size: 14px; word-break: break-all; direction: ltr; text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-soft);
}

/* التنقل السفلي */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--ink-faint);
  font-size: 12px; display: grid; gap: 2px; padding: 4px 0; min-height: 52px;
}
.tabbar a.on { color: var(--teal-deep); font-weight: 600; }
.tabbar .ic { font-size: 20px; line-height: 1.2; }

/* القوائم */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a, .list .row { display: block; padding: var(--sp-3) 0; text-decoration: none; color: inherit; }
.row-title { font-weight: 600; margin-bottom: 2px; }
.row-sub { font-size: 14px; color: var(--ink-faint); }

.meta { font-size: 14px; color: var(--ink-faint); }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-chip);
  padding: 6px 12px; font-size: 14px; color: var(--ink-soft); text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--teal); color: var(--teal-deep); }

.notice { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-btn); font-size: 15px; margin-bottom: var(--sp-4); }
.notice-ok { background: var(--teal-wash); color: var(--teal-deep); }
.notice-warn { background: var(--amber-wash); color: #7A4600; }
.notice-err { background: var(--red-wash); color: #7E1A14; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: var(--sp-5) 0 var(--sp-3); }
.section-head h2 { margin: 0; }

/* خطوات الطوارئ وهي تسلسل حقيقي فيصح ترقيمها */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li {
  counter-increment: s; position: relative; padding: var(--sp-3) 0 var(--sp-3) 0;
  padding-inline-start: 44px; border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: 0; top: 14px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.steps .step-title { font-weight: 600; }

.callbox { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.callbox:last-child { border-bottom: 0; }
.tel { font-family: ui-monospace, monospace; font-size: 17px; direction: ltr; }

/* الدروس */
.lesson-body { font-size: 17px; line-height: 1.9; }
.lesson-body h2 { font-size: 19px; margin-top: var(--sp-5); }
.lesson-body p { margin-bottom: var(--sp-4); }
.progressbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progressbar span { display: block; height: 100%; background: var(--teal); }

.quiz-option {
  display: block; width: 100%; text-align: start; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface);
  font-family: var(--font); font-size: 16px; margin-bottom: var(--sp-2); cursor: pointer; color: var(--ink);
}
.quiz-option:hover { border-color: var(--teal); }
.quiz-option.right { border-color: var(--teal); background: var(--teal-wash); }
.quiz-option.wrong { border-color: var(--red); background: var(--red-wash); }

/* لوحة الإدارة تأخذ الطابع الداكن */
.admin { background: #0C1620; color: #D6E2EC; min-height: 100vh; padding-bottom: var(--sp-6); }
.admin .wrap-wide { padding-top: var(--sp-4); }
.admin h1, .admin h2, .admin h3 { color: #EAF2F8; }
.admin .card { background: #132230; border-color: #1F3446; }
.admin a { color: #6FD3C4; }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th, .admin td { text-align: start; padding: 10px 8px; border-bottom: 1px solid #1F3446; vertical-align: top; }
.admin th { color: #8FA6B8; font-weight: 500; }
.admin .btn-ghost { color: #6FD3C4; border-color: #24415A; }
.admin input, .admin select, .admin textarea { background: #0C1620; color: #D6E2EC; border-color: #24415A; }
.adminnav { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid #1F3446; margin-bottom: var(--sp-4); }
.adminnav a { text-decoration: none; font-size: 15px; }
.stat { display: grid; gap: 2px; }
.stat b { font-size: 26px; font-weight: 600; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-4); }

.tablewrap { overflow-x: auto; }

@media (min-width: 720px) {
  body { font-size: 17px; }
  .wrap { padding: 0 var(--sp-5); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: var(--sp-4); top: var(--sp-2); background: #fff; padding: var(--sp-2) var(--sp-3); z-index: 60; border-radius: var(--r-chip); }

footer.sitefoot { padding: var(--sp-5) 0; color: var(--ink-faint); font-size: 14px; border-top: 1px solid var(--line); margin-top: var(--sp-6); }
footer.sitefoot a { color: var(--ink-soft); }
