 /* ===============================
       تعريف المتغيرات العامة للألوان والقيم الأساسية
    =============================== */
    :root{
      --bg: #f4f8fb;                /* لون خلفية الصفحة */
      --panel:#ffffff;              /* لون خلفية البطاقات والعناصر */
      --muted:#6b7280;              /* لون النصوص الثانوية */
      --accent-1: 32 103 178;       /* اللون الرئيسي (كمكونات RGB لاستخدامها مع rgba) */
      --accent-2: 230 126 34;       /* اللون الثانوي */
      --glass: rgba(255,255,255,0.6); /* تأثير الزجاج الشفاف */
      --radius: 14px;               /* درجة تدوير الزوايا */
      --max-width: 1100px;          /* أقصى عرض للمحتوى */
    }

    /* ===============================
       إعداد ألوان الوضع المظلم (Dark Mode)
    =============================== */
    :root.dark {
      --bg: #0f1724;
      --panel: #0b1220;
      --muted: #9aa4b2;
      --glass: rgba(255,255,255,0.03);
      color: #e2e8f0; /* اللون الأساسي للنص في الوضع المظلم */
    }

    /* ===============================
       تلوين النصوص بشكل عام
    =============================== */
    body {
      color: #0f1724; /* اللون الأساسي للنص في الوضع الفاتح */
    }

    :root.dark body {
      color: #e2e8f0; /* اللون الأساسي للنص في الوضع المظلم */
    }

    /* النصوص داخل البطاقات */
    .section-card {
      color: inherit; /* يرث اللون من العنصر الأب */
    }

    /* ===============================
       تحسين مظهر الجداول في الوضع المظلم
    =============================== */
    :root.dark .comparison-table {
      color: #e2e8f0;
      background-color: var(--panel);
    }

    :root.dark .comparison-table th {
      background-color: #1e293b;
      color: #f8fafc;
      border-color: #334155;
    }

    :root.dark .comparison-table td {
      background-color: var(--panel);
      color: #e2e8f0;
      border-color: #334155;
    }

    :root.dark .comparison-table thead th {
      border-bottom-color: #334155;
    }

    /* ===============================
       تحسين ألوان النصوص في عناصر أخرى للوضع المظلم
    =============================== */
    :root.dark .accordion-button {
      background-color: #1e293b;
      color: #e2e8f0;
    }

    :root.dark .accordion-body {
      background-color: #1e293b;
      color: #cbd5e1;
    }

    /* الروابط */
    :root.dark a {
      color: #60a5fa;
    }

    :root.dark .toc-card a {
      color: #cbd5e1;
    }

    :root.dark .toc-card a.active, 
    :root.dark .toc-card a:hover {
      color: #60a5fa;
    }

    /* التذييل */
    :root.dark footer {
      color: #94a3b8;
    }

    /* ===============================
       إعدادات عامة للجسم والتخطيط
    =============================== */
    html,body{height:100%;}
    body{
      margin:0; padding:0; min-height:100%;
      font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
      background: radial-gradient(1200px 600px at 10% 10%, rgba(var(--accent-1)/0.08) 0%, transparent 8%), var(--bg);
      color: #0f1724;
      -webkit-font-smoothing:antialiased;
      -moz-osx-font-smoothing:grayscale;
      line-height:1.65;
      display:flex; justify-content:center; padding:28px 16px;
    }

    .wrapper{width:100%; max-width:var(--max-width);}

    /* ===============================
       قسم الـ HERO / الغلاف العلوي
    =============================== */
    .hero{
      background: linear-gradient(135deg, rgba(var(--accent-1)/1) 0%, rgba(46,134,193,0.9) 50%, rgba(var(--accent-2)/1) 100%);
      color: white;
      border-radius: var(--radius);
      padding:28px;
      box-shadow: 0 10px 30px rgba(15,23,36,0.08);
      overflow:hidden;
      position:relative;
    }

    .hero-grid{display:grid; grid-template-columns: 1fr 420px; gap:20px; align-items:center;}
    .hero h1{font-size:1.9rem; margin:0 0 8px 0; font-weight:700; letter-spacing: -0.4px}
    .hero p.lead{opacity:0.92; margin:0 0 12px 0}
    .hero .meta{font-size:0.9rem; opacity:0.92}
    .hero .badge{background:rgba(255,255,255,0.12); color:#fff; border-radius:999px; padding:6px 10px; font-weight:600}

    .hero-graphic{display:flex; align-items:center; justify-content:center}
    .cover-img{width:420px; max-width:100%; height:auto; border-radius:10px; box-shadow:0 12px 30px rgba(2,6,23,0.25); border:1px solid rgba(255,255,255,0.06)}

    /* ===============================
       شريط الأدوات العلوي داخل الـ hero
    =============================== */
    .top-actions{display:flex; gap:8px; align-items:center; justify-content:flex-end}
    .btn-ghost{background:transparent; border:1px solid rgba(255,255,255,0.12); color: #fff}

    /* ===============================
       هيكل الصفحة العام (المحتوى + الفهرس)
    =============================== */
    .content{display:grid; grid-template-columns: 280px 1fr; gap:20px; margin-top:18px}

    /* ===============================
       الشريط الجانبي / جدول المحتويات
    =============================== */
    .toc-card{
      position:sticky;
      top:26px;
      align-self:start;
      border-radius:12px;
      background:var(--panel);
      padding:14px;
      box-shadow:0 6px 18px rgba(15,23,36,0.06)
    }
    .toc-card h3{margin:0 0 10px 0; color: rgba(var(--accent-1)/1);}
    .toc-card a{display:block; padding:8px 10px; border-radius:8px; color:var(--muted); text-decoration:none}
    .toc-card a.active, .toc-card a:hover{
      background:linear-gradient(90deg, rgba(var(--accent-1)/0.08), rgba(var(--accent-2)/0.04));
      color:rgb(var(--accent-1));
      font-weight:600
    }

    /* ===============================
       بطاقات الأقسام الرئيسية
    =============================== */
    .section-card{
      background:var(--panel);
      border-radius:12px;
      padding:18px;
      box-shadow:0 6px 18px rgba(2,6,23,0.04);
      margin-bottom:16px;
      transition:transform .36s cubic-bezier(.2,.9,.3,1), box-shadow .36s
    }
    .section-card:hover{
      transform:translateY(-6px);
      box-shadow:0 20px 40px rgba(2,6,23,0.08)
    }
    .section-card h2{color: rgb(var(--accent-1)); margin-top:0}
    .caption{font-size:0.85rem; color:var(--muted); text-align:right}

    .sys-img{width:100%; height:auto; border-radius:8px; display:block; margin:8px 0; box-shadow:0 6px 18px rgba(2,6,23,0.06)}

    /* نصوص مساعدة صغيرة */
    .muted{color:var(--muted)}
    .q{color:rgb(var(--accent-2)); font-weight:700}

    /* ===============================
       تذييل الصفحة
    =============================== */
    footer {
    margin-top: 40px;
    text-align: center;
    background: var(--panel);
    padding: 14px 22px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    color: var(--muted);
    font-size: 0.95rem;
    width: 100%;
    }

    /* ===============================
       استجابة التصميم للشاشات الصغيرة
    =============================== */
    @media (max-width: 992px){
      .hero-grid{grid-template-columns:1fr 300px}
      .content{grid-template-columns: 1fr;}
      .toc-card{position:relative; top:auto}
    }
    @media (max-width:576px){
      body{padding:18px}
      .hero{padding:18px}
      .hero h1{font-size:1.4rem}
      .hero-grid{grid-template-columns:1fr}
      .hero-graphic{order:-1}
    }

    /* ===============================
       تأثيرات الظهور عند التمرير
    =============================== */
    .reveal{opacity:0; transform: translateY(10px); transition:opacity .6s ease, transform .6s ease}
    .reveal.visible{opacity:1; transform:none}

    /* ===============================
       إعدادات الطباعة
    =============================== */
    @media print{
      body{background:white; color:black}
      .hero{box-shadow:none; border-radius:0}
      nav, .toc-card, .top-actions { display:none }
      .section-card{box-shadow:none}
    }

    /* ===============================
       أقسام الفهرس القابلة للطي (Collapsible TOC)
    =============================== */
    .toc-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      margin-bottom: 10px;
      padding: 8px 12px;
      border-radius: 8px;
      background: linear-gradient(90deg, rgba(var(--accent-1)/0.05), rgba(var(--accent-2)/0.02));
      transition: background 0.3s ease;
    }
    
    .toc-header:hover {
      background: linear-gradient(90deg, rgba(var(--accent-1)/0.08), rgba(var(--accent-2)/0.04));
    }
    
    .toc-header h3 {
      margin: 0;
      font-size: 1.1rem;
    }
    
    .toc-toggle {
      background: none;
      border: none;
      color: rgba(var(--accent-1)/1);
      font-size: 1.2rem;
      cursor: pointer;
      transition: transform 0.3s ease;
      padding: 4px;
      border-radius: 4px;
    }
    
    .toc-toggle:hover {
      background: rgba(var(--accent-1)/0.1);
    }
    
    .toc-toggle.collapsed {
      transform: rotate(180deg);
    }
    
    .toc-content {
      transition: max-height 0.3s ease, opacity 0.3s ease;
      overflow: hidden;
      max-height: 500px;
      opacity: 1;
    }
    
    .toc-content.collapsed {
      max-height: 0;
      opacity: 0;
    }
    
    .toc-section {
      margin-bottom: 16px;
    }
    
    .toc-section:last-child {
      margin-bottom: 0;
    }
    
    /* ===============================
       زر الطفو للصعود إلى أعلى الصفحة - محدث
    =============================== */	
    .floating-button {
      /* التموضع والتخطيط */
      position: fixed;               /* تثبيت الزر في مكانه أثناء التمرير */
      bottom: 20px;                  /* المسافة من الأسفل */
      left: 20px;                    /* المسافة من اليسار */
      width: 50px;                   /* عرض الزر */
      height: 50px;                  /* ارتفاع الزر */
    
      /* المظهر والتصميم */
      background-color: #210f80;     /* لون الخلفية الأزرق الداكن */
      border-radius: 50%;            /* جعل الزر دائرياً */
      display: none;                 /* إخفاء الزر في البداية */
      align-items: center;           /* محاذاة المحتوى عمودياً في المنتصف */
      justify-content: center;       /* محاذاة المحتوى أفقياً في المنتصف */
      cursor: pointer;               /* تغيير شكل المؤشر إلى يد عند التمرير */
    
      /* التأثيرات البصرية */
      opacity: 0.8;                  /* شفافية خفيفة */
      box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5); /* ظل خفيف حول الزر */
      transition: all 0.3s ease;     /* تأثيرات انتقالية سلسة */
      z-index: 1000;                 /* التأكد من ظهور الزر فوق كل العناصر */
    }

    /* تأثيرات عند تمرير الماوس فوق الزر */
    .floating-button:hover {
      background-color: #fbd034;     /* تغيير اللون إلى الأصفر عند التمرير */
      transform: scale(1.1);         /* تكبير الزر قليلاً عند التمرير */
      opacity: 1;                    /* إزالة الشفافية عند التمرير */
    }

    /* تصميم السهم داخل الزر */
    .arrow-up {
      /* إنشاء شكل السهم باستخدام حدود CSS */
      width: 0;
      height: 0;
      border-left: 12px solid transparent;     /* الحد الأيسر شفاف */
      border-right: 12px solid transparent;    /* الحد الأيمن شفاف */
      border-bottom: 25px solid white;         /* الحد السفلي يشكل رأس السهم */
      
      /* تموضع السهم في منتصف الزر */
      position: absolute;
      top: 50%;                    /* منتصف عمودياً */
      left: 50%;                   /* منتصف أفقياً */
      transform: translate(-50%, -50%); /* ضبط المركز بدقة */
    }

    /* ===============================
       تحسينات للوضع المظلم
    =============================== */
    :root.dark .floating-button {
      background-color: #3b82f6;    /* لون أزرق أكثر وضوحاً في الوضع المظلم */
      box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.7);
    }

    :root.dark .floating-button:hover {
      background-color: #fbbf24;    /* لون أصفر مختلف قليلاً في الوضع المظلم */
    }
