/* =====================================================================
   🎨 نظام الثيمات الموحد (Unified Multi-Theme System)
   مجمّع لتقليل طلبات الشبكة وتسريع عرض الصفحة بنسبة 100%
   ===================================================================== */

/* =====================================================================
   🏛️ الثيم الكلاسيكي الافتراضي (Classic Light Theme)
   متوافق 100% مع معايير الوصول والتباين WCAG 2.1 AA/AAA
   ===================================================================== */

:root,
html[data-theme="light"] {
  color-scheme: light;
  --theme-name: "light";

  /* خلفيات الأسطح */
  --bg: #f7f5f0;
  --bg-outer: #efeae0;
  --surface: #ffffff;
  --surface-2: #f4f6f8;

  /* النصوص والطباعة */
  --ink: #1e293b;
  --ink-heading: #172554;
  --muted: #526071;

  /* الحدود والفواصل */
  --line: #e2e8f0;
  --line-strong: #94a3b8;

  /* الألوان التمييزية الأساسية والفرعية */
  --accent: #6f2d35;
  --accent-2: #8c3842;
  --navy: #334155;
  --navy-2: #1e293b;

  /* ألوان التنبيه والنتائج */
  --ok: #15803d;
  --err: #b91c1c;
  --gold: #a16207;
  --gold-light: #fef08a;

  /* الشارات والكبسولات */
  --badge-bg: #e2e8f0;
  --badge-text: #1e293b;

  /* الهيدر العلوي الأصلي والكلاسيكي */
  --topbar-bg: radial-gradient(1200px 220px at 82% -60%, rgba(244,217,138,.14), transparent 60%),
               radial-gradient(900px 200px at 10% -40%, rgba(156,74,58,.20), transparent 55%),
               linear-gradient(180deg, #46545f 0%, #3c4a56 55%, #34414c 100%);
  --topbar-border: rgba(244,217,138,.35);
  --topbar-line-glow: linear-gradient(90deg, transparent 0%, rgba(217,169,63,.85) 18%, rgba(244,217,138,.95) 50%, rgba(217,169,63,.85) 82%, transparent 100%);
  --brand-mark-bg: radial-gradient(circle at 30% 25%, #55656f 0%, #3c4a56 60%, #2e3944 100%);

  /* هندسة المكونات */
  --radius: 10px;
  --shadow: 0 1px 4px rgba(31, 41, 51, .10);
}



/* =====================================================================
   🌙 الوضع الليلي المظلم (Dark Theme)
   متوافق 100% مع معايير الوصول والتباين WCAG 2.1 AA/AAA
   ===================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-name: "dark";

  /* خلفيات الأسطح الداكنة متدرجة العمق */
  --bg: #0f172a;
  --bg-outer: #090d16;
  --surface: #1e293b;
  --surface-2: #273549;

  /* النصوص والطباعة */
  --ink: #f1f5f9;
  --ink-heading: #fbbf24;
  --muted: #94a3b8;

  /* الحدود والفواصل */
  --line: #334155;
  --line-strong: #475569;

  /* الألوان التمييزية والتركيز - نسبة تباين فائقة */
  --accent: #e11d48;
  --accent-2: #fb7185;
  --navy: #94a3b8;
  --navy-2: #cbd5e1;

  /* ألوان التنبيه والنتائج */
  --ok: #34d399;
  --err: #f87171;
  --gold: #fbbf24;
  --gold-light: #fef08a;

  /* الشارات والكبسولات */
  --badge-bg: #273549;
  --badge-text: #f1f5f9;

  /* الهيدر العلوي المظلم والفخم */
  --topbar-bg: linear-gradient(180deg, #1e293b 0%, #151d2a 55%, #0f172a 100%);
  --topbar-border: rgba(251, 191, 36, 0.35);
  --topbar-line-glow: linear-gradient(90deg, transparent 0%, rgba(251, 191, 36, 0.8) 20%, rgba(253, 230, 138, 0.95) 50%, rgba(251, 191, 36, 0.8) 80%, transparent 100%);
  --brand-mark-bg: radial-gradient(circle at 30% 25%, #2a3b50 0%, #1e293b 60%, #0f172a 100%);

  /* هندسة المكونات */
  --shadow: 0 4px 20px rgba(0, 0, 0, .55);
}



/* =====================================================================
   🌿 الأخضر الزمردي العدلي (Emerald Theme)
   متوافق 100% مع معايير الوصول والتباين WCAG 2.1 AA/AAA
   ===================================================================== */

html[data-theme="emerald"] {
  color-scheme: light;
  --theme-name: "emerald";

  /* خلفيات الأسطح المريحة للعين */
  --bg: #f0fdf4;
  --bg-outer: #e2f7e9;
  --surface: #ffffff;
  --surface-2: #eaf8ef;

  /* النصوص والطباعة */
  --ink: #052e16;
  --ink-heading: #14532d;
  --muted: #3d6850;

  /* الحدود والفواصل */
  --line: #c7eed5;
  --line-strong: #72b88b;

  /* الألوان التمييزية والتركيز */
  --accent: #15803d;
  --accent-2: #166534;
  --navy: #166534;
  --navy-2: #14532d;

  /* ألوان التنبيه والنتائج */
  --ok: #16a34a;
  --err: #b91c1c;
  --gold: #a16207;
  --gold-light: #fef08a;

  /* الشارات والكبسولات */
  --badge-bg: #dcfce7;
  --badge-text: #14532d;

  /* الهيدر العلوي الزمردي العدلي الفاخر */
  --topbar-bg: linear-gradient(180deg, #1b4d35 0%, #133c28 55%, #0c291b 100%);
  --topbar-border: rgba(167, 243, 208, 0.40);
  --topbar-line-glow: linear-gradient(90deg, transparent 0%, rgba(52, 211, 153, 0.85) 18%, rgba(167, 243, 208, 0.95) 50%, rgba(52, 211, 153, 0.85) 82%, transparent 100%);
  --brand-mark-bg: radial-gradient(circle at 30% 25%, #236345 0%, #154630 60%, #0d2e1f 100%);

  /* هندسة المكونات */
  --shadow: 0 2px 8px rgba(20, 69, 47, .08);
}



/* =====================================================================
   👑 الذهبي الملكي (Royal Gold Theme)
   متوافق 100% مع معايير الوصول والتباين WCAG 2.1 AA/AAA
   ===================================================================== */

html[data-theme="gold"] {
  color-scheme: light;
  --theme-name: "gold";

  /* خلفيات الأسطح الملكية الدافئة */
  --bg: #fdfbf7;
  --bg-outer: #f6efe0;
  --surface: #ffffff;
  --surface-2: #fcf6e8;

  /* النصوص والطباعة */
  --ink: #292218;
  --ink-heading: #78350f;
  --muted: #6b5c46;

  /* الحدود والفواصل */
  --line: #ede2cd;
  --line-strong: #dec89f;

  /* الألوان التمييزية والتركيز */
  --accent: #92400e;
  --accent-2: #b45309;
  --navy: #3f3930;
  --navy-2: #28241e;

  /* ألوان التنبيه والنتائج */
  --ok: #15803d;
  --err: #b91c1c;
  --gold: #b45309;
  --gold-light: #fef3c7;

  /* الشارات والكبسولات */
  --badge-bg: #fef3c7;
  --badge-text: #78350f;

  /* الهيدر العلوي الملكي الذهبي الفاخر */
  --topbar-bg: linear-gradient(180deg, #3c2d18 0%, #2b1f0e 55%, #1c1408 100%);
  --topbar-border: rgba(251, 191, 36, 0.45);
  --topbar-line-glow: linear-gradient(90deg, transparent 0%, rgba(245, 158, 11, 0.9) 18%, rgba(254, 240, 138, 0.95) 50%, rgba(245, 158, 11, 0.9) 82%, transparent 100%);
  --brand-mark-bg: radial-gradient(circle at 30% 25%, #4e3a1f 0%, #352611 60%, #1e1509 100%);

  /* هندسة المكونات */
  --shadow: 0 2px 8px rgba(179, 134, 34, .10);
}



/* =====================================================================
   🍷 البورغاندي والياقوتي الملكي المتوازن (Royal Burgundy Velvet Theme)
   مستوحى بدقة من تدرجات وباليت Slidesgo (Paraphilia Case Study):
   - التدرج الياقوتي: #da3b3b (Crimson) ➔ #9e1d2e (Wine) ➔ #5a0d1b (Burgundy)
   - وسط الصفحة (الكونتينر): لون عاجي مخملي دافئ ومريح للعين (#f0dce1 / #fcf5f6) بدون سطوع فاهي أو سواد قاتم
   - الهيدر والفوتر: تدرج عنابي ملكي فاخر مع خطوط توهج ياقوتية
   - النصوص: نبيذية داكنة غنية وعالية التباين والوضوح
   ===================================================================== */

html[data-theme="burgundy"] {
  color-scheme: light;
  --theme-name: "burgundy";

  /* خلفيات الأسطح والكونتينر المركزي المخملي الدافئ المتوازن */
  --bg: #efe0e4;
  --bg-outer: linear-gradient(180deg, #2b050d 0%, #1a0308 55%, #0f0104 100%);
  --surface: #fdf6f7;
  --surface-2: #e5cbd2;
  --surface-3: #d9b6bf;

  /* النصوص والطباعة (نبيذي داكن غني ومريح جداً للقراءة) */
  --ink: #23050c;
  --ink-heading: #6e0f1e;
  --muted: #74404b;

  /* الحدود والفواصل العنابية الناعمة */
  --line: #cca6b0;
  --line-strong: #b5828e;

  /* الألوان التمييزية والتدرجات الياقوتية المشرقة */
  --accent: #9e1d2e;
  --accent-light: #da3b3b;
  --accent-2: #c42f43;
  --accent-gradient: linear-gradient(135deg, #da3b3b 0%, #9e1d2e 55%, #6d1222 100%);
  --navy: #5a0d1b;
  --navy-2: #260209;

  /* ألوان التنبيه والنتائج */
  --ok: #15803d;
  --err: #da3b3b;
  --gold: #b45309;
  --gold-light: #fde68a;

  /* الشارات والكبسولات */
  --badge-bg: #e8cad1;
  --badge-text: #630c1b;
  --badge-border: #caa0aa;

  /* الشريط العلوي والإعلانات */
  --banner-bg: linear-gradient(90deg, #9e1d2e 0%, #da3b3b 50%, #9e1d2e 100%);
  --banner-color: #ffffff;

  /* الهيدر العلوي الملكي الفاخر */
  --topbar-bg: linear-gradient(135deg, #6e0f1e 0%, #460913 50%, #210308 100%);
  --topbar-border: rgba(218, 59, 59, 0.45);
  --topbar-line-glow: linear-gradient(90deg, transparent 0%, rgba(218, 59, 59, 0.85) 18%, rgba(255, 225, 232, 0.95) 50%, rgba(218, 59, 59, 0.85) 82%, transparent 100%);
  --brand-mark-bg: radial-gradient(circle at 30% 25%, #da3b3b 0%, #851221 55%, #240208 100%);

  /* الفوتر الملكي المتناسق تماماً مع الهيدر */
  --footer-bg: linear-gradient(180deg, #460913 0%, #2d040c 55%, #160105 100%);
  --footer-color: #f7dbe1;
  --footer-border: rgba(218, 59, 59, 0.45);
  --footer-line-glow: linear-gradient(90deg, transparent 0%, rgba(218, 59, 59, 0.85) 18%, rgba(255, 225, 232, 0.95) 50%, rgba(218, 59, 59, 0.85) 82%, transparent 100%);

  /* هندسة المكونات والظلال */
  --shadow: 0 4px 16px rgba(90, 13, 27, 0.1);
  --shadow-lg: 0 12px 28px -5px rgba(90, 13, 27, 0.2), 0 8px 12px -6px rgba(90, 13, 27, 0.12);
  --focus-ring: 0 0 0 3px rgba(218, 59, 59, 0.28);
}

/* =====================================================================
   🎨 تطبيق الطابع البورغاندي المتوازن على كافة مكونات الصفحة
   ===================================================================== */

/* إطار الصفحة الخارجي المخملي */
html[data-theme="burgundy"] body {
  background:
    radial-gradient(1300px 650px at 50% -100px, rgba(218, 59, 59, 0.18) 0%, rgba(110, 18, 34, 0.1) 45%, transparent 80%),
    linear-gradient(180deg, #2b050d 0%, #1a0308 55%, #0f0104 100%);
  color: var(--ink);
}

/* الكونتينر ووسط الصفحة الداكن بدرجة مريحة ومتناسقة */
html[data-theme="burgundy"] .main-sheet {
  background: var(--bg) !important;
  border-inline: 1px solid rgba(218, 59, 59, 0.35);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(218, 59, 59, 0.2);
}

/* الأزرار التفاعلية بتدرج Slidesgo الياقوتي */
html[data-theme="burgundy"] .btn-primary,
html[data-theme="burgundy"] .bg-primary,
html[data-theme="burgundy"] .button-primary {
  background: linear-gradient(135deg, #da3b3b 0%, #9e1d2e 55%, #6d1222 100%) !important;
  color: #ffffff !important;
  border-color: #8c1626 !important;
  box-shadow: 0 3px 12px rgba(158, 29, 46, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

html[data-theme="burgundy"] .btn-primary:hover,
html[data-theme="burgundy"] .button-primary:hover {
  background: linear-gradient(135deg, #eb4d4d 0%, #b02134 55%, #7e1627 100%) !important;
  box-shadow: 0 5px 18px rgba(218, 59, 59, 0.45) !important;
  transform: translateY(-1px);
}

/* عناصر الفلترة والتصنيفات والتبويبات النشطة */
html[data-theme="burgundy"] .filter-item.on,
html[data-theme="burgundy"] .pill.active,
html[data-theme="burgundy"] .tab.active,
html[data-theme="burgundy"] .nav-tab.active {
  background: linear-gradient(135deg, #da3b3b 0%, #9e1d2e 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(218, 59, 59, 0.3);
  border-color: #da3b3b !important;
}

/* بطاقات البحث والمربعات والعناوين */
html[data-theme="burgundy"] .results-head-card,
html[data-theme="burgundy"] .card,
html[data-theme="burgundy"] .hero-box,
html[data-theme="burgundy"] .doc-card,
html[data-theme="burgundy"] .stat-card,
html[data-theme="burgundy"] .stat-card-v2,
html[data-theme="burgundy"] .profile-hero,
html[data-theme="burgundy"] .side-box {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

html[data-theme="burgundy"] .card:hover,
html[data-theme="burgundy"] .doc-card:hover {
  border-color: #b5828e;
  box-shadow: 0 8px 24px rgba(90, 13, 27, 0.16);
}

/* حقول الإدخال وصناديق البحث */
html[data-theme="burgundy"] input,
html[data-theme="burgundy"] select,
html[data-theme="burgundy"] textarea,
html[data-theme="burgundy"] .searchbox input {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

html[data-theme="burgundy"] input:focus,
html[data-theme="burgundy"] select:focus,
html[data-theme="burgundy"] textarea:focus,
html[data-theme="burgundy"] .searchbox input:focus {
  border-color: #da3b3b !important;
  box-shadow: 0 0 0 3px rgba(218, 59, 59, 0.25) !important;
}

/* ترويسات الجداول */
html[data-theme="burgundy"] thead th,
html[data-theme="burgundy"] .table thead th,
html[data-theme="burgundy"] .doc-table thead th {
  background: linear-gradient(135deg, #6d1222 0%, #460913 100%) !important;
  color: #ffffff !important;
  border-bottom: 2px solid #da3b3b !important;
  font-weight: 700;
}

html[data-theme="burgundy"] tbody tr:hover,
html[data-theme="burgundy"] tbody tr:nth-child(even):hover {
  background: #e9d3d9 !important;
}

/* الشارات والكبسولات */
html[data-theme="burgundy"] .badge,
html[data-theme="burgundy"] .badge-burgundy,
html[data-theme="burgundy"] .tag-accent {
  background: var(--badge-bg) !important;
  color: var(--badge-text) !important;
  border: 1px solid var(--badge-border) !important;
}

/* الروابط والنصوص المميزة */
html[data-theme="burgundy"] a {
  color: #9e1d2e;
}

html[data-theme="burgundy"] a:hover {
  color: #da3b3b;
}

html[data-theme="burgundy"] mark,
html[data-theme="burgundy"] .highlight {
  background: rgba(218, 59, 59, 0.2);
  color: #5a0d1b;
  border-bottom: 2px solid #da3b3b;
}


