/* ================================================
   القسم: المتغيرات العامة (CSS Custom Properties)
   الغرض: تعريف ألوان وظلال وأبعاد المشروع لإعادة الاستخدام في كامل الملف
================================================ */
:root {
  --bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --border: rgba(0, 0, 0, 0.08);
  --text: #0f2412;
  --muted: rgba(15, 36, 18, 0.7);
  --brand: #0d6c0d;
  --brand2: #02ad02;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  --radius: 16px;
  --radius2: 22px;
  --container: 1120px;

  --grad: linear-gradient(90deg,
      #c3e8f8af 0%,
      #abe2f8c1 10%,
      #caf6da 25%,
      #d2ffb9d2 40%,
      #fae9c7be 60%,
      #f7e0b4ca 70%,
      #caf6da 80%,
      #9adff8c1 90%,
      #caf6da 93%,
      #f0d295d3 100%);
}

/* ================================================
   القسم: وضع الظلام - Dark Mode Variables
   الغرض: استبدال متغيرات الألوان والظلال بقيم مناسبة للوضع الداكن
================================================ */
[data-theme="dark"] {
  --bg: #0b1210;
  --surface: rgba(18, 28, 24, 0.72);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8f6ea;
  --muted: rgba(232, 246, 234, 0.68);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .search-highlight {
  background: rgba(250, 204, 21, 0.2);
  color: #fef9c3;
}

/* ── dark mode: badge — نص داكن على خلفية داكنة داخل الـ hero ── */
[data-theme="dark"] .badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.28);
}

/* ── dark mode: section-head h3 / widget__title — gradient الصفحة يبقى فاتحاً ── */
[data-theme="dark"] .section-head h3,
[data-theme="dark"] .widget__title {
  color: var(--text);
}

/* ================================================
   القسم: العناصر الأساسية - Base Elements
   الغرض: إعادة ضبط الخصائص الافتراضية للمتصفح وتطبيق الخط والخلفية العامة
================================================ */
* {
  box-sizing: border-box;
}

/* يضمن أن hidden attribute يخفي العنصر دائمًا حتى لو كان يحمل class كـ .btn */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Cairo", sans-serif;
  background: var(--grad);
  color: var(--text);
  overflow-x: hidden;
}

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

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

button,
input,
textarea,
select {
  font: inherit;
}

/* ================================================
   القسم: أدوات مساعدة - Utilities
   الغرض: كلاسات مرنة متعددة الاستخدام (التوسيط، الإخفاء، الحمل، الفواصل)
================================================ */
.container {
  width: min(var(--container), 92vw);
  margin: 0 auto;
}

.muted {
  color: var(--muted);
}

.center {
  display: grid;
  place-items: center;
  margin: 18px 0 0;
}

.sep {
  margin: 0 8px;
  opacity: 0.5;
}

.is-hidden {
  display: none;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.loader {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

/* ================================================
   القسم: الشريط العلوي - Topbar
   الغرض: شريط شفاف بأثر blur يعرض شعار الجريدة ومعلومات الوقت والتاريخ
================================================ */
.topbar {
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .topbar {
  background: rgba(10, 16, 14, 0.75);
}

.topbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.dot {
  width: 10px;
  height: 10px;
  background: var(--brand);
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.topbar__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.topbar__meta-label {
  color: var(--text);
  font-weight: 700;
}

.topbar__meta-value {
  unicode-bidi: plaintext;
}

.topbar__meta-time {
  display: inline-block;
  min-width: 8ch;
  text-align: left;
  direction: ltr;
}

.topbar__meta-sep {
  color: var(--muted);
  opacity: 0.7;
}

.site-header + main .category-search-tools {
  display: none;
}

/* ================================================
   القسم: رأس الصفحة - Site Header
   الغرض: يحتوي على شعار الجريدة وروابط الإجراءات (تسجيل الدخول وتبديل المظهر)
================================================ */
.site-header {
  position: static;
  background: transparent;
}

.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0 10px;
}

.header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.logo__title {
  margin: 0;
  font-family: "Reem Kufi", sans-serif;
  font-size: clamp(1.8rem, 4.8vw, 3.6rem);
  color: var(--brand);
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.logo__tagline {
  margin: 6px 0 0;
  color: var(--muted);
}

/* ================================================
   القسم: شريط البحث البسيط - Simple Search Bar
   الغرض: حقل بحث بزاوية دائرية وخلفية شفافة مدمج في شريط التنقل
================================================ */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.search input {
  width: min(320px, 48vw);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search button {
  border: 0;
  background: var(--brand);
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.search button:hover {
  background: var(--brand2);
}

/* ================================================
   القسم: البحث المتقدم - Advanced Search
   الغرض: مربع بحث منبثق يدعم الفلترة بالنص والتصنيف والترتيب
   يظهر بتأثير انزلاق عند الضغط على زر التبديل
================================================ */
.advanced-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex: 0 0 auto;
}

.advanced-search-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 100;
  width: min(680px, 90vw);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.advanced-search-inline .input {
  flex: 1 1 220px;
  min-width: 180px;
}

.advanced-search-inline .select {
  flex: 0 0 160px;
}

.advanced-search-inline .btn,
.advanced-search-inline .btn-ghost {
  flex: 0 0 auto;
  white-space: nowrap;
}

.advanced-search-inline.is-hidden {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
}

/* ================================================
   القسم: زر القائمة المحمولة - Burger Button
   الغرض: زر ثلاثة أسطر يظهر على الشاشات الصغيرة لتوسيع القائمة وطيّها
================================================ */
.burger {
  display: none;
  width: 46px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.burger span {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--text);
  margin: 5px auto;
  border-radius: 3px;
}

/* ================================================
   القسم: شريط التنقل - Navigation Bar
   الغرض: شريط لاصق شفاف بأثر blur يحتوي روابط التصنيفات وأدوات البحث
================================================ */
.nav {
  position: sticky;
  top: 10px;
  z-index: 80;
  padding-bottom: 10px;
  background: transparent;
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 10px 14px;
  border: 1px solid rgba(15, 36, 18, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
  overflow: visible;
}

[data-theme="dark"] .nav__inner {
  background: rgba(10, 16, 14, 0.48);
  border-color: rgba(255, 255, 255, 0.1);
}

.nav__link {
  padding: 8px 12px;
  border-radius: 999px;
  transition: 200ms;
  font-family: "Cairo", sans-serif;
  font-size: 15px;
  color: rgba(15, 36, 18, 0.92);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

[data-theme="dark"] .nav__link {
  color: rgba(232, 246, 234, 0.92);
}

.nav__link:hover {
  background: rgba(13, 108, 13, 0.12);
}

.nav__link.is-active {
  background: rgba(13, 108, 13, 0.16);
  color: var(--brand);
}

.nav__right {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav__tools {
  flex: 1 1 auto;
  justify-content: flex-end;
}

#dynamicNavCategories {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.nav__search {
  min-width: 0;
  width: 260px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
  flex: 0 1 260px;
}

[data-theme="dark"] .nav__search {
  background: rgba(11, 18, 16, 0.46);
}

.nav__search input {
  width: 100%;
  min-width: 0;
}

.nav__tools .advanced-search-wrap {
  justify-content: flex-end;
}

/* ================================================
   القسم: الأزرار - Buttons
   الغرض: أزرار رئيسية (btn) وأزرار شبحية (btn-ghost) بتصاميم وتحولات متناسقة
================================================ */
.btn,
.btn-ghost {
  cursor: pointer;
  transition: 0.2s;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
}

.btn:hover {
  background: var(--brand2);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
}

.btn-ghost:hover {
  border-color: rgba(13, 108, 13, 0.45);
  background: rgba(13, 108, 13, 0.08);
  color: var(--text);
}

/* ================================================
   القسم: حقول الإدخال - Form Inputs
   الغرض: حقول النص والقوائم المنسدلة بحدود خفيفة وخلفية شفافة
================================================ */
.select,
.input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  color: var(--text);
}

/* ================================================
   القسم: منطقة المحتوى الرئيسي - Main Content Area
   الغرض: إضافة مسافة عمودية حول محتوى الصفحة بين الرأس والتذييل
================================================ */
.main {
  padding: 18px 0 44px;
}

/* ================================================
   القسم: المقال البارز - Hero Section
   الغرض: تخطيط شبكي لعرض أهم مقال مع صورة كبيرة وعنوان وملخص وزر قراءة
================================================ */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0;
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero__media {
  position: relative;
  min-height: 420px;
  background: #ddd;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.38),
      rgba(0, 0, 0, 0.08),
      rgba(0, 0, 0, 0.02));
}

.hero__content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.badge {
  display: inline-block;
  background: rgba(13, 108, 13, 0.14);
  color: var(--brand);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(13, 108, 13, 0.22);
  margin-bottom: 10px;
}

.hero__title {
  margin: 12px 0 10px;
  line-height: 1.5;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
}

.hero__title a {
  color: inherit;
}

.hero__excerpt {
  margin: 0 0 12px;
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--muted);
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.hero__cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ================================================
   القسم: التخطيط الرئيسي - Main Layout Grid
   الغرض: شبكة عمودين (تغذية المقالات + شريط جانبي) بمسافة مناسبة بينهما
================================================ */
.layout {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 16px;
  margin-top: 16px;
}

.feed,
.sidebar {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.widget__title,
.section-head h3 {
  font-family: "Reem Kufi", sans-serif;
}

.feed .section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#sortSelect {
  min-width: 178px;
  border: 1px solid rgba(13, 108, 13, 0.16);
  border-radius: 999px;
  padding: 12px 48px 12px 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 248, 241, 0.9)),
    radial-gradient(circle at top right, rgba(13, 108, 13, 0.12), transparent 58%);
  color: var(--text);
  font-family: "Cairo", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 14px 32px rgba(15, 36, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 248, 241, 0.9)),
    radial-gradient(circle at top right, rgba(13, 108, 13, 0.12), transparent 58%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230d6c0d' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: center, center, left 18px center;
  background-size: auto, auto, 14px;
}

#sortSelect option {
  font-family: "Cairo", sans-serif;
  font-weight: 600;
}

#sortSelect:hover {
  border-color: rgba(13, 108, 13, 0.28);
  box-shadow:
    0 18px 36px rgba(15, 36, 18, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transform: translateY(-1px);
}

#sortSelect:focus {
  outline: none;
  border-color: rgba(13, 108, 13, 0.38);
  box-shadow:
    0 0 0 4px rgba(13, 108, 13, 0.12),
    0 18px 36px rgba(15, 36, 18, 0.1);
}

[data-theme="dark"] #sortSelect {
  border-color: rgba(74, 222, 128, 0.18);
  background:
    linear-gradient(135deg, rgba(17, 30, 24, 0.94), rgba(24, 42, 32, 0.92)),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 58%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234ade80' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: center, center, left 18px center;
  background-size: auto, auto, 14px;
  color: #e8f6ea;
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] #sortSelect:hover {
  border-color: rgba(74, 222, 128, 0.28);
}

[data-theme="dark"] #sortSelect:focus {
  border-color: rgba(74, 222, 128, 0.34);
  box-shadow:
    0 0 0 4px rgba(74, 222, 128, 0.12),
    0 18px 38px rgba(0, 0, 0, 0.3);
}

/* ================================================
   القسم: شريط نتائج البحث - Search Results Bar
   الغرض: شريط أخضر شفاف يظهر بعد البحث ويعرض مصطلح البحث وعدد النتائج
================================================ */
.search-results-bar {
  margin: 0 0 18px;
  padding: 14px 18px;
  background: rgba(13, 108, 13, 0.08);
  border: 1px solid rgba(13, 108, 13, 0.25);
  border-radius: 16px;
  box-shadow: var(--shadow);
  font-size: 1.05rem;
}

.search-results-bar strong {
  margin-left: 8px;
}

.search-results-bar .result-count {
  color: var(--brand);
  font-weight: 700;
}

.search-results-bar .result-query {
  color: var(--muted);
}

/* ================================================
   القسم: بطاقات المقالات - Article Cards
   الغرض: شبكة بطاقات زجاجية تعرض صورة المقال وعنوانه وملخصه وبياناته الوصفية
================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.card__body {
  padding: 16px;
}

.card__body h4 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  line-height: 1.6;
  font-family: "Reem Kufi", sans-serif;
}

.card__body p {
  margin: 0 0 12px;
  line-height: 1.9;
  color: var(--muted);
}

.card__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .pill {
  background: rgba(0, 0, 0, 0.25);
}

/* ================================================
   القسم: الشريط الجانبي - Sidebar Widgets
   الغرض: ودجات زجاجية (الأكثر قراءة، الوسوم، النشرة) في الجانب الأيسر
================================================ */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  margin-top: 18px;
}

.widget__title {
  margin: 0 0 10px;
}

.list {
  margin: 0;
  padding: 0 18px 0 0;
}

.list li {
  margin: 8px 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 108, 13, 0.1);
  border: 1px solid rgba(13, 108, 13, 0.18);
  color: var(--brand);
  cursor: pointer;
}

.tag-filter {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.tag-filter.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.tag-all {
  font-weight: 600;
}

[data-theme="dark"] #tagsBox .tag {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(74, 222, 128, 0.18);
  color: #dff7e6;
}

[data-theme="dark"] #tagsBox .tag:hover,
[data-theme="dark"] #tagsBox .tag:focus {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(74, 222, 128, 0.28);
  color: #f3fff6;
}

[data-theme="dark"] .tag-filter.active {
  background: #2d9e2d;
  border-color: #2d9e2d;
  color: #fff;
}

.newsletter {
  display: flex;
  gap: 8px;
}

.newsletter input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .newsletter input {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}

.newsletter.is-loading input,
.newsletter.is-loading button {
  opacity: 0.65;
  cursor: progress;
}

.newsletter-msg {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.newsletter-msg.is-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #15803d;
}

.newsletter-msg.is-error {
  background: var(--danger-soft, rgba(239, 68, 68, 0.12));
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger, #b00020);
}

[data-theme="dark"] .newsletter-msg {
  background: rgba(255, 255, 255, 0.04);
}

/* ================================================
   القسم: تذييل الصفحة - Footer
   الغرض: شريط سفلي شفاف يحتوي شعار الجريدة والروابط وحقوق النشر
================================================ */
.footer {
  margin-top: 26px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .footer {
  background: rgba(10, 16, 14, 0.75);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  padding: 18px 0;
}

.footer__brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: start;
}

.footer__links a {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.footer__small {
  grid-column: 1 / -1;
}

.footer--compact .footer__inner {
  grid-template-columns: 1fr;
}

.admin-link {
  text-decoration: underline;
}

/* ================================================
   القسم: الرأس البسيط - Simple Header
   الغرض: رأس مخصر لصفحات مثل المقال يعرض رابط العودة وشعار الجريدة فقط
================================================ */
.simple-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .simple-header {
  background: rgba(10, 16, 14, 0.75);
}

.simple-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.back {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-weight: 700;
  color: var(--brand);
}

/* ================================================
   القسم: صفحة المقال الفردي - Article Page
   الغرض: تنسيق صورة المقال وعنوانه ومحتواه وقسم التعليقات
================================================ */
.article {
  padding: 18px 0 40px;
}

.article__figure {
  margin: 14px 0 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article__figure img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.article__content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  line-height: 1.95;
}

.comments {
  margin-top: 16px;
}

.comment-form {
  display: grid;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.comment-form input,
.comment-form textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .comment-form input,
[data-theme="dark"] .comment-form textarea {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}

/* ================================================
   القسم: بطاقة التعليق - Comment Card
   الغرض: عرض بيانات التعليق مع صورة الكاتب واسمه والتاريخ وروابط البحث
================================================ */
.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.comment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.95rem;
}

.comment-date {
  font-size: 0.78rem;
  opacity: 0.65;
}

.comment-content {
  line-height: 1.75;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-search-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.comment-search-link {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.2s;
}

.comment-search-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.comment-reply-btn,
.comment-report-btn,
.comment-hide-btn,
.comment-delete-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.18s, color 0.18s;
  font-family: inherit;
}

.comment-reply-btn {
  opacity: 0.55;
}

.comment-reply-btn:hover {
  opacity: 1;
}

.comment-report-btn {
  opacity: 0.45;
  color: #b45309;
}

.comment-report-btn:hover {
  opacity: 1;
  color: #92400e;
}

.comment-hide-btn {
  opacity: 0.5;
  color: #64748b;
}

.comment-hide-btn:hover {
  opacity: 1;
  color: #0f172a;
}

.comment-delete-btn {
  opacity: 0.5;
  color: #dc2626;
}

.comment-delete-btn:hover {
  opacity: 1;
  color: #991b1b;
}

/* ── نموذج البلاغ ── */
.report-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 14px;
  background: rgba(180, 83, 9, 0.04);
  border: 1px solid rgba(180, 83, 9, 0.18);
  border-radius: 12px;
  box-sizing: border-box;
  width: 100%;
}

.report-reason {
  display: block;
  width: 100%;
  height: 40px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text, #0f172a);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  box-sizing: border-box;
  direction: rtl;
}

.report-reason:focus {
  outline: none;
  border-color: rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

.report-details {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text, #0f172a);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  box-sizing: border-box;
  direction: rtl;
  resize: vertical;
  min-height: 64px;
}

.report-details:focus {
  outline: none;
  border-color: rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

.report-name {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text, #0f172a);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  box-sizing: border-box;
  direction: rtl;
}

.report-name:focus {
  outline: none;
  border-color: rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

.report-box-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.report-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  background: #b45309;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
  white-space: nowrap;
}

.report-submit:hover:not(:disabled) {
  background: #92400e;
}

.report-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.report-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: transparent;
  color: var(--text, #0f172a);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.18s, border-color 0.18s;
  white-space: nowrap;
}

.report-cancel:hover {
  opacity: 1;
  border-color: rgba(15, 23, 42, 0.28);
}

.report-success {
  color: #166534;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 0;
}

.report-success {
  color: #166534;
  font-weight: 600;
  font-size: 0.88rem;
}

.reply-box {
  margin-top: 10px;
}

.reply-box .reply-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
}

.reply-box-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ================================================
   القسم: صفحة عامة - Generic Page
   الغرض: حاوية زجاجية عامة لصفحات مثل "من نحن" و"تواصل معنا"
================================================ */
.page {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* ================================================
   القسم: تمييز كلمة البحث - Search Highlight
   الغرض: خلفية صفراء للكلمات المطابقة لمصطلح البحث داخل النصوص
================================================ */
.search-highlight {
  background: #ffe08a;
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
}

/* ================================================
   القسم: الاستجابة للشاشات - Responsive Design
   الغرض: تعديل التخطيط لشاشات الأجهزة المحمولة والأجهزة اللوحية
   نقاط التوقف: 980px (لوحي) و 640px (محمول)
================================================ */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero__media {
    min-height: 260px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav__inner {
    flex-wrap: wrap;
  }

  #dynamicNavCategories {
    flex-wrap: wrap;
  }

  .nav__right {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .feed .section-actions {
    width: 100%;
  }

  #sortSelect {
    width: 100%;
    min-width: 0;
  }

  .header__inner {
    align-items: flex-start;
  }

  .header__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
  }

  .burger {
    display: inline-block;
  }

  .nav {
    position: sticky;
    top: 8px;
    z-index: 80;
    display: block;
    padding-bottom: 0;
  }

  .nav__inner {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nav.is-open .nav__inner {
    display: flex;
  }

  .nav__tools {
    width: 100%;
  }

  .nav__search {
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .nav__search input {
    width: 100%;
    min-width: 0;
  }

  .advanced-search-wrap {
    width: 100%;
    justify-content: flex-end;
  }

  .advanced-search-inline {
    position: static;
    width: 100%;
    min-width: 0;
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .advanced-search-inline .input,
  .advanced-search-inline .select,
  .advanced-search-inline .btn,
  .advanced-search-inline .btn-ghost {
    width: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .footer__inner {
    grid-template-columns: 1fr;
  }

  .hero__media {
    min-height: 220px;
  }

  .hero__content {
    padding: 20px;
  }
}

/* ================================================
   القسم: أزرار المصادقة في الهيدر - Header Auth Buttons
   الغرض: تجميع زر "تسجيل الدخول" وزر "إنشاء حساب" في wrapper واحد
   مع استجابة كاملة للموبايل (كل زر يأخذ نصف العرض في صف مستقل)
================================================ */
.header__auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header__auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.header__auth-btn:hover {
  border-color: rgba(13, 108, 13, 0.3);
  background: rgba(13, 108, 13, 0.06);
}

/* زر "إنشاء حساب" — أخضر بارز */
.header__auth-btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(13, 108, 13, 0.25);
}

.header__auth-btn--primary:hover {
  background: var(--brand2);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(13, 108, 13, 0.32);
}

/* وضع الظلام */
[data-theme="dark"] .header__auth-btn {
  background: rgba(18, 28, 24, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

[data-theme="dark"] .header__auth-btn:hover {
  background: rgba(13, 108, 13, 0.18);
  border-color: rgba(13, 108, 13, 0.3);
}

/* ── موبايل: الزران في صف كامل تحت بقية عناصر الهيدر ── */
@media (max-width: 640px) {
  .header__auth {
    width: 100%;
    order: 10;
    gap: 8px;
  }

  .header__auth-btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 8px;
  }
}
