/*
 * التنسيق المشترك بين الصفحات الثلاث.
 * كان مكرراً حرفياً في Notify.html:3-151 و Docs.html:3-64 — ٩ متغيّرات
 * و١٠ كتل متطابقة، وأي تعديل كان يجب أن يُطبَّق مرتين.
 */

:root {
  --ink: #17212B;
  --bg: #EDF0F3;
  --surface: #FFFFFF;
  --line: #DBE1E7;
  --muted: #6A7785;
  --brand: #0F6E6B;
  --brand-2: #0B5250;
  --brand-soft: #E4F1F0;
  --wa: #1FA855;
  --wa-2: #178a45;
  --amber: #C77714;
  --amber-soft: #FBEEDD;
  --sent: #3D6588;
  --sent-soft: #E7EEF5;
  --danger: #C0392B;
  --danger-soft: #FBEAE8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 33, 43, .06), 0 6px 20px rgba(23, 33, 43, .06);
}

* { box-sizing: border-box }
html, body { margin: 0; padding: 0 }

body {
  font-family: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

.mono { font-family: ui-monospace, Menlo, Consolas, monospace }
/* عزل اتجاهي للأرقام والتتبع داخل نص عربي */
.ltr { direction: ltr; unicode-bidi: isolate }
button { font-family: inherit; cursor: pointer; border: none; background: none }
.hide { display: none !important }

/* ============================== الأزرار ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px; padding: 11px 18px; border-radius: 11px;
  transition: .12s; background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-2) }
.btn:active { transform: translateY(1px) }
.btn.ghost { background: #EEF2F5; color: var(--ink); border: 1px solid var(--line) }
.btn.ghost:hover { background: #E4EAEF }
.btn.wa { background: var(--wa) }
.btn.wa:hover { background: var(--wa-2) }
.btn.cust { background: var(--sent) }
.btn.cust:hover { background: #335a80 }
.btn.done { background: #4b5a67 }
.btn.done:hover { background: #3d4954 }
.btn.danger { background: var(--danger) }
.btn.danger:hover { background: #a5301f }
.btn.grey { background: #EEF2F5; color: var(--ink); border: 1px solid var(--line) }
.btn.grey:hover { background: #E4EAEF }
.btn.sm { padding: 8px 12px; font-size: 12.5px; border-radius: 9px }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none }
.btn.block { width: 100% }

/* ============================== بوابة الدخول ============================== */
.gate {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: 20px;
}
.gate-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 28px 24px; width: 100%; max-width: 360px; text-align: center;
}
.gate-card .mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #12928d);
  display: grid; place-items: center; color: #fff; font-weight: 700; margin: 0 auto 14px;
}
.gate-card h2 { margin: 0 0 4px; font-size: 18px }
.gate-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px }
.gate-card input {
  width: 100%; text-align: center; font-size: 20px; letter-spacing: 6px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #FBFCFD; font-family: inherit;
}
.gate-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft) }
.gate-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 8px }
/* كان style="margin-top:6px" مضمّناً — و CSP بـ style-src 'self' يحجب السمات
   المضمّنة، فينكسر التخطيط صامتاً. القاعدة هنا بدلاً منه. */
.gate-card .gate-go { margin-top: 6px }

/* ============================== الشريط العلوي ============================== */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff;
  box-shadow: 0 2px 14px rgba(23, 33, 43, .18);
}
.topbar-in { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700 }
.logo .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #12928d);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
}
.logo small { display: block; font-weight: 500; font-size: 11px; color: #9fb0bd }
.spacer { flex: 1 }
.top-stat { font-size: 12px; color: #b9c6d1; text-align: left }
.top-stat b { color: #fff; font-size: 15px }
.navlink {
  font-size: 12.5px; font-weight: 600; color: #b9c6d1; text-decoration: none;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.navlink:hover { background: rgba(255, 255, 255, .1); color: #fff }
.navlink.on { background: rgba(255, 255, 255, .14); color: #fff }

/* ============================== المودال والإشعار ============================== */
.modal {
  position: fixed; inset: 0; background: rgba(15, 20, 26, .72);
  display: none; align-items: center; justify-content: center; z-index: 75; padding: 22px;
}
.modal.on { display: flex }
.modal-card {
  background: var(--surface); border-radius: 18px; padding: 22px 20px; width: 100%;
  max-width: 400px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal-card img {
  width: 100%; max-height: 44vh; object-fit: contain; border-radius: 12px;
  border: 1px solid var(--line); background: #F1F4F7; margin-bottom: 14px;
}
.modal-card h3 { margin: 0 0 6px; font-size: 18px }
.modal-card p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px }
.modal-actions { display: flex; gap: 10px }
.modal-actions .btn { flex: 1; width: auto }

.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; opacity: 0; transition: .25s; z-index: 80;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3); pointer-events: none; max-width: 90vw;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0) }

.empty-note { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px }

/* الحركة تُعطَّل لمن يطلب تقليلها */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important }
}

/* ============================================================
   شريط المستخدم الحالي والخروج — في الشريط العلوي للصفحتين.
   كانت دالة logout() موجودة في shared.js بلا أي زر يستدعيها؛ ومع الحسابات
   الحقيقية ومدة الجلسة الممتدة صار الخروج ضرورة على جهاز مستودع مشترك.
   ============================================================ */
.whobar {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #b9c6d1; white-space: nowrap;
}
.whobar b { color: #fff; font-weight: 600 }
.whobar .linkbtn { margin: 0; width: auto; color: #9fb0bd }
.whobar .linkbtn:hover { color: #fff }

/* كان معرّفاً في docs.css وحدها — نُقل هنا لأن الصفحتين تستخدمانه الآن */
.linkbtn {
  margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: underline; background: none; border: none; width: 100%;
  font-family: inherit; cursor: pointer;
}
.linkbtn:hover { color: var(--ink) }

/* حقلا البوابة: مسافة بينهما حين يكون أكثر من واحد */
.gate-card input + input { margin-top: 10px }
