/* ============================================================
   أفق المعرفة — التنسيق العام
   خط العرض: Cairo (عناوين) + Tajawal (نصوص) — عبر Google Fonts
   ============================================================ */

:root {
  /* ألوان الهوية */
  --bg: #F9FBFC;
  --muted-bg: #EEF4F6;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #94A3B8; /* تباين 2.56:1 على أبيض — استخدم فقط مع نص كبير/عريض (≥18.7px عريض) وليس لنص المحتوى العادي، حفاظًا على WCAG AA */
  --primary: #0F4C5C;
  --primary-dark: #0A3A47;
  --secondary: #1F7A8C;
  --accent: #E9A426;
  --inverse: #0F2A33;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --success-bg: #E4F5EA;
  --success-border: #BFE6CC;
  --neutral-bg: #F1F1F1;
  --focus: var(--accent);

  /* ألوان أنواع الموارد — شارات فاتحة + نص/حدود بدرجة داكنة لضمان تباين واضح */
  --type-book: #5B21B6;
  --type-book-bg: #EDE9FE;
  --type-summary: #0F766E;
  --type-summary-bg: #CCFBF1;
  --type-questions: #2E9E5B;
  --type-questions-bg: #E4F5EA;
  --type-lecture: #0E7490;
  --type-lecture-bg: #E0F2F7;
  --type-slides: #1F7A8C;
  --type-slides-bg: #E6F0F3;
  --type-notes: #92400E;
  --type-notes-bg: #FEF3C7;
  --type-past_exam: #9D174D;
  --type-past_exam-bg: #FCE7F3;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(18, 38, 42, 0.06);
  --shadow-hover: 0 8px 24px rgba(18, 38, 42, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .display {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 0 0 .4em;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }

/* -------------------- تخطي إلى المحتوى (UI-7B) -------------------- */

.skip-link {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  transform: translateY(-150%);
  background: var(--primary-dark);
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  padding: 12px 20px;
  border-end-end-radius: var(--radius-sm);
  z-index: 1000;
  transition: transform .15s;
}

.skip-link:focus {
  transform: translateY(0);
}

/* -------------------- العودة إلى الأعلى (UI-8) -------------------- */

.back-to-top {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  text-decoration: none;
  box-shadow: var(--shadow-hover);
  z-index: 90;
  transition: background .15s;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--primary-dark);
}

/* -------------------- الرأس -------------------- */

.site-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.header-nav {
  font-size: .9rem;
  opacity: .9;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .28); }

/* حالة "الحساب مرتبط بـGoogle" فقط — #account-trigger يتحول من دائرة
   ثابتة 44x44 (أيقونة واحدة) إلى حبة (pill) بعرض تلقائي تحتوي صورة
   الحساب + الاسم. لا تغيير على .icon-btn الأساسية (تبقى كما هي لبقية
   الأزرار وللحساب في حالة الضيف). */
.icon-btn.account-linked {
  width: auto;
  padding-inline: 6px 14px;
  gap: 8px;
}
.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.account-name {
  font-size: .85rem;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------- قائمة الحساب الجانبية (Account Sidebar) --------------------
   تُبنى بالكامل عبر JS (js/auth.js: buildAccountSidebar) بنفس نمط نافذة
   المصادقة (.modal-overlay) ونافذة البحث الشامل — عنصر واحد يُعاد استخدامه
   في كل صفحة تحمّل auth.js، لا تكرار HTML لكل صفحة. تظهر من جهة اليمين
   فعليًا (right: 0) بصرف النظر عن dir="rtl" الحالي على <html>، كما هو
   مطلوب صراحةً لهذه الميزة تحديدًا. */

.account-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 38, 42, .5);
  z-index: 100;
}
.account-sidebar-overlay[hidden] { display: none; }

.account-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 88vw;
  background: var(--surface);
  box-shadow: var(--shadow-hover);
  z-index: 101;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}
.account-sidebar[hidden] { display: none; }

.account-sidebar-header {
  display: flex;
  justify-content: flex-start;
  padding: 14px 14px 0;
}

.account-sidebar-close {
  background: var(--muted-bg);
  color: var(--ink);
  width: 38px;
  height: 38px;
  font-size: .9rem;
}
.account-sidebar-close:hover { background: var(--line); }

.account-sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 20px 20px;
  border-bottom: 1px solid var(--line);
}

.account-sidebar-avatar-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--muted-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.account-sidebar-avatar { width: 100%; height: 100%; object-fit: cover; }

.account-sidebar-name {
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  word-break: break-word;
}
.account-sidebar-status { font-size: .85rem; color: var(--ink-soft); margin: 0; }

.account-sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 2px;
}

.account-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-family: 'Tajawal', sans-serif;
  font-size: .95rem;
  background: none;
  border: none;
  width: 100%;
  text-align: start;
  cursor: pointer;
}
.account-sidebar-link:hover,
.account-sidebar-link:focus-visible { background: var(--muted-bg); }

.account-sidebar-link-disabled { color: var(--ink-soft); cursor: default; }

.account-sidebar-icon { font-size: 1.15rem; flex-shrink: 0; }

.account-sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.account-sidebar-signout { color: var(--danger); }
.account-sidebar-signout:hover,
.account-sidebar-signout:focus-visible { background: var(--danger-bg); }

/* -------------------- المحتوى الأساسي -------------------- */

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* -------------------- Breadcrumb (مسار التنقّل) -------------------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: var(--ink-soft);
  margin-bottom: 22px;
}

.breadcrumb a {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background .15s, color .15s;
}

.breadcrumb a:hover { background: var(--primary); color: #fff; }

.breadcrumb .sep { color: var(--line-strong); }

.breadcrumb .current {
  padding: 4px 10px;
  color: var(--primary-dark);
  font-weight: 700;
}

/* -------------------- صندوق البحث -------------------- */

.search-hero {
  background: var(--primary);
  border-bottom: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 40px 24px;
  box-shadow: var(--shadow-hover);
  margin-bottom: 32px;
  text-align: center;
}

.search-hero h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #fff;
}

.search-hero p {
  color: rgba(255, 255, 255, .85);
  margin-bottom: 24px;
}

.search-form {
  display: flex;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.search-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  background: var(--muted-bg);
  color: var(--ink);
}

.search-input:focus { border-color: var(--primary); outline: none; }

/* داخل الـHero فقط: الحقل يندمج مع الكبسولة البيضاء المحيطة به بدل إطاره
   الافتراضي، دون أي تأثير على مربع البحث الشامل (.global-search-box) الذي
   يستخدم نفس صنف .search-input في مكان آخر من الموقع. */
.search-hero .search-input {
  background: transparent;
  border: 2px solid transparent;
}

.search-hero .search-input:focus {
  border-color: var(--primary);
}

/* ====================================================================
   الصفحة الرئيسية العامة — تجديد الواجهة (Homepage Premium Redesign)
   ====================================================================
   كل ما يلي مخصّص حصريًا لعناصر index.html (بادئة home-) ولا يمس أي
   صنف مشترك مع صفحات أخرى (.search-hero/.search-form/.search-input
   تبقى كما هي لصفحة النتائج search.html؛ .grid/.card/.resource-card
   تبقى كما هي في كل الموقع). الألوان والمسافات وأنصاف الأقطار كلها من
   نفس متغيرات الهوية الحالية (UI-3)، بلا لوحة ألوان جديدة. */

.home-hero {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  border-bottom: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 44px 24px;
  box-shadow: var(--shadow-hover);
  margin-bottom: 40px;
}

/* توهّج زخرفي هادئ خلف المحتوى — CSS فقط، بلا أي صورة/أصل جديد،
   وبلا أي تأثير على قابلية القراءة (فوق طبقته مباشرة). */
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(480px 320px at 88% -10%, rgba(201, 165, 103, .16), transparent 70%),
    radial-gradient(420px 300px at -10% 110%, rgba(255, 255, 255, .05), transparent 70%);
}

.home-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.home-hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .92);
  font-size: .78rem;
  font-weight: 700;
}

.home-eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 165, 103, .22);
  flex-shrink: 0;
}

.home-hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 1.15rem + 3.2vw, 3.1rem);
  line-height: 1.18;
  margin: 0;
  max-width: 16ch;
}

.home-hero-lead {
  color: rgba(255, 255, 255, .82);
  font-size: clamp(1rem, .92rem + .3vw, 1.12rem);
  line-height: 1.75;
  max-width: 46ch;
  margin: 0;
}

.home-hero-content .search-form {
  margin: 6px 0 0;
  max-width: 480px;
  width: 100%;
}

/* نفس منطق الاندماج المستخدم أصلًا في .search-hero .search-input:
   الحقل يذوب داخل الكبسولة البيضاء المحيطة به بدل إطاره الرمادي
   الافتراضي، بلا أي تأثير على .search-input في أي مكان آخر. */
.home-hero .search-input {
  background: transparent;
  border: 2px solid transparent;
}

.home-hero .search-input:focus {
  border-color: var(--primary);
}

.home-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  transition: background .15s, border-color .15s;
}

.home-hero-secondary:hover,
.home-hero-secondary:focus-visible {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .5);
}

.home-hero-secondary span { transition: transform .15s; }
.home-hero-secondary:hover span { transform: translateX(-3px); }

.home-hero-panel {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.home-hero-panel-title {
  color: var(--ink-soft);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  margin: 0 0 6px;
  padding: 0 4px;
}

.home-quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 700;
  font-size: .92rem;
  border-top: 1px solid var(--line);
  transition: background .15s;
}

.home-hero-panel .home-quick-link:first-of-type { border-top: none; }

.home-quick-link:hover,
.home-quick-link:focus-visible {
  background: var(--muted-bg);
}

.home-quick-arrow {
  color: var(--primary);
  transition: transform .15s;
  flex-shrink: 0;
}

.home-quick-link:hover .home-quick-arrow { transform: translateX(-3px); }

/* -------------------- تجميع أقسام المحتوى في الرئيسية -------------------- */

.home-section { margin-bottom: 48px; }

.home-section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.home-section-head h2 {
  margin: 0;
  white-space: nowrap;
}

.home-section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, var(--line) 0%, transparent 100%);
}

@media (min-width: 960px) {
  .home-hero { padding: 60px 48px; }
  .home-hero-inner { grid-template-columns: 1.15fr .85fr; gap: 40px; }
  .home-hero-panel { padding: 22px; align-self: stretch; }
}

@media (max-width: 480px) {
  .home-hero { padding: 32px 18px; }
  .home-section-line { display: none; }
  .home-section-head h2 { white-space: normal; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 22px;
  border-radius: 999px;
  border: none;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--muted-bg); border-color: var(--primary-dark); color: var(--primary-dark); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--danger);
  box-shadow: 0 1px 4px rgba(192, 57, 43, .3);
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-sm { padding: 8px 14px; font-size: .82rem; min-height: 44px; }

/* -------------------- تدرّج إجراءات لوحة التحكم (UI-6) --------------------
   هدف هذا القسم فقط: تمييز بصري بين إجراء محايد (تعديل/عرض)، إجراء يُغيّر
   حالة عنصر (تفعيل/تعطيل/نشر/إخفاء/توثيق/إلغاء التوثيق)، وإجراء حذف —
   دون أي إيحاء بأن تغيير الحالة يعادل الحذف. تُستخدم فقط رموز الهوية
   الحالية (--accent, --line-strong, --bg, --ink-soft, --primary-dark)،
   بلا ألوان جديدة. */

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* إجراء يُفعّل/يُظهر/يُثبّت شيئًا (نشر، تفعيل، توثيق، إظهار) —
   إبراز هادئ بلون التمييز الذهبي الحالي للهوية، بلا امتلاء كامل حتى لا
   يُقرأ كإجراء حذف. */
.btn-state-on {
  background: rgba(201, 165, 103, .14);
  border: 2px solid var(--accent);
  color: var(--primary-dark);
}
.btn-state-on:hover { background: rgba(201, 165, 103, .26); }

/* إجراء يُعطّل/يُخفي/يُلغي شيئًا (تعطيل، إخفاء، إلغاء التوثيق) —
   معالجة ثانوية أهدأ من "تعديل"، تشير إلى تقليل الظهور دون إيحاء
   بالخطورة أو الحذف. */
.btn-state-off {
  background: var(--line);
  border: 2px solid var(--line-strong);
  color: var(--ink-soft);
}
.btn-state-off:hover { border-color: var(--ink-soft); color: var(--ink); }

/* -------------------- الشبكة والبطاقات -------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .18s, transform .18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

a.card:hover, a.card:focus-visible {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--muted-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: 'Cairo', sans-serif;
  color: var(--primary);
  font-size: 1.1rem;
}

.card h3 {
  font-size: 1.05rem;
  margin: 0;
}

.card .card-sub {
  color: var(--ink-soft);
  font-size: .85rem;
}

/* UI micro-change — Courses homepage card CTA: keep the button its natural
   size instead of stretching to the full width of the flex-column .card. */
.card .card-cta {
  align-self: flex-start;
  margin-top: 4px;
}

/* Phase 5 P1 — Courses MVP: صورة غلاف اختيارية أعلى بطاقة الدورة في
   courses.html. لا ألوان جديدة — نفس --radius-sm ونفس بنية .card. */
.course-card-cover {
  width: calc(100% + 40px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin: -20px -20px 4px -20px;
}

/* -------------------- بطاقة المورد (Resource Card) -------------------- */
/* الشكل مستوحى من "بطاقة الفهرسة" المكتبية: شريط ملوّن جانبي حسب النوع */

.resource-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  border-inline-start: 6px solid var(--type-notes);
  transition: box-shadow .18s, transform .18s;
}

.resource-card:hover,
.resource-card:focus-within {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.resource-card[data-type="book"] { border-inline-start-color: var(--type-book); }
.resource-card[data-type="summary"] { border-inline-start-color: var(--type-summary); }
.resource-card[data-type="questions"] { border-inline-start-color: var(--type-questions); }
.resource-card[data-type="lecture"] { border-inline-start-color: var(--type-lecture); }
.resource-card[data-type="slides"] { border-inline-start-color: var(--type-slides); }
.resource-card[data-type="notes"] { border-inline-start-color: var(--type-notes); }
.resource-card[data-type="past_exam"] { border-inline-start-color: var(--type-past_exam); }

/* Phase 5 P1 — Courses MVP: بطاقة درس على course.html — نفس بنية
   .resource-card تمامًا لكن بلا شريط لون جانبي (لا يوجد "نوع" ملوّن
   مكافئ لأنواع الموارد لكل نوع محتوى درس). */
.lesson-card { border-inline-start: 6px solid var(--line-strong); }
.lesson-text-content {
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

/* Phase 5 P1 — Courses MVP: صورة غلاف الدورة أعلى course.html. */
.course-detail-cover {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.resource-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--ink);
  padding-inline-end: 34px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.resource-type-icon {
  flex-shrink: 0;
  line-height: 1.45;
}

.favorite-btn {
  position: absolute;
  top: 3px;
  inset-inline-end: 5px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--line-strong);
  padding: 2px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, transform .1s, background .15s;
}
.favorite-btn:hover { transform: scale(1.15); color: var(--accent); background: var(--muted-bg); }
.favorite-btn.active { color: var(--accent); }

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

.tag[data-type="book"] { background: var(--type-book-bg); color: var(--type-book); }
.tag[data-type="summary"] { background: var(--type-summary-bg); color: var(--type-summary); }
.tag[data-type="questions"] { background: var(--type-questions-bg); color: var(--type-questions); }
.tag[data-type="lecture"] { background: var(--type-lecture-bg); color: var(--type-lecture); }
.tag[data-type="slides"] { background: var(--type-slides-bg); color: var(--type-slides); }
.tag[data-type="notes"] { background: var(--type-notes-bg); color: var(--type-notes); }
.tag[data-type="past_exam"] { background: var(--type-past_exam-bg); color: var(--type-past_exam); }

.tag-lang {
  background: var(--muted-bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.tag-verified {
  background: var(--success-bg);
  color: var(--type-questions);
  border: 1px solid var(--success-border);
}

.resource-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.report-btn {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: .82rem;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
}
.report-btn:hover { color: var(--danger); }

/* -------------------- شريط أدوات صفحة المادة (تبويبات النوع + بحث داخلي) -------------------- */

.resource-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.resource-count {
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
}

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
}

.type-tab-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  color: var(--ink-soft);
  transition: background .15s, color .15s, border-color .15s;
}

.type-tab-btn:hover { border-color: var(--line-strong); }

.type-tab-btn.active {
  background: var(--tab-color, var(--primary));
  border-color: var(--tab-color, var(--primary));
  color: #fff;
}

.subject-search-input {
  padding: 9px 16px;
  border-radius: 999px;
  border: 2px solid var(--line);
  font-family: 'Tajawal', sans-serif;
  font-size: .86rem;
  background: var(--muted-bg);
  color: var(--ink);
  flex: 1 1 220px;
  max-width: 320px;
}

.subject-search-input:focus { border-color: var(--primary); outline: none; }

/* :focus-visible صريح لهذين الحقلين تحديدًا: قاعدة :focus عليهما (أعلاه)
   تُلغي outline افتراضيًا، وبما أن specificity الخاص بها يساوي specificity
   :focus-visible (صنف واحد + pseudo-class واحدة لكل منهما)، فالفوز هنا بترتيب
   الظهور في الملف لا بالخصوصية — لذلك وُضعت هذه القاعدة بعد الاثنتين معًا
   لتفوز فعليًا عند التنقل بلوحة المفاتيح، بنفس قيم :focus-visible العامة
   للموقع (--accent) دون تغيير الشكل عند focus بالماوس/اللمس. */
.search-input:focus-visible,
.subject-search-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* -------------------- حالات فارغة / تحميل -------------------- */

.state-msg {
  text-align: center;
  color: var(--ink-soft);
  padding: 50px 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* -------------------- نافذة منبثقة (Modal) للإبلاغ -------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 38, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-hover);
}

.modal-box h3 { margin-bottom: 6px; }
.modal-box p.hint { color: var(--ink-soft); font-size: .88rem; margin-bottom: 16px; }

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: .88rem;
  margin-bottom: 6px;
}

.field select, .field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: .92rem;
  background: var(--muted-bg);
  color: var(--ink);
}

.field textarea { resize: vertical; min-height: 70px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 8px;
}

/* -------------------- البحث الشامل من الهيدر (Phase 3.2) -------------------- */

.global-search-overlay {
  align-items: flex-start;
  padding-top: 90px;
}

.global-search-box {
  max-width: 560px;
  padding: 18px;
}

.global-search-box .search-input { width: 100%; }

.global-search-results {
  margin-top: 14px;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.global-search-viewall {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: .85rem;
  text-align: right;
  cursor: pointer;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  font-family: 'Tajawal', sans-serif;
}
.global-search-viewall:hover { text-decoration: underline; }

.global-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.global-search-item:hover { background: var(--muted-bg); }

.global-search-item .resource-type-icon { font-size: 1.1rem; flex-shrink: 0; }

.global-search-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.global-search-item-title {
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-item-meta {
  font-size: .76rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -------------------- شعار أفق (UI-2) -------------------- */
/* شارة الشعار داخل الهيدر: نضع الصورة كما هي (بلا إعادة رسم) داخل
   حاوية بيضاء صغيرة مستديرة الحواف حتى تبرز بوضوح على خلفية الهيدر
   الداكنة (var(--primary))، دون أي تعديل على محتوى الصورة نفسها. */
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  object-fit: contain;
  flex-shrink: 0;
  padding: 2px;
}

/* -------------------- روابط التنقّل الظاهرة في الهيدر (UI-2) -------------------- */
/* بنفس نمط "الحبة/Pill" المستخدم أصلًا في breadcrumb — امتداد للغة
   البصرية الحالية، بلا مكوّن جديد. */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav .nav-link {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background .15s;
}

.header-nav .nav-link:hover,
.header-nav .nav-link:focus-visible {
  background: rgba(255, 255, 255, .26);
}

/* -------------------- التذييل -------------------- */

.site-footer {
  padding: 32px 20px 22px;
  color: var(--ink-soft);
  font-size: .85rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.footer-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.footer-desc {
  max-width: 480px;
  line-height: 1.7;
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
}

.footer-links a {
  color: var(--secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-links a:hover,
.footer-links a:focus-visible { color: var(--primary); }

.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--muted-bg);
  color: var(--ink-soft);
  font-size: 1.1rem;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}

.social-link:hover,
.social-link:focus-visible {
  border-color: var(--accent);
  color: var(--primary-dark);
  background: var(--surface);
}

.footer-bottom {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  width: 100%;
  font-size: .8rem;
  color: var(--ink-soft);
}

@media (min-width: 640px) {
  .footer-inner { text-align: start; align-items: flex-start; }
  .footer-links { justify-content: flex-start; }
  .footer-bottom { text-align: start; }
}

/* -------------------- لوحة التحكم -------------------- */

.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-shell[hidden] { display: none; }

.admin-login-box {
  max-width: 380px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}

.admin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.admin-tabs::-webkit-scrollbar { height: 4px; }
.admin-tabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.admin-tabs::-webkit-scrollbar-track { background: transparent; }

.admin-tab-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  color: var(--ink-soft);
  flex-shrink: 0;
  white-space: nowrap;
}

.admin-tab-btn:hover { border-color: var(--line-strong); color: var(--ink); }

.admin-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.admin-tab-btn.active:hover { color: #fff; }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-panel-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* F-08: طيّ نماذج الإضافة (details/summary) — مطوية افتراضيًا، مع بقاء
   كل الحقول والسلوك كما هو. العنصر h3 داخل summary مسموح (heading content). */
.admin-form-toggle {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.admin-form-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-form-toggle > summary::-webkit-details-marker { display: none; }

.admin-form-toggle > summary h3,
.admin-form-toggle > summary h4 { margin: 0; font-size: 1rem; }

.admin-form-toggle > summary::before {
  content: "＋";
  font-size: 1rem;
  line-height: 1;
  color: var(--primary);
  transition: transform .15s ease;
}

.admin-form-toggle[open] > summary::before { content: "−"; }

.admin-form-toggle > .admin-form-toggle-body {
  border-top: 1px solid var(--line);
  padding: 16px;
  background: var(--surface);
}

@media (max-width: 640px) {
  .admin-form-toggle > summary { padding: 10px 12px; }
  .admin-form-toggle > .admin-form-toggle-body { padding: 12px; }
}

.table-wrap { overflow-x: auto; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

table.admin-table th, table.admin-table td {
  text-align: right;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.admin-table th {
  color: var(--ink-soft);
  font-weight: 700;
}

table.admin-table tbody tr:hover { background: var(--muted-bg); }

.status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
}
.status-badge.published { background: var(--success-bg); color: var(--type-questions); }
.status-badge.hidden { background: var(--neutral-bg); color: var(--ink-soft); }
.status-badge.reported { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
/* Phase 5 P1 — Courses MVP: حالة "مسودة" الإضافية لجداول الدورات/الدروس.
   لا ألوان جديدة — نفس متغيرات neutral-bg/ink-soft/line الموجودة أصلاً،
   بحد إضافي متقطّع فقط للتمييز البصري عن status-badge.hidden. */
.status-badge.draft { background: var(--neutral-bg); color: var(--ink-soft); border: 1px dashed var(--line-strong); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--inverse);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: .9rem;
  box-shadow: var(--shadow-hover);
  z-index: 200;
}

.toast[hidden] { display: none; }

.year-badge {
  font-family: 'Cairo', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

/* -------------------- فلاتر البحث -------------------- */

.search-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.filters-label {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  color: rgba(255, 255, 255, .78);
  flex: 0 0 auto;
}

.search-filters select {
  padding: 12px 14px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  min-width: 130px;
  flex: 1 1 130px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.search-filters select:hover { border-color: var(--accent); }

.search-filters select:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

/* -------------------- لوحة المعلومات (Dashboard) -------------------- */

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--muted-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

.dashboard-recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dashboard-recent-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .88rem;
}

/* -------------------- المستخدمون والصلاحيات -------------------- */

.users-list { display: flex; flex-direction: column; gap: 16px; }

.user-perm-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--muted-bg);
}

.user-perm-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-bottom: 12px;
}
.user-perm-header .hint { color: var(--ink-soft); font-size: .8rem; margin-inline-start: 6px; }

.user-perm-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-soft); }
.inline-label select { padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); }

.perm-scopes { display: flex; flex-direction: column; gap: 10px; }

.perm-scope-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.perm-scope-title { font-weight: 700; margin-bottom: 8px; color: var(--primary-dark); }

.perm-entity-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 6px 0; border-top: 1px solid var(--line);
}
.perm-entity-row:first-of-type { border-top: none; }

.perm-entity-label { min-width: 170px; font-size: .85rem; color: var(--ink-soft); }

.perm-checkbox { display: flex; align-items: center; gap: 5px; font-size: .85rem; cursor: pointer; }
.perm-checkbox input { width: 16px; height: 16px; cursor: pointer; }

/* ====================================================================
   Homepage V2 — صفحة هبوط أفق (Landing Page) — DESIGN REDO
   ====================================================================
   كل ما يلي حصري لعناصر index.html (بادئة landing-) ولا يشارك أي صنف
   مع platform.html أو أي صفحة أخرى (لا .home-hero/.home-section/.card
   العامة — تلك تبقى كما هي تمامًا في كل مكان آخر). القيم كلها مشتقة من
   نفس متغيرات الهوية الحالية (--primary/--accent/--bg/--ink...)، بلا
   لوحة ألوان أو خط جديد. شارة "قريبًا" (badge-soon) أسفل هذا القسم
   مشتركة مع نافذة المصادقة الظاهرة في كل الصفحات ولم تُعدَّل. */

/* -------------------- إيقاع عام لأقسام الصفحة -------------------- */

.landing-section { margin-bottom: 76px; }

.landing-section-head { margin-bottom: 28px; }

.landing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .02em;
  color: var(--primary);
}

.landing-kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.landing-section-title {
  margin: 10px 0 0;
  max-width: 22ch;
}

/* -------------------- الهيرو -------------------- */
/* بنية غير متماثلة: نص الهوية يقابله رسم "الأفق" — خط ذهبي رفيع
   وحلقات متقاربة نحو مركز مضيء، تجسيد بصري حرفي لاسم المنصة ولفكرة
   "تضييق مصادر كثيرة إلى مورد واحد محدد" — لا رسم زخرفي عام. */

.landing-hero {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 40px 22px;
  margin-bottom: 64px;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(560px 360px at 100% 0%, rgba(255, 255, 255, .05), transparent 65%);
}

.landing-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: center;
}

.landing-hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .92);
  font-size: .78rem;
  font-weight: 700;
}

.landing-eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 165, 103, .22);
  flex-shrink: 0;
}

.landing-hero-title {
  color: #fff;
  font-size: clamp(1.85rem, 1.2rem + 2.8vw, 2.9rem);
  line-height: 1.22;
  margin: 0;
  max-width: 15ch;
}

.landing-hero-lead {
  color: rgba(255, 255, 255, .82);
  font-size: clamp(1rem, .93rem + .25vw, 1.1rem);
  line-height: 1.75;
  max-width: 44ch;
  margin: 0;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 6px;
}

.landing-cta-btn { min-height: 44px; padding-inline: 26px; }

.landing-secondary-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: rgba(255, 255, 255, .82);
  font-weight: 700;
  font-size: .9rem;
  border-bottom: 1px solid rgba(255, 255, 255, .3);
  transition: color .15s, border-color .15s;
}

.landing-secondary-link:hover,
.landing-secondary-link:focus-visible {
  color: #fff;
  border-color: #fff;
}

.landing-secondary-link span { display: inline-block; transition: transform .15s; }
.landing-secondary-link:hover span { transform: translateY(3px); }

/* -------------------- رسم "الأفق": حلقات متقاربة فوق خط الأفق -------------------- */

.landing-horizon {
  position: relative;
  z-index: 1;
  height: 220px;
  border-radius: var(--radius-sm);
}

.landing-horizon-rings {
  position: absolute;
  inset-inline-start: 50%;
  top: 38%;
  width: 0;
  height: 0;
}

.landing-horizon-rings .ring {
  position: absolute;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(201, 165, 103, .38);
}

.ring-1 { width: 260px; height: 260px; }
.ring-2 { width: 195px; height: 195px; border-color: rgba(201, 165, 103, .5); }
.ring-3 { width: 132px; height: 132px; border-color: rgba(201, 165, 103, .65); }
.ring-4 { width: 74px; height: 74px; border-color: rgba(201, 165, 103, .85); }

.landing-horizon-core {
  position: absolute;
  top: 0; left: 0;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px rgba(201, 165, 103, .18), 0 0 40px 6px rgba(201, 165, 103, .35);
}

.landing-horizon-line {
  position: absolute;
  inset-inline: 4%;
  top: 66%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 165, 103, .55) 18%, rgba(201, 165, 103, .55) 82%, transparent);
}

.landing-horizon-label {
  position: absolute;
  font-size: .74rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .72);
  white-space: nowrap;
}

.landing-horizon-label-outer { top: 4%; inset-inline-end: 6%; }
.landing-horizon-label-inner { top: 40%; inset-inline-start: 50%; transform: translate(-50%, 26px); color: rgba(255,255,255,.92); }

.landing-horizon--simple .ring-1,
.landing-horizon--simple .ring-2,
.landing-horizon--simple .landing-horizon-label { display: none; }

/* -------------------- عن أفق: شريط تحريري بفواصل ذهبية بدل بطاقات -------------------- */

.landing-about-grid { display: flex; flex-direction: column; }

.landing-about-row {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-about-row:first-of-type { border-top: 1px solid var(--line); }
.landing-about-row:last-of-type { border-bottom: 1px solid var(--line); }

.landing-about-row h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.landing-about-row p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 62ch;
  line-height: 1.75;
}

.landing-about-row-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.landing-about-highlight {
  color: var(--accent);
  font-weight: 800;
}

.landing-about-grid--single .landing-about-row:first-of-type { border-top: none; }

/* -------------------- عن أفق: من المعرفة إلى الأثر (تسلسل مميّز) -------------------- */

.landing-impact-flow {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 32px 0;
}

.landing-impact-step {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 700;
  color: var(--primary-dark);
}

.landing-impact-step-final {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.landing-impact-arrow {
  align-self: center;
  color: var(--line-strong);
  font-size: 1.1rem;
  transform: rotate(90deg);
}

/* -------------------- عن أفق: بطاقات "ماذا يقدم أفق" -------------------- */

.card h4 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* -------------------- ماذا يقدّم أفق: نص + مفردات أنواع الموارد الحقيقية -------------------- */

.landing-provides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.landing-provides-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 56ch;
}

.landing-type-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.landing-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--muted-bg);
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink);
}

.landing-type-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.landing-type-dot[data-type="book"] { background: var(--type-book); }
.landing-type-dot[data-type="summary"] { background: var(--type-summary); }
.landing-type-dot[data-type="questions"] { background: var(--type-questions); }
.landing-type-dot[data-type="lecture"] { background: var(--type-lecture); }
.landing-type-dot[data-type="slides"] { background: var(--type-slides); }
.landing-type-dot[data-type="notes"] { background: var(--type-notes); }
.landing-type-dot[data-type="past_exam"] { background: var(--type-past_exam); }

/* -------------------- لماذا هذه المنصة: اقتباس محوري -------------------- */

.landing-why {
  position: relative;
  padding-block: 8px;
  padding-inline-start: 30px;
  border-inline-start: 3px solid var(--accent);
}

.landing-why-mark {
  display: block;
  font-family: 'Cairo', sans-serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 6px;
}

.landing-why p {
  margin: 0;
  max-width: 58ch;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--ink);
}

/* -------------------- ماذا ستجد بالداخل: سلسلة الهرم -------------------- */

.landing-flow {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.landing-flow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .95rem;
  transition: color .15s, padding-inline-start .15s;
}

.landing-flow-step:first-of-type { border-top: 1px solid var(--line); }

.landing-flow-marker {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  color: var(--ink-soft);
  background: var(--surface);
}

a.landing-flow-step:hover,
a.landing-flow-step:focus-visible {
  color: var(--primary);
  padding-inline-start: 10px;
}

a.landing-flow-step:hover .landing-flow-marker,
a.landing-flow-step:focus-visible .landing-flow-marker {
  border-color: var(--primary);
  color: var(--primary);
}

.landing-flow-step-final {
  color: var(--primary-dark);
}

.landing-flow-step-final .landing-flow-marker {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

a.landing-flow-step-final:hover,
a.landing-flow-step-final:focus-visible { color: var(--primary); }

/* -------------------- شريط CTA الختامي -------------------- */

.landing-cta-band { padding: 48px 22px; margin-bottom: 0; }
.landing-cta-band .landing-hero-inner { grid-template-columns: 1fr; justify-items: center; }
.landing-cta-band .landing-hero-text { align-items: center; text-align: center; }
.landing-cta-band .landing-hero-title { max-width: 18ch; }
.landing-cta-band .landing-horizon { width: 100%; max-width: 420px; height: 120px; }
.landing-cta-band .landing-horizon-rings { top: 62%; }

/* شارة "قريبًا" بجانب أزرار Google/Apple في نافذة المصادقة (نسخ/CSS فقط) — مشتركة مع كل الصفحات، غير معدَّلة */
.badge-soon {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--muted-bg);
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
  vertical-align: middle;
}

/* -------------------- استجابة صفحة الهبوط -------------------- */

@media (min-width: 900px) {
  .landing-hero { padding: 64px 56px; }
  .landing-hero-inner { grid-template-columns: 1.2fr .8fr; gap: 48px; }
  .landing-hero-title { max-width: 13ch; }
  .landing-about-row { flex-direction: row; gap: 32px; }
  .landing-about-row h3 { flex: 0 0 220px; margin: 0; }
  .landing-about-row-body { flex: 1; min-width: 0; }
  .landing-provides-grid { grid-template-columns: 1.3fr .9fr; }
  .landing-flow-step { padding: 18px 4px; }
  .landing-cta-band .landing-hero-inner { grid-template-columns: 1fr; }
  .landing-impact-flow { flex-direction: row; align-items: stretch; }
  .landing-impact-step { flex: 1; flex-direction: column; text-align: center; gap: 8px; }
  .landing-impact-arrow { transform: none; }
}

@media (max-width: 560px) {
  .landing-hero { padding: 30px 16px; margin-bottom: 48px; }
  .landing-horizon { height: 150px; }
  .ring-1, .ring-2 { display: none; }
  .landing-horizon-label-outer { display: none; }
  .landing-section { margin-bottom: 56px; }
  .landing-cta-row { flex-direction: column; align-items: stretch; }
  .landing-cta-btn { width: 100%; }
  .landing-secondary-link { justify-content: center; }
  .landing-why { padding-inline-start: 18px; }
}

/* -------------------- استجابة للشاشات (Responsive) -------------------- */

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .search-hero { padding: 40px; }
}

@media (max-width: 480px) {
  .search-form { flex-direction: column; border-radius: var(--radius); }
  .filters-label { flex-basis: 100%; }
  main { padding: 20px 14px 50px; }
  .site-header .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* على الشاشات الصغيرة جدًا نُبقي أزرار الأيقونات فقط (بلا نص ظاهر) لتفادي
     ازدحام صف الهيدر — الوصول لنفس الوجهة يبقى ممكنًا عبر الأيقونات نفسها
     (كل أيقونة تحمل aria-label بالفعل). */
  .header-nav .nav-link { display: none; }
}

/* جداول الأدمن على الشاشات الصغيرة: تتحوّل من جدول إلى بطاقات قابلة للطي */
@media (max-width: 640px) {
  .admin-tabs { gap: 6px; }
  .admin-tab-btn { padding: 12px 12px; font-size: .82rem; }
  .admin-panel-inner { padding: 16px; }

  table.admin-table thead { display: none; }
  table.admin-table, table.admin-table tbody, table.admin-table tr, table.admin-table td {
    display: block; width: 100%;
  }
  table.admin-table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 6px 10px;
    white-space: normal;
  }
  table.admin-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 2px;
    white-space: normal;
  }
  table.admin-table td:last-child { border-bottom: none; }
  table.admin-table td:not(:last-child)::before {
    content: attr(data-label);
    display: block;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 2px;
  }

  .perm-entity-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .perm-entity-label { min-width: 0; }
  .user-perm-header { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ============================================================
   Forum MVP — ملتقى أفق (Phase 6)
   يعيد استخدام متغيرات الألوان ومكوّنات .card/.btn/.tag/.modal-overlay/
   .field الموجودة أعلاه بالكامل — لا لوحة ألوان جديدة، ولا مكوّنات
   Social-Media (Likes/Followers/Badges..) — طابع أكاديمي هادئ فقط،
   بحسب توجيهات DESIGN_SYSTEM.md § 8 "Future Feature — Student Community".
   ============================================================ */

.forum-intro {
  color: var(--ink-soft);
  margin-top: -8px;
  margin-bottom: 20px;
  font-size: .98rem;
}

.forum-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.forum-toolbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: .92rem;
}

.forum-clear-filter-btn {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: .88rem;
  padding: 2px 4px;
  text-decoration: underline;
}

.forum-categories-section { margin-bottom: 36px; }

.forum-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.forum-category-card { text-align: center; }

.forum-topics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.forum-topic-card { display: block; }

.forum-topic-card-head {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.forum-locked-tag {
  background: var(--neutral-bg);
  color: var(--ink-soft);
}

.forum-topic-card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--ink-faint);
  font-size: .85rem;
  margin-top: 10px;
}

.forum-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* -------- صفحة الموضوع -------- */

.forum-topic-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 32px;
}

.forum-topic-title {
  margin: 4px 0 10px;
  font-size: 1.5rem;
}

.forum-content-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  color: var(--ink);
  margin: 16px 0;
}

.forum-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn-sm { padding: 6px 14px; font-size: .85rem; }

.forum-danger-btn {
  border-color: var(--danger-border);
  color: var(--danger);
}
.forum-danger-btn:hover { background: var(--danger-bg); }

.forum-locked-banner {
  margin-top: 16px;
  background: var(--muted-bg);
  border-radius: 10px;
}

.forum-edit-title-input,
.forum-edit-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  margin: 10px 0;
}

.forum-edit-textarea { min-height: 120px; resize: vertical; }

.forum-replies-section { margin-top: 8px; }

.forum-replies-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.forum-reply-card { padding: 18px; }

.forum-reply-form-wrap {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .forum-topic-detail { padding: 16px; }
  .forum-toolbar { flex-direction: column; align-items: stretch; }
  .forum-toolbar .btn { width: 100%; }
  .forum-item-actions .btn { flex: 1 1 auto; }
}
