/* =========================================================================
   أبو ثابت للبرمجيات — أنماط الموقع
   -------------------------------------------------------------------------
   1. المتغيرات (الألوان والخطوط)  ← ابدأ من هنا لتغيير هوية الموقع
   2. الأساسيات
   3. عناصر مشتركة (أزرار، حاويات، عناوين)
   4. الشريط العلوي
   5. القسم الرئيسي (Hero)
   6. البرامج
   7. التواصل
   8. الفوتر
   9. الحركات والتفاعلات
   ========================================================================= */

/* ============================= 1. المتغيرات ============================= */
:root {
  /* الألوان الأساسية */
  --bg:          #0A1628;   /* خلفية الموقع */
  --panel:       #0F1B2D;   /* خلفية البطاقات والأقسام */
  --teal:        #57C5B6;   /* اللون الأساسي (فيروزي) */
  --teal-dark:   #2E6F7E;
  --gold:        #E8C07D;   /* اللون الثانوي (ذهبي) */
  --whatsapp:    #25D366;

  /* النصوص */
  --text:        #FFFFFF;
  --text-muted:  #D1D5DB;
  --text-dim:    #9CA3AF;
  --text-faint:  #6B7280;

  /* الحدود والزجاج */
  --line:        rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .10);
  --glass:       rgba(255, 255, 255, .05);

  /* الخطوط */
  --font-heading: 'Cairo', system-ui, sans-serif;
  --font-body:    'Noto Kufi Arabic', system-ui, sans-serif;

  /* المقاسات */
  --container:  1280px;
  --radius:     24px;
  --nav-h:      104px;
}

/* ============================= 2. الأساسيات ============================= */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  scroll-behavior: smooth;
  /* يمنع اختفاء العناوين خلف الشريط العلوي عند التنقل بالروابط */
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg   { display: block; max-width: 100%; }
a          { color: inherit; text-decoration: none; }
button     { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul         { list-style: none; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.25; }

::selection { background: var(--teal); color: var(--panel); }

/* شريط التمرير */
::-webkit-scrollbar        { width: 10px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: #1F365A; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-dark); }

/* حلقة تركيز واضحة للتنقل بلوحة المفاتيح */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* تخطٍّ إلى المحتوى — لقارئات الشاشة */
.skip-link {
  position: absolute;
  top: -100px;
  right: 16px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--teal);
  color: var(--panel);
  font-weight: 700;
  border-radius: 0 0 12px 12px;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ========================== 3. عناصر مشتركة =========================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}
.container--narrow { max-width: 896px; }

.glass-panel {
  background: rgba(15, 27, 45, .70);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.section { padding-block: 128px; position: relative; z-index: 10; }

.section-head { text-align: center; margin-bottom: 96px; }
.section-head h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 16px; }
.section-head .rule {
  width: 96px; height: 4px; margin-inline: auto; border-radius: 999px;
  background: linear-gradient(to right, transparent, var(--teal), transparent);
}

/* ---- الأزرار ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
  transition: transform .3s, box-shadow .3s, background-color .3s;
}
.btn:hover { transform: translateY(-4px); }

.btn--primary {
  background: linear-gradient(to right, var(--teal), var(--teal-dark));
  box-shadow: 0 0 30px rgba(87, 197, 182, .3);
}
.btn--primary:hover { box-shadow: 0 0 40px rgba(87, 197, 182, .6); }

.btn--ghost {
  background: var(--glass);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.btn--ghost:hover { background: rgba(255, 255, 255, .10); }

.btn--lg { padding: 20px 40px; font-size: 1.25rem; border-radius: 16px; }

.btn--whatsapp {
  background: var(--whatsapp);
  box-shadow: 0 10px 30px rgba(37, 211, 102, .3);
}
.btn--whatsapp:hover { background: #1EBE5D; box-shadow: 0 10px 40px rgba(37, 211, 102, .5); }

.btn .icon { width: 24px; height: 24px; }

/* ============================ 4. الشريط العلوي ========================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding-block: 24px;
  background: transparent;
  transition: padding .3s, background-color .3s, box-shadow .3s;
}
/* يُضاف بالجافاسكربت بعد تمرير 50px */
.nav.is-scrolled {
  padding-block: 16px;
  background: rgba(10, 22, 40, .85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .5);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__logo img {
  height: 64px;
  width: auto;
  transition: transform .5s;
}
.nav__logo:hover img { transform: scale(1.05); }
.nav.is-scrolled .nav__logo img { height: 52px; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
}

/* رابط بخط سفلي يتمدّد عند المرور */
.nav__link {
  position: relative;
  color: var(--text-muted);
  transition: color .3s;
}
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  inset-inline-start: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width .3s;
}
.nav__link:hover::after { width: 100%; }
.nav__link--teal:hover { color: var(--teal); }
.nav__link--gold:hover { color: var(--gold); }

.nav__cta {
  background: var(--teal);
  color: var(--bg);
  font-weight: 700;
  padding: 8px 24px;
  border-radius: 999px;
  transition: background-color .3s, box-shadow .3s, transform .3s;
}
.nav__cta:hover {
  background: #48A89A;
  box-shadow: 0 0 20px rgba(87, 197, 182, .4);
  transform: translateY(-2px);
}

/* زر القائمة على الجوال */
.nav__toggle { display: none; padding: 8px; color: var(--text); }
.nav__toggle .icon { width: 28px; height: 28px; }

@media (max-width: 860px) {
  .nav__toggle { display: block; }

  /* الشعار وزر القائمة يبقيان فوق لوحة القائمة المنسدلة */
  .nav__logo,
  .nav__toggle { position: relative; z-index: 2; }

  .nav__links {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: calc(var(--nav-h) + 8px) 24px 24px;
    background: rgba(10, 22, 40, .97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    /* مخفية افتراضياً */
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform .35s ease, opacity .35s ease, visibility .35s;
  }
  .nav__links.is-open { transform: translateY(0); opacity: 1; visibility: visible; }

  .nav__link, .nav__cta { padding: 14px 8px; text-align: center; }
  .nav__link::after { display: none; }
  .nav__cta { margin-top: 8px; }
  .nav__logo img, .nav.is-scrolled .nav__logo img { height: 48px; }
}

/* ============================== 5. الـ Hero ============================ */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  /* مساحة سفلية تمنع تداخل المحتوى مع مؤشر التمرير */
  padding: var(--nav-h) 0 120px;
  overflow: hidden;
}

/* لوحة الجزيئات المتحركة */
#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* هالات ضوئية في الخلفية */
.hero__glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.hero__glow--teal {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px; height: 800px;
  background: var(--teal);
  opacity: .10;
  filter: blur(120px);
}
.hero__glow--gold {
  top: 25%; right: 25%;
  width: 500px; height: 500px;
  background: var(--gold);
  opacity: .05;
  filter: blur(100px);
}

.hero__inner { position: relative; z-index: 10; width: 100%; }

.hero__grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

.hero__text { flex: 1; text-align: center; }

.hero__title {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.2;
}
.hero__title .grad {
  background: linear-gradient(to right, var(--teal), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  color: var(--text-muted);
  margin-bottom: 48px;
  line-height: 1.8;
  max-width: 36rem;
  margin-inline: auto;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.hero__actions .btn { width: 100%; }

/* الشعار الطافي */
.hero__logo { position: relative; display: grid; place-items: center; flex-shrink: 0; }
.hero__logo::before,
.hero__logo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.hero__logo::before {
  background: var(--teal);
  opacity: .20;
  filter: blur(48px);
  transform: scale(1.5);
  animation: pulse 3s ease-in-out infinite;
}
.hero__logo::after {
  background: var(--gold);
  opacity: .10;
  filter: blur(32px);
  transform: scale(1.25);
}
.hero__logo img {
  position: relative;
  z-index: 10;
  width: clamp(208px, 30vw, 384px);
  height: auto;
  filter: drop-shadow(0 0 60px rgba(87, 197, 182, .5));
  animation: float 4s ease-in-out infinite;
}

/* مؤشر التمرير للأسفل */
.hero__scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  transition: color .3s;
  z-index: 10;
}
.hero__scroll:hover { color: #fff; }
.hero__scroll span { font-size: .875rem; letter-spacing: .1em; }
.hero__scroll .track {
  width: 2px;
  height: 48px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--text-faint), transparent);
}
.hero__scroll .dot {
  width: 100%;
  height: 50%;
  background: var(--teal);
  border-radius: 999px;
  animation: scroll-dot 2s ease-in-out infinite;
}

@media (min-width: 1024px) {
  .hero__grid { flex-direction: row; gap: 64px; }
  .hero__text { text-align: right; }
  .hero__subtitle { margin-inline: 0; max-width: none; }
  .hero__actions { flex-direction: row; align-items: flex-start; justify-content: flex-start; }
  .hero__actions .btn { width: auto; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .hero__actions { flex-direction: row; }
  .hero__actions .btn { width: auto; }
}

/* على الشاشات الصغيرة: محتوى الـ Hero أطول من الشاشة،
   فنُخفي مؤشر التمرير ونضغط المسافات قليلاً */
@media (max-width: 860px) {
  .hero { padding-bottom: 64px; }
  .hero__grid { gap: 32px; }
  .hero__subtitle { margin-bottom: 32px; }
  .hero__logo img { width: clamp(160px, 45vw, 240px); }
  .hero__scroll { display: none; }
}

/* شاشات قصيرة (جوال أفقي مثلاً) */
@media (max-height: 700px) and (min-width: 861px) {
  .hero__scroll { display: none; }
  .hero { padding-bottom: 48px; }
}

/* ============================== 6. البرامج ============================= */
.products__list { display: flex; flex-direction: column; gap: 128px; }

.product {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

/* اللوحة التي تحمل الشعار */
.product__visual { position: relative; width: 100%; }

.product__visual .halo {
  position: absolute;
  inset: 0;
  opacity: .20;
  filter: blur(48px);
  transition: opacity .7s;
  /* التدرّج يُضبط من الجافاسكربت حسب لون البرنامج */
}
.product__visual:hover .halo { opacity: .40; }

.product__card {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 1px solid;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .7s, box-shadow .7s;
}
.product__card:hover { transform: translateY(-8px); }

/* زاوية ملوّنة في أعلى البطاقة */
.product__card .corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 128px;
  height: 128px;
  opacity: .10;
  border-bottom-left-radius: 100%;
}

.product__card img {
  position: relative;
  z-index: 10;
  width: 85%;
  height: 80%;
  object-fit: contain;
  transition: transform .4s;
}
.product__card:hover img { transform: scale(1.05); }

/* عمود النص */
.product__body { width: 100%; display: flex; flex-direction: column; gap: 32px; }

.product__badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.product__badge .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.product__title { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
.product__desc  { font-size: 1.125rem; color: var(--text-dim); line-height: 1.9; }

.product__features { display: grid; grid-template-columns: 1fr; gap: 16px; }
.product__features li { display: flex; align-items: flex-start; gap: 12px; }
.product__features .icon { width: 24px; height: 24px; margin-top: 2px; flex-shrink: 0; }
.product__features span { color: var(--text-muted); }

.product__cta { display: inline-flex; align-self: flex-start; }
.product__cta:hover { box-shadow: 0 10px 25px rgba(0, 0, 0, .4); }
.product__cta .icon { width: 20px; height: 20px; transition: transform .3s; }
.product__cta:hover .icon { transform: translateX(-4px); }

@media (min-width: 768px) {
  .product__features { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .product { flex-direction: row; gap: 96px; }
  /* الصفوف الفردية تنعكس لتبادل جهة الصورة */
  .product--reverse { flex-direction: row-reverse; }
  .product__visual, .product__body { width: 50%; }
}

/* ============================== 7. التواصل ============================= */
.contact {
  background: rgba(15, 27, 45, .5);
  border-top: 1px solid var(--line);
  text-align: center;
}
.contact h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 24px; }
.contact p {
  font-size: 1.25rem;
  color: var(--text-dim);
  margin: 0 auto 48px;
  max-width: 42rem;
}
.contact__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.contact__actions .btn { width: 100%; }

@media (min-width: 640px) {
  .contact__actions { flex-direction: row; }
  .contact__actions .btn { width: auto; }
}

/* =============================== 8. الفوتر ============================= */
.footer {
  padding-block: 48px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  z-index: 10;
}
.footer__top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}
.footer__logo img {
  height: 32px;
  width: auto;
  opacity: .7;
  filter: grayscale(1);
  transition: opacity .5s, filter .5s;
}
.footer__logo:hover img { opacity: 1; filter: grayscale(0); }

.footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-faint);
  transition: color .3s;
}
.footer__links a:hover { color: #fff; }
.footer__links .icon {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s;
}
.footer__links a:hover .icon { opacity: 1; transform: translateY(0); }

.footer__bottom {
  padding-top: 32px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: .875rem;
  color: #4B5563;
}

@media (min-width: 768px) {
  .footer__top { flex-direction: row; }
}

/* ====================== 9. الحركات والتفاعلات ========================== */

/* ظهور تدريجي عند الوصول للعنصر — يُفعّل بالجافاسكربت */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity .8s ease-out, transform .8s ease-out;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ظهور فوري عند تحميل الصفحة (عناصر الـ Hero) */
.rise {
  opacity: 0;
  transform: translateY(30px);
  animation: rise .8s ease-out forwards;
}
.rise--1 { animation-delay: .2s; }
.rise--2 { animation-delay: .4s; }
.rise--3 { animation-delay: .6s; }
.rise--4 { animation-delay: 1.5s; animation-duration: 1s; }

.zoom-in {
  opacity: 0;
  animation: zoom-in 1.2s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes rise    { to { opacity: 1; transform: none; } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.7) rotate(-10deg); }
                     to   { opacity: 1; transform: none; } }
@keyframes float   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes pulse   { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes scroll-dot { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(48px); } }

/* ========================== 10. الخلفيات ============================== */

/* خلفية القسم الرئيسي — تُرفع من لوحة التحكم */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .8s;
  pointer-events: none;
}
.hero__bg.is-active { opacity: .28; }

/* طبقة تعتيم فوق الخلفية حتى يبقى النص مقروءاً */
.hero__bg.is-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(10, 22, 40, .75), rgba(10, 22, 40, .92));
}

/* خلفية بطاقة البرنامج */
.product__card.has-bg {
  background-size: cover;
  background-position: center;
  background-blend-mode: overlay;
}

/* ===================== 11. الشرح التفصيلي (مطوي) ===================== */

.product__more { margin-top: -8px; }

.product__more summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .95rem;
  color: var(--teal);
  padding: 8px 0;
  transition: color .3s;
}
.product__more summary::-webkit-details-marker { display: none; }
.product__more summary:hover { color: var(--gold); }

.product__more summary .icon { transition: transform .3s; }
.product__more[open] summary .icon { transform: rotate(180deg); }

/* نبدّل النص بين "اقرأ" و"إخفاء" حسب الحالة */
.product__more .product__more-close,
.product__more[open] .product__more-open { display: none; }
.product__more[open] .product__more-close { display: inline; }

.product__longdesc {
  margin-top: 12px;
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--teal);
}
.product__longdesc p {
  color: var(--text-dim);
  line-height: 2;
  font-size: 1rem;
}
.product__longdesc p + p { margin-top: 14px; }

/* ====================== 12. الباقات والأسعار ========================= */

.product__plans { margin-top: 8px; }

.product__plans-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.plan {
  position: relative;
  padding: 24px 20px;
  border-radius: 18px;
  background: rgba(15, 27, 45, .55);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .3s, box-shadow .3s;
}
.plan:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }

.plan--featured { background: rgba(15, 27, 45, .8); }

.plan__badge {
  position: absolute;
  top: -11px;
  inset-inline-start: 20px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  color: #0A1628;
  letter-spacing: .03em;
}

.plan__name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.plan__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.plan__amount {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
}
.plan__currency { font-size: 1rem; color: var(--text-muted); font-weight: 600; }
.plan__period   { font-size: .85rem; color: var(--text-faint); }

.plan__features { display: flex; flex-direction: column; gap: 10px; }
.plan__features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.icon--sm { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; }
.plan__features .icon--sm { color: var(--teal); }

@media (min-width: 640px) {
  .plans { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .plans { grid-template-columns: 1fr; }
}

/* ======================= 13. المساعد الذكي =========================== */

/* الزر العائم — على الجهة المقابلة للنص (يسار في الواجهة العربية)
   حتى لا يغطي أزرار "سجّل الآن" المحاذية لليمين */
.chat-fab {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 60;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  box-shadow: 0 10px 30px rgba(87, 197, 182, .4);
  transition: transform .3s, box-shadow .3s;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 14px 36px rgba(87, 197, 182, .55); }

.chat-fab__icon { width: 28px; height: 28px; position: absolute; transition: opacity .25s, transform .25s; }
.chat-fab__icon--close { opacity: 0; transform: rotate(-90deg); }
.chat-fab.is-open .chat-fab__icon--open  { opacity: 0; transform: rotate(90deg); }
.chat-fab.is-open .chat-fab__icon--close { opacity: 1; transform: none; }

/* النافذة */
.chat-panel {
  position: fixed;
  bottom: 96px;
  inset-inline-end: 24px;
  z-index: 60;
  width: min(400px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 140px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(12, 24, 43, .97);
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: chat-in .28s cubic-bezier(.16, 1, .3, 1);
}
.chat-panel[hidden] { display: none; }

@keyframes chat-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(87, 197, 182, .07);
}
.chat-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
}
.chat-head__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 8px #4ADE80;
  animation: pulse 2s ease-in-out infinite;
}
.chat-head__close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-dim);
  transition: background-color .2s, color .2s;
}
.chat-head__close:hover { background: rgba(255,255,255,.08); color: #fff; }
.chat-head__close svg { width: 18px; height: 18px; }

/* سجل الرسائل */
.chat-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: #24405f; border-radius: 3px; }

.chat-msg { display: flex; max-width: 88%; }
.chat-msg--user      { align-self: flex-start; }
.chat-msg--assistant { align-self: flex-end; }

.chat-msg__body {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: .93rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg--user .chat-msg__body {
  background: var(--teal);
  color: #0A1628;
  font-weight: 600;
  border-bottom-right-radius: 5px;
}
.chat-msg--assistant .chat-msg__body {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-bottom-left-radius: 5px;
}
.chat-msg--error .chat-msg__body {
  background: rgba(239, 68, 68, .1);
  border-color: rgba(239, 68, 68, .3);
  color: #FCA5A5;
}

/* مؤشر الكتابة */
.chat-typing .chat-msg__body { display: flex; gap: 4px; padding: 15px; }
.chat-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: chat-bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* حقل الإرسال */
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(10, 22, 40, .6);
}
.chat-input {
  flex: 1;
  resize: none;
  max-height: 140px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: var(--font-body);
  font-size: .92rem;
  line-height: 1.6;
  transition: border-color .2s;
}
.chat-input::placeholder { color: var(--text-faint); }
.chat-input:focus { outline: none; border-color: var(--teal); }
.chat-input:disabled { opacity: .6; }

.chat-send {
  width: 42px; height: 42px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--teal);
  color: #0A1628;
  transition: background-color .2s, opacity .2s;
}
.chat-send:hover:not(:disabled) { background: #48A89A; }
.chat-send:disabled { opacity: .45; cursor: not-allowed; }
.chat-send svg { width: 19px; height: 19px; }
.chat-send.is-busy svg { animation: pulse 1s ease-in-out infinite; }

.chat-note {
  padding: 0 14px 12px;
  font-size: .72rem;
  color: var(--text-faint);
  text-align: center;
  background: rgba(10, 22, 40, .6);
}

/* على الجوال تملأ النافذة الشاشة */
@media (max-width: 520px) {
  .chat-fab { bottom: 16px; inset-inline-end: 16px; width: 54px; height: 54px; }
  .chat-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
}

/* احترام تفضيل تقليل الحركة في نظام المستخدم */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .rise, .zoom-in { opacity: 1; transform: none; }
  #particles { display: none; }
}
