/* ══════════════════════════════════════════════════════════════════════════
   A Plan — v8 shared layer · aplan-dialog.8.2.0.css
   يُحمَّل في كل صفحة مفعّل عليها v8 (المقالات وغيرها عند all): ألوان، أزرار
   .ap-btn، نافذتا التواصل (#contact-popup / #call-popup)، وحوم روابط الفوتر.
   كل قاعدة تحت body.ap-v8. مستثنى من RUCSS، رابط عادي يحجب الرسم.
   نسخة جديدة = اسم ملف جديد (immutable سنة).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 0. tokens ─────────────────────────────────────────────────────────── */
body.ap-v8 {
  --ap-navy: #0a1745;
  --ap-ink: #14182b;          /* 17.57:1 على الأبيض */
  --ap-text: #2c2c2c;         /* 13.97:1 */
  --ap-muted: #555b6e;        /* 6.76:1 أبيض · 6.48:1 على #fbfaf8 */
  --ap-line: #e6e3dc;         /* فاصل زخرفي فقط — نفس حدود .ap-faq-item في صفحات الخدمات */
  --ap-field: #8a90a3;        /* حدّ حقل: 3.18:1 (≥3 مكوّن واجهة) */
  --ap-surface: #fbfaf8;      /* السطح الدافئ نفسه المستخدم في صفحات الخدمات */
  --ap-red: #e31e24;          /* تعبئة أزرار الإجراء فقط — أبيض عليه 4.69:1 */
  --ap-red-hover: #bb1418;    /* أبيض عليه 6.51:1 */
  --ap-link: #bb1418;         /* روابط النص: 6.51 أبيض · 6.13 #f7f8fa · 6.24 #fbfaf8 */
  --ap-link-hover: #8f0f13;   /* 9.35:1 */
}

/* ── 1. الأزرار ────────────────────────────────────────────────────────── */
body.ap-v8 .ap-btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; max-width: 100%; padding: .75rem 1.5rem; margin: 0;
  border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.35; letter-spacing: 0;
  text-align: center; white-space: normal; overflow: visible; text-decoration: none !important;
  transition: background-color .15s ease-out, box-shadow .15s ease-out, color .15s ease-out;
}
body.ap-v8 .ap-btn::before, body.ap-v8 .ap-btn::after { content: none !important; }
body.ap-v8 .ap-btn--primary {
  background: var(--ap-red) !important; color: #fff !important;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.28) !important;   /* ظل محايد بإزاحة، لا توهّج ملوّن */
}
body.ap-v8 .ap-btn--primary:hover { background: var(--ap-red-hover) !important; color: #fff !important; }
body.ap-v8 .ap-btn--primary:active { transform: translateY(1px); }
body.ap-v8 .ap-btn--ghost {
  background: transparent !important; color: var(--ap-navy) !important;
  box-shadow: inset 0 0 0 1px var(--ap-field) !important;
}
body.ap-v8 .ap-btn--ghost:hover { background: var(--ap-navy) !important; color: #fff !important; box-shadow: none !important; }
body.ap-v8 .ap-btn:focus-visible { outline: 2px solid var(--ap-navy); outline-offset: 3px; }
body.ap-v8 .ap-btn--block { display: flex; width: 100%; min-height: 52px; font-size: 1.0625rem; }

/* ── 2. النافذتان ─────────────────────────────────────────────────────── */
body.ap-v8 :is(#contact-popup, #call-popup) { background: rgba(10,23,69,.72) !important; }
/* الإرث: transition: all .3s على visibility ⇒ الصندوق مخفي في أول إطار فيفشل focus().
   عند الفتح تظهر فورًا ويبقى التلاشي للشفافية فقط؛ الإغلاق يحتفظ بانتقال الإرث. */
body.ap-v8 :is(#contact-popup, #call-popup).active { transition: opacity .3s ease, visibility 0s; }
body.ap-v8 .ap-dlg {
  position: relative !important; width: min(100% - 32px, 440px) !important; max-width: none !important;
  max-height: calc(100dvh - 32px) !important; overflow-y: auto !important;
  padding: 1.5rem 1.25rem 1.25rem !important; background: #fff !important;
  border-radius: 16px !important; box-shadow: 0 24px 60px -20px rgba(0,0,0,.45) !important;
  text-align: start !important;
}
@media (min-width: 768px) { body.ap-v8 .ap-dlg { padding: 2rem 2rem 1.5rem !important; } }
body.ap-v8 .ap-dlg::before, body.ap-v8 .ap-dlg::after { content: none !important; display: none !important; }
body.ap-v8 .ap-dlg .ap-dlg-form { display: block !important; gap: 0 !important; margin: 0 !important; padding: 0 !important; }
body.ap-v8 .ap-dlg:focus { outline: none; }
body.ap-v8 .ap-dlg:focus-visible { outline: 2px solid var(--ap-navy); outline-offset: -2px; }
body.ap-v8 .ap-dlg .ap-dlg-title {
  margin: 0 0 .35rem !important; padding: 0 !important; padding-inline-end: 44px !important; border: 0 !important;
  font-size: 1.375rem !important; font-weight: 800 !important; line-height: 1.45 !important;
  color: var(--ap-ink) !important; text-align: start !important; text-align-last: start !important;
  text-wrap: balance;
}
body.ap-v8 .ap-dlg-desc { margin: 0 0 1.25rem; font-size: .9375rem; line-height: 1.75; color: var(--ap-muted); text-wrap: pretty; }
body.ap-v8 .ap-dlg .ap-dlg-close {
  position: absolute !important; top: .5rem !important; left: auto !important; right: auto !important;
  inset-inline-end: .5rem !important; width: 44px !important; height: 44px !important;
  display: grid !important; place-items: center; padding: 0 !important; border: 0 !important; border-radius: 50% !important;
  background: transparent !important; color: var(--ap-ink) !important; font-size: 0 !important; cursor: pointer;
}
body.ap-v8 .ap-dlg .ap-dlg-close:hover { background: var(--ap-surface) !important; }
body.ap-v8 .ap-dlg .ap-dlg-close:focus-visible { outline: 2px solid var(--ap-navy); outline-offset: 0; }
body.ap-v8 .ap-dlg .ap-field { margin: 0 0 1rem; }
body.ap-v8 .ap-dlg .ap-field label {
  display: block; margin: 0 0 .35rem; font-size: .9375rem; font-weight: 700; line-height: 1.5; color: var(--ap-ink);
}
body.ap-v8 .ap-dlg input:not([type="hidden"]) {
  display: block; width: 100% !important; min-height: 48px; margin: 0 !important;
  padding: .7rem .9rem !important; font-family: inherit; font-size: 16px !important; line-height: 1.5 !important;
  color: var(--ap-ink) !important; background: #fff !important; background-image: none !important;
  border: 1px solid var(--ap-field) !important; border-radius: 10px !important; box-shadow: none !important;
  caret-color: var(--ap-red); text-align: start;
}
body.ap-v8 .ap-dlg input[type="tel"] { text-align: right !important; }   /* dir=ltr للأرقام، محاذاة مع العمود العربي */
body.ap-v8 .ap-dlg input:focus-visible { outline: 2px solid var(--ap-navy) !important; outline-offset: 1px; border-color: var(--ap-navy) !important; }
body.ap-v8 .ap-dlg input.error { border-color: var(--ap-link) !important; }
body.ap-v8 .ap-dlg .ap-hint { margin-top: .35rem; font-size: .8125rem; line-height: 1.7; color: var(--ap-muted); text-wrap: pretty; }
/* #contact-popup button[type=submit] (1,1,1) يغلب حشو .ap-btn وانحناءه وحجمه ⇒ !important هنا فقط */
body.ap-v8 .ap-dlg .ap-btn--block {
  margin-top: .5rem !important; padding: .75rem 1.5rem !important; border-radius: 999px !important;
  font-size: 1.0625rem !important; width: 100% !important; transform: none !important;
}
body.ap-v8 .ap-dlg .ap-btn--block:hover { transform: none !important; box-shadow: 0 6px 14px -8px rgba(0,0,0,.28) !important; }
body.ap-v8 .ap-dlg-assure { margin-top: .75rem; font-size: .8125rem; line-height: 1.7; color: var(--ap-muted); text-align: center; text-wrap: balance; }
body.ap-v8 .ap-dlg ::selection { background: var(--ap-navy); color: #fff; }

/* ── 3. الفوتر: حوم الروابط كان #e31e24 على #16213e = 3.39:1 ⇒ أبيض + خط ─ */
body.ap-v8 footer .footer-section a:hover,
body.ap-v8 footer .footer-section ul li a:hover {
  color: #fff !important; text-decoration: underline !important;
  text-decoration-thickness: 1px; text-underline-offset: .32em;
}
body.ap-v8 footer a[href^="tel:"] bdi { unicode-bidi: isolate; }

@media (prefers-reduced-motion: reduce) {
  body.ap-v8 .ap-btn { transition: none; }
  body.ap-v8 :is(#contact-popup, #call-popup) { transition: none !important; }
  body.ap-v8 .ap-dlg { transition: none !important; transform: none !important; }
}
