/* ================================================
   القسم: زر العودة للصفحة الرئيسية - Global Home Link
   الغرض: زر أخضر ثابت في أسفل يسار الشاشة يظهر في صفحات الإدارة
   للعودة السريعة إلى الموقع العام
================================================ */
.global-home-link {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #0d6c0d, #16a34a);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(13, 108, 13, 0.35);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.global-home-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(13, 108, 13, 0.45);
}

body.panel-theme .global-home-link {
  z-index: 1001;
}

/* ================================================
   القسم: رابط الدخول - Auth Entry Link
   الغرض: زر الدخول لصفحة تسجيل الدخول في الشريط العلوي للموقع
================================================ */
.auth-entry-link {
  min-width: 136px;
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(22, 163, 74, 0.2);
}

/* ================================================
   القسم: زر الدخول/الخروج الموحّد - Global Login Link
   الغرض: نمط موحّد لزر تسجيل الدخول/الخروج في جميع الصفحات العامة
================================================ */
.global-login-link {
  font-weight: 600;
}


/* ================================================
   القسم: الشريط العلوي الموحّد - Global Site Topbar
   الغرض: شريط مشترك بين كل صفحات الموقع يعرض التاريخ والوقت ووسائل التواصل
   يدعم كلا المظهرين الفاتح والداكن
================================================ */
.global-site-topbar {
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
}

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

/* ── شريط وسائل التواصل الاجتماعي ── */
.topbar-social {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.topbar-social a:hover {
  opacity: 0.88;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.topbar-social a svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  pointer-events: none;
}

.topbar-social a.social-fb { background: #1877f2; }
.topbar-social a.social-x  { background: #111; }
.topbar-social a.social-tg { background: #2aabee; }
.topbar-social a.social-ig {
  background: linear-gradient(135deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
}

/* dark mode — الأيقونات ملونة بطبيعتها، فقط نضبط ظل إكس الداكن */
[data-theme="dark"] .topbar-social a.social-x {
  background: #1a1a1a;
}

/* إخفاء الشريط في لوحات التحكم */
body.panel-theme .topbar-social {
  display: none;
}

/* ================================================
   القسم: حاوية الشريط العلوي ورأس الصفحة - Topbar & Header Container
   الغرض: تحديد عرض الحاوية الداخلية وتوسيطها بعرض أقصى 1180px
================================================ */
.global-site-topbar .container,
.site-header .container {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

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

.global-site-topbar .dot {
  width: 10px;
  height: 10px;
  background: var(--brand, #0d6c0d);
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
}

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

.global-site-topbar .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, #64748b);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

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

.global-site-topbar .topbar__meta-label {
  color: var(--text, #0f172a);
  font-weight: 700;
}

.global-site-topbar .topbar__meta-value {
  unicode-bidi: plaintext;
}

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

.global-site-topbar .topbar__meta-sep {
  color: var(--muted, #64748b);
  opacity: 0.7;
}

/* ================================================
   القسم: رأس الصفحة الموحّد - Global Site Header
   الغرض: رأس شفاف يحتوي شعار الجريدة وأدوات التنقل والبحث والثيم
   مُصمَّم للعمل مع global-ui.css عبر كل صفحات الموقع
================================================ */
.site-header {
  position: static;
  background: transparent;
}

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

.site-header .logo {
  display: block;
  text-decoration: none;
  color: inherit;
}

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

.site-header .logo__tagline {
  margin: 6px 0 0;
  color: var(--muted, #64748b);
}

[data-theme="dark"] .site-header .logo__tagline {
  color: rgba(15, 36, 18, 0.65);
}

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

.site-header .btn,
.site-header .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
  font: inherit;
}

.site-header .btn {
  border: 0;
  background: var(--brand, #0d6c0d);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(13, 108, 13, 0.18);
}

.site-header .btn:hover {
  background: var(--brand-2, #16a34a);
}

/* ================================================
   القسم: زر الدخول/الخروج في الهيدر - Header Auth Button
   الغرض: يأتي بعد .site-header .btn لضمان غلبته في الـ cascade
   الـ specificity متساوٍ (0,2,0) لكن الترتيب هنا يحسم لصالح الأزرق
================================================ */
.site-header .header-auth-btn {
  background: linear-gradient(135deg, #e8f7df, #c8efba);
  color: #0f6b2b;
  border: 1px solid rgba(15, 107, 43, 0.18);
  box-shadow: 0 8px 18px rgba(15, 107, 43, 0.14);
  font-weight: 700;
}

.site-header .header-auth-btn:hover {
  background: linear-gradient(135deg, #dcf5d0, #b8eaa8);
  color: #0b5a22;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 107, 43, 0.18);
}

.site-header .btn-ghost {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text, #0f172a);
  padding: 8px 10px;
  border-radius: 999px;
}

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

/* ── dark mode: btn-ghost — خلفية فاتحة، نفرض لون نص داكن ── */
[data-theme="dark"] .site-header .btn-ghost {
  color: #0f2412;
}

[data-theme="dark"] .site-header .btn-ghost:hover {
  color: #0f2412;
}

.site-header .nav {
  position: sticky;
  top: 10px;
  z-index: 80;
  padding-bottom: 10px;
  background: transparent;
}

.site-header .nav__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  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"] .site-header .nav__inner {
  background: rgba(10, 16, 14, 0.48);
  border-color: rgba(255, 255, 255, 0.1);
}

.site-header .nav__link {
  padding: 8px 10px;
  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;
  white-space: nowrap;
  flex: 0 0 auto;
  text-decoration: none;
}

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

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

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

.site-header .nav__right {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
}
.site-header .nav__links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}

.site-header .nav__tools,
.site-header .nav__tools--compact {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.site-header .nav__utility-group {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.site-header .nav__search-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.site-header #dynamicNavCategories {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.site-header .nav__search {
  flex: 1 1 auto;
  width: 100%;
  min-width: 180px;
  max-width: 400px;
}

.site-header .search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.site-header .search input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text, #0f172a);
  font: inherit;
}

.site-header .search button {
  flex: 0 0 auto;
  border: 0;
  background: var(--brand, #0d6c0d);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.site-header .search button:hover {
  background: var(--brand-2, #16a34a);
}

.site-header .nav__link,
.site-header .advanced-search-wrap,
.site-header .nav-theme-btn {
  flex: 0 0 auto;
}

.site-header .input,
.site-header .select {
  min-height: 44px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text, #0f172a);
  font: inherit;
}

/* ── dark mode: input/select — خلفية فاتحة، نفرض لون نص داكن ── */
[data-theme="dark"] .site-header .input,
[data-theme="dark"] .site-header .select {
  color: #0f2412;
}

[data-theme="dark"] .site-header .input::placeholder {
  color: rgba(15, 36, 18, 0.55);
}

.site-header .advanced-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex: 0 0 auto;
}

.site-header .advanced-search-region {
  position: relative;
  display: block;
  width: min(1180px, 92vw);
  margin: 0 auto;
  min-width: 0;
}

.site-header .advanced-search-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  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;
}

.site-header .advanced-search-region > .advanced-search-inline {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  width: min(760px, calc(100% - 32px));
  max-width: 100%;
  margin-top: 0;
  margin-inline: auto;
}

[data-theme="dark"] .site-header .advanced-search-inline {
  background: rgba(18, 28, 24, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

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

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

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

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

.site-header .burger {
  display: none;
  width: 46px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

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

.site-header .nav-theme-btn {
  white-space: nowrap;
}

/* ================================================
   القسم: استجابة الشريط العلوي ورأس الصفحة - Topbar & Header Responsive
   الغرض: تعديل التخطيط على الشاشات الصغيرة (640px) مع إظهار زر الهامبرغر
================================================ */
.password-field {
  position: relative;
}

.password-field .input {
  padding-left: 44px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.6;
  color: var(--muted);
  padding: 0;
  z-index: 2;
}

.toggle-password:hover {
  opacity: 1;
}

.toggle-password:focus-visible {
  outline: none;
  opacity: 1;
}

.toggle-password svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1024px) {
  .site-header .header__inner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .site-header .header__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .site-header .nav__inner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .site-header #dynamicNavCategories {
    flex: 1 1 240px;
    flex-wrap: wrap;
    min-width: 0;
  }

  .site-header .nav__right {
    flex: 1 1 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .site-header .nav__tools,
  .site-header .nav__tools--compact {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .site-header .nav__search {
    flex: 1 1 260px;
    min-width: 150px;
    max-width: none;
  }

  .site-header .advanced-search-inline {
    flex-wrap: wrap;
    width: min(680px, calc(100vw - 48px));
    max-width: 100%;
  }

  .site-header .advanced-search-inline .input {
    min-width: 160px;
  }

  .site-header .advanced-search-inline .select {
    flex: 1 1 140px;
    min-width: 140px;
  }
}

@media (max-width: 640px) {
  .global-site-topbar .topbar__inner {
    flex-direction: column;
    align-items: flex-start;
  }

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

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

  .site-header .burger {
    display: inline-block;
  }

  .site-header .nav {
    top: 8px;
    display: block;
    padding-bottom: 0;
  }

  .site-header .nav__inner {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    padding: 12px;
  }

  .site-header .nav:not(.is-open) .nav__inner {
    display: none;
  }

  .site-header .nav.is-open .nav__inner {
    display: flex;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .site-header .nav__link {
    width: 100%;
  }

  .site-header .nav.is-open .nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-height: 44px;
    padding: 10px 12px;
    text-align: center;
  }

  .site-header .nav__tools,
  .site-header .nav__tools--compact,
  .site-header #dynamicNavCategories {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .site-header .nav.is-open #dynamicNavCategories {
    display: contents;
  }

  .site-header .nav__right {
    width: 100%;
    margin-right: 0;
    justify-content: stretch;
  }

  .site-header .nav.is-open .nav__right {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px;
  }

  .site-header .nav__tools,
  .site-header .nav__tools--compact {
    gap: 10px;
  }

  .site-header .nav.is-open .nav__search-group {
    display: contents;
  }

  .site-header .search {
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .site-header .nav__search {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 1 1 100%;
  }

  .site-header .nav.is-open .nav__search {
    grid-column: 1 / -1;
  }

  .site-header .search input {
    width: 100%;
    min-width: 0;
  }

  .site-header .nav.is-open .search {
    min-height: 44px;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 18px;
  }

  .site-header .nav.is-open .search button {
    padding: 7px 11px;
  }

  .site-header .advanced-search-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    gap: 8px;
  }

  .site-header .advanced-search-wrap > .btn-ghost {
    width: 100%;
  }

  .site-header .nav.is-open .advanced-search-wrap {
    grid-column: 1 / 2;
    min-width: 0;
  }

  .site-header .nav.is-open #advancedSearchToggle,
  .site-header .nav.is-open .nav-theme-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .site-header .nav.is-open .nav-theme-btn {
    grid-column: 2 / 3;
    margin: 0;
  }

  .site-header .advanced-search-region {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 4vw;
  }

  .site-header.is-advanced-search-open .nav__search {
    display: none;
  }

  .site-header.is-advanced-search-open .advanced-search-region #advancedSearchBox {
    gap: 5px;
    padding: 6px;
  }

  .site-header.is-advanced-search-open .advanced-search-region #searchText {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    box-sizing: border-box;
    line-height: 1.2;
    padding: 0 10px;
  }

  .site-header.is-advanced-search-open .advanced-search-region #searchCategory,
  .site-header.is-advanced-search-open .advanced-search-region #searchSort {
    width: 100%;
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    box-sizing: border-box;
    line-height: 1.2;
    padding: 0 10px;
  }

  .site-header.is-advanced-search-open .advanced-search-region #advancedSearchBtn,
  .site-header.is-advanced-search-open .advanced-search-region #advancedSearchClose {
    width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
  }

  .site-header .advanced-search-region > .advanced-search-inline {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    transform: none;
  }

  .site-header .advanced-search-region > .advanced-search-inline .input,
  .site-header .advanced-search-region > .advanced-search-inline .select {
    min-height: 48px;
    padding: 8px 10px;
  }

  .site-header .advanced-search-region > .advanced-search-inline .btn,
  .site-header .advanced-search-region > .advanced-search-inline .btn-ghost {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
  }

  .site-header .advanced-search-inline {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }

  .site-header .nav.is-open .advanced-search-wrap.is-open {
    grid-column: 1 / -1;
    gap: 6px;
    align-items: stretch;
  }

  .site-header .nav.is-open .advanced-search-wrap.is-open .advanced-search-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-items: stretch;
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-top: 0;
    transform: none;
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
  }

  .site-header .nav.is-open .advanced-search-wrap.is-open .input,
  .site-header .nav.is-open .advanced-search-wrap.is-open .select,
  .site-header .nav.is-open .advanced-search-wrap.is-open .btn,
  .site-header .nav.is-open .advanced-search-wrap.is-open .btn-ghost {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
    align-self: stretch;
  }

  .site-header .nav.is-open .advanced-search-wrap.is-open .input,
  .site-header .nav.is-open .advanced-search-wrap.is-open .select {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .site-header .nav.is-open .advanced-search-wrap.is-open .btn,
  .site-header .nav.is-open .advanced-search-wrap.is-open .btn-ghost {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    white-space: normal;
  }

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

/* ================================================
   القسم: رأس الصفحة عند التمرير - Scrolled State Header
   الغرض: تطبيق خلفية زجاجية أكثر كثافة على شريط التنقل عند تمرير الصفحة للأسفل
================================================ */
.site-header.is-scrolled .nav__inner {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(22px);
}

[data-theme="dark"] .site-header.is-scrolled .nav__inner {
  background: rgba(10, 16, 14, 0.36);
  border-color: rgba(255, 255, 255, 0.08);
}

.site-header.is-scrolled .nav__inner {
  padding-top: 7px;
  padding-bottom: 7px;
}

.site-header.is-scrolled .nav__link {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(15, 23, 42, 0.92);
}

[data-theme="dark"] .site-header.is-scrolled .nav__link {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.96);
}

.site-header.is-scrolled .nav__link.is-active {
  background: rgba(13, 108, 13, 0.18);
  box-shadow: inset 0 0 0 1px rgba(13, 108, 13, 0.12);
}

.site-header.is-scrolled .nav__search {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .site-header.is-scrolled .nav__search {
  background: rgba(10, 16, 14, 0.32);
}

.header__actions,
.section-actions,
.category-search-tools {
  flex-wrap: wrap;
  align-items: flex-start;
}

.advanced-search-wrap {
  position: relative;
}

.advanced-search-wrap.is-open {
  flex: 0 0 auto;
}

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

.header__actions .advanced-search-wrap.is-open {
  order: initial;
}

.advanced-search-wrap.is-open .advanced-search-inline {
  position: absolute;
  bottom: calc(100% + 12px);
  top: auto;
  left: 0;
  right: auto;
  width: min(680px, 90vw);
  max-width: 90vw;
  margin-top: 0;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
  transform-origin: bottom;
}

[data-theme="dark"] .advanced-search-wrap.is-open .advanced-search-inline {
  background: rgba(18, 28, 24, 0.92);
}

.nav__tools .advanced-search-wrap.is-open .advanced-search-inline {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .nav__tools .advanced-search-wrap.is-open .advanced-search-inline {
  background: rgba(18, 28, 24, 0.82);
}

.advanced-search-wrap.is-open .advanced-search-inline .input,
.advanced-search-wrap.is-open .advanced-search-inline .select {
  min-height: 46px;
}

@media (min-width: 641px) and (max-width: 1024px) {
  .site-header .nav__inner:has(.advanced-search-wrap.is-open) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) #dynamicNavCategories {
    display: flex;
    flex-wrap: wrap;
    width: auto;
    flex: 0 0 auto;
    min-width: 0;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .nav__right {
    width: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    justify-content: flex-start;
    min-width: 0;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .nav__tools,
  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .nav__tools--compact {
    width: 100%;
    display: flex;
    flex: 1 0 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-right: 0;
    justify-content: flex-end;
    min-width: 0;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .nav__search {
    width: auto;
    max-width: none;
    flex: 1 1 260px;
    order: 0;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .advanced-search-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 0 100%;
    gap: 8px;
    order: 1;
  }

  .site-header .nav__inner:has(.advanced-search-wrap.is-open) .nav-theme-btn {
    align-self: center;
    order: 0;
  }

  .site-header .advanced-search-wrap.is-open #advancedSearchBox.advanced-search-inline {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    bottom: auto;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    margin-top: 0;
    box-sizing: border-box;
  }

  .site-header .advanced-search-wrap.is-open #searchText,
  .site-header .advanced-search-wrap.is-open #searchCategory,
  .site-header .advanced-search-wrap.is-open #searchSort,
  .site-header .advanced-search-wrap.is-open #advancedSearchBtn,
  .site-header .advanced-search-wrap.is-open #advancedSearchClose {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    box-sizing: border-box;
  }
    
}

.category-search-tools {
  display: flex;
  gap: 10px;
  width: 100%;
}

.category-search-tools>.input,
.category-search-tools>input {
  flex: 1 1 260px;
  min-width: min(320px, 100%);
}

.category-search-tools .advanced-search-wrap {
  flex: 0 0 auto;
}

.category-search-tools .advanced-search-wrap.is-open {
  justify-content: flex-start;
}

/* ================================================
   القسم: ثيم لوحة التحكم - Panel Theme
   الغرض: تعريف متغيرات CSS خاصة بلوحات الإدارة والمحرر والكاتب
   تُفعَّل بإضافة كلاس panel-theme على عنصر body
================================================ */
.panel-theme {
  --brand: #0d6c0d;
  --brand-2: #16a34a;
  --brand-soft: rgba(22, 163, 74, 0.12);
  --primary: var(--brand);
  --primary-2: var(--brand-2);
  --bg: #f3f6fb;
  --panel-bg:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 28%),
    radial-gradient(circle at left center, rgba(59, 130, 246, 0.1), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.72);
  --surface-hover: rgba(255, 255, 255, 0.92);
  --surface-item: rgba(255, 255, 255, 0.7);
  --surface-input: rgba(255, 255, 255, 0.92);
  --surface-focus: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(22, 163, 74, 0.16);
  --text: #0f172a;
  --muted: #64748b;
  --success: #15803d;
  --warning: #b45309;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.12);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  background: var(--panel-bg);
  color: var(--text);
}

/* ================================================
   القسم: ثيم لوحة التحكم - وضع الظلام - Panel Dark Mode Variables
   الغرض: استبدال متغيرات panel-theme بقيم داكنة للوضع الليلي
================================================ */
html[data-theme="dark"] body.panel-theme,
body.panel-theme[data-theme="dark"] {
  --bg: #0e2018;
  --panel-bg:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.07), transparent 28%),
    radial-gradient(circle at left center, rgba(13, 108, 13, 0.1), transparent 24%),
    linear-gradient(180deg, #0e2018 0%, #0a1a10 100%);
  --surface: rgba(20, 42, 28, 0.85);
  --surface-strong: #152a1d;
  --surface-muted: rgba(20, 42, 28, 0.78);
  --surface-hover: rgba(24, 48, 34, 0.94);
  --surface-item: rgba(18, 28, 24, 0.72);
  --surface-input: rgba(18, 28, 24, 0.88);
  --surface-focus: rgba(22, 38, 30, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(34, 197, 94, 0.38);
  --text: #e8f6ea;
  --muted: rgba(203, 213, 225, 0.78);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.24);
}

body.panel-theme {
  background: var(--panel-bg);
  color: var(--text);
}

.panel-theme .sidebar,
.panel-theme .panel,
.panel-theme .card,
.panel-theme .session-box,
.panel-theme .tip-box,
.panel-theme .preview-card,
.panel-theme .stats-card,
.panel-theme .tips-card,
.panel-theme .posts-card,
.panel-theme .stat,
.panel-theme .table-card,
.panel-theme .filters-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.panel-theme .session-box {
  padding: 0;
  overflow: hidden;
}

.panel-theme .session-card {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
  width: 100%;
  min-width: 260px;
}

.panel-theme .session-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
}

.panel-theme .session-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.panel-theme .session-row:last-child {
  margin-bottom: 0;
}

.panel-theme .session-label {
  color: var(--muted);
  white-space: nowrap;
}

.panel-theme .session-value {
  display: block;
  width: 100%;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  unicode-bidi: plaintext;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-theme .sidebar .session-card {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.panel-theme .sidebar .session-row {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.panel-theme .sidebar .session-value {
  min-width: 0;
  text-align: left;
  unicode-bidi: plaintext;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-theme .brand-badge,
.panel-theme .brand__logo,
.panel-theme .side__brand-logo {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 28px rgba(22, 163, 74, 0.28);
}

.panel-theme .nav-btn,
.panel-theme .side__link {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.panel-theme .nav-btn:hover,
.panel-theme .side__link:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.panel-theme .nav-btn.active,
.panel-theme .side__link.is-active {
  background: #e6f4ea;
  color: #166534;
  font-weight: 600;
  border-color: rgba(22, 163, 74, 0.2);
}

.panel-theme .sidebar-nav .nav-btn--primary,
.panel-theme .sidebar-nav .nav-btn--primary:hover,
.panel-theme .sidebar-nav .nav-btn--primary:active,
.panel-theme .sidebar-nav .nav-btn--primary:focus,
.panel-theme .sidebar-nav .nav-btn--primary:focus-visible,
.panel-theme .sidebar-nav .nav-btn--primary.active {
  background: linear-gradient(135deg, #0d6c0d, #16a34a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 16px 34px rgba(22, 163, 74, 0.22);
}

.panel-theme .sidebar-nav .nav-btn--primary:focus,
.panel-theme .sidebar-nav .nav-btn--primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(22, 163, 74, 0.16),
    0 16px 34px rgba(22, 163, 74, 0.22);
}

.panel-theme .toolbar,
.panel-theme .external-like-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-theme .toolbar-left,
.panel-theme .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.panel-theme .filter-pill-group {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.panel-theme .filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.84);
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.panel-theme .filter-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(22, 163, 74, 0.08);
  color: #166534;
  box-shadow: 0 12px 22px rgba(22, 163, 74, 0.08);
}

.panel-theme .filter-pill.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 14px 24px rgba(22, 163, 74, 0.18);
}

.panel-theme .filter-pill.active:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.panel-theme .search-input,
.panel-theme .external-like-toolbar input[type="search"],
.panel-theme .toolbar input[type="search"] {
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 6px 18px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.panel-theme .search-input:focus,
.panel-theme .external-like-toolbar input[type="search"]:focus,
.panel-theme .toolbar input[type="search"]:focus {
  outline: none;
  border-color: rgba(22, 163, 74, 0.32);
  box-shadow:
    0 0 0 4px rgba(22, 163, 74, 0.12),
    0 10px 22px rgba(15, 23, 42, 0.06);
}

.panel-theme .search-input::placeholder,
.panel-theme .external-like-toolbar input[type="search"]::placeholder,
.panel-theme .toolbar input[type="search"]::placeholder {
  color: var(--muted);
}

.panel-theme .filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.panel-theme .filter-row-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.panel-theme .filter-cat-select {
  min-height: 38px;
  min-width: 150px;
  padding: 8px 36px 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.panel-theme .filter-cat-select:hover {
  border-color: rgba(22, 163, 74, 0.22);
}

.panel-theme .filter-cat-select:focus {
  outline: none;
  border-color: rgba(22, 163, 74, 0.32);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.panel-theme .results-line,
.panel-theme .results-count {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

/* Keep the editor sidebar fixed on the right across internal/external editor pages. */
html:has(body.panel-theme:has(#internalReviewNavBtn)),
html:has(body.panel-theme:has(.sidebar-nav a[href="editor/editor.html"])) {
  overflow-y: scroll;
}

body.panel-theme:has(#internalReviewNavBtn),
body.panel-theme:has(.sidebar-nav a[href="editor/editor.html"]) {
  min-height: 100vh;
}

.panel-theme:has(#internalReviewNavBtn) .layout,
.panel-theme:has(.sidebar-nav a[href="editor/editor.html"]) .layout {
  display: block;
}

.panel-theme:has(#internalReviewNavBtn) .sidebar,
.panel-theme:has(.sidebar-nav a[href="editor/editor.html"]) .sidebar {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: 270px;
  min-width: 270px;
  max-width: 270px;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  border-radius: 0;
  box-sizing: border-box;
}

.panel-theme:has(#internalReviewNavBtn) .main,
.panel-theme:has(.sidebar-nav a[href="editor/editor.html"]) .main {
  margin-right: 294px;
}

.panel-theme:has(#internalReviewNavBtn) .sidebar-nav .nav-btn,
.panel-theme:has(.sidebar-nav a[href="editor/editor.html"]) .sidebar-nav .nav-btn {
  font-family: inherit;
  line-height: 1.4;
}

.panel-theme:has(#internalReviewNavBtn) .admin-shell {
  margin-right: 24px;
  margin-left: auto;
}

/* ================================================
   القسم: أزرار لوحة التحكم - Panel Theme Buttons
   الغرض: تنسيق الأزرار الرئيسية والثانوية وأزرار الشريط الجانبي داخل لوحات التحكم
================================================ */
.panel-theme .btn {
  transition: all 0.15s ease;
}

.panel-theme .btn:hover {
  transform: translateY(-1px);
}

button:disabled,
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

.unsaved-guard-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.52);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 2000;
}

.unsaved-guard-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.unsaved-guard-modal {
  width: min(420px, 100%);
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, rgba(15, 23, 42, 0.1));
  border-radius: 22px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
  padding: 24px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.unsaved-guard-overlay.is-open .unsaved-guard-modal {
  transform: translateY(0) scale(1);
}

.unsaved-guard-modal h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.unsaved-guard-modal p {
  margin: 0;
  color: var(--muted, #475569);
  line-height: 1.8;
}

.unsaved-guard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.unsaved-guard-btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.unsaved-guard-btn:hover {
  transform: translateY(-1px);
}

.unsaved-guard-btn--secondary {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text, #0f172a);
}

.unsaved-guard-btn--primary {
  background: linear-gradient(135deg, var(--brand, #16a34a), var(--brand-2, #15803d));
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(22, 163, 74, 0.22);
}

.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

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

.confirm-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.confirm-modal {
  width: min(100%, 430px);
  padding: 24px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text, #0f172a);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: none;
  text-align: right;
}

.confirm-modal-overlay.is-open .confirm-modal {
  /* animation removed — transform was animation-only */
}

.confirm-modal h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted, #475569);
  line-height: 1.8;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.confirm-modal__btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.confirm-modal__btn:hover {
  transform: translateY(-1px);
}

.confirm-modal__btn--secondary {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text, #0f172a);
}

.confirm-modal__btn--danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(220, 38, 38, 0.2);
}

.confirm-modal__btn--success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(22, 163, 74, 0.22);
}

[data-theme="dark"] .confirm-modal-overlay {
  background: rgba(2, 6, 23, 0.58);
}

[data-theme="dark"] .confirm-modal {
  background: rgba(13, 27, 21, 0.97);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ecfdf5;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .confirm-modal p {
  color: rgba(226, 232, 240, 0.78);
}

[data-theme="dark"] .confirm-modal__btn--secondary {
  background: rgba(148, 163, 184, 0.14);
  color: #ecfdf5;
}

[data-theme="dark"] .confirm-modal__btn--danger {
  box-shadow: 0 14px 28px rgba(220, 38, 38, 0.26);
}

[data-theme="dark"] .confirm-modal__btn--success {
  box-shadow: 0 14px 28px rgba(22, 163, 74, 0.28);
}

.skeleton-card {
  background: #f3f4f6;
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  margin-bottom: 10px;
}

.skeleton-line.short {
  width: 35%;
}

.skeleton-line.medium {
  width: 60%;
}

.skeleton-line.long {
  width: 90%;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  animation: jmSkeletonShimmer 1.4s infinite;
}

@keyframes jmSkeletonShimmer {
  100% {
    transform: translateX(100%);
  }
}

.empty-state {
  text-align: center;
  padding: 30px;
  color: #666;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.error-state {
  text-align: center;
  padding: 30px;
  color: #991b1b;
}

.error-state h3 {
  margin-bottom: 8px;
}

.error-state p {
  color: #555;
}

.panel-theme .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 16px 34px rgba(22, 163, 74, 0.28);
}

.panel-theme .btn-secondary {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.panel-theme .chip,
.panel-theme .chip--danger {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.panel-theme .chip--danger {
  color: var(--danger);
}

.panel-theme .post-item {
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel-theme .post-item:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 34px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.panel-theme .post-right,
.panel-theme .post-item__head,
.panel-theme .post-top {
  gap: 14px;
}

.panel-theme .post-item--with-history {
  padding: 0;
  overflow: hidden;
}

.panel-theme .post-right {
  padding: 20px 22px;
}

.panel-theme .post-item__head,
.panel-theme .post-top {
  margin-bottom: 10px;
}

.panel-theme .post-item__title,
.panel-theme .post-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.panel-theme .post-item__summary,
.panel-theme .post-excerpt {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.95;
}

.panel-theme .post-item__meta,
.panel-theme .post-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 14px;
}

.panel-theme .post-item__meta .small-chip,
.panel-theme .post-item__meta .status-badge,
.panel-theme .post-meta .badge,
.panel-theme .post-meta .chip {
  padding: 6px 11px;
  font-size: 11px;
}

.panel-theme .post-item__actions,
.panel-theme .post-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  justify-content: flex-start;
  margin-top: 2px;
}

.panel-theme .post-item__actions .btn,
.panel-theme .post-actions .btn,
.panel-theme .post-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.panel-theme .post-item__actions .btn:hover,
.panel-theme .post-actions .btn:hover,
.panel-theme .post-actions a.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.12);
}

.panel-theme .post-item__actions .btn-danger,
.panel-theme .post-actions .btn-danger {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.16);
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.08);
}

.panel-theme .post-item__actions .btn-danger:hover,
.panel-theme .post-actions .btn-danger:hover {
  background: rgba(220, 38, 38, 0.14);
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.22);
  box-shadow: 0 14px 26px rgba(220, 38, 38, 0.12);
}

/* ================================================
   القسم: زر تبديل المظهر العائم - Floating Theme Toggle Button
   الغرض: زر ثابت في أسفل يسار الشاشة لتبديل الوضع الفاتح/الداكن
   يُحقن تلقائياً في الصفحات التي لا تحتوي على زر ثيم في شريط التنقل
================================================ */
.panel-theme .action-message {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.75;
  letter-spacing: -0.01em;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.panel-theme .action-message.is-success {
  color: #166534;
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.98), rgba(220, 252, 231, 0.96));
  border: 1px solid rgba(22, 101, 52, 0.14);
}

.panel-theme .action-message.is-error {
  color: #991b1b;
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.98), rgba(254, 226, 226, 0.96));
  border: 1px solid rgba(153, 27, 27, 0.14);
}

.panel-theme .action-message.show {
  transform: translateY(0) scale(1);
}

.panel-theme .notice-wrap .notice {
  border-radius: 18px;
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.75;
  letter-spacing: -0.01em;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  animation: slideInNotice 0.22s ease;
}

.panel-theme .notice-wrap .notice-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: rgba(22, 101, 52, 0.16);
}

.panel-theme .notice-wrap .notice-error {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: rgba(153, 27, 27, 0.16);
}

.panel-theme .notice-wrap .notice-info {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(29, 78, 216, 0.16);
}

.global-theme-btn {
  position: fixed;
  left: 20px;
  bottom: 76px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(12px);
}

.global-theme-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
}

[data-theme="dark"] .global-theme-btn {
  background: rgba(18, 28, 24, 0.92);
  color: #ecfdf5;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .global-theme-btn:hover {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}

/* ================================================
   القسم: تجاوزات الوضع الداكن للوحات - Dark Mode Panel Overrides
   الغرض: تطبيق ألوان الوضع الداكن على مكونات لوحات التحكم المختلفة
   (الخلفية، الحقول، التسميات، البطاقات، الرسائل، الأزرار)
================================================ */
/* ─── dark mode: panel page body background ─── */
[data-theme="dark"] body.panel-theme {
  background:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.07), transparent 28%),
    radial-gradient(circle at left center, rgba(13, 108, 13, 0.1), transparent 24%),
    linear-gradient(180deg, #0e2018 0%, #0a1a10 100%);
}

/* ─── dark mode: inputs / selects / textareas in panel pages ─── */
[data-theme="dark"] .panel-theme input,
[data-theme="dark"] .panel-theme select,
[data-theme="dark"] .panel-theme textarea {
  background: rgba(18, 28, 24, 0.88);
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--text, #ecfdf5);
}

[data-theme="dark"] .panel-theme input::placeholder,
[data-theme="dark"] .panel-theme textarea::placeholder {
  color: rgba(203, 213, 225, 0.5);
  opacity: 1;
}

[data-theme="dark"] .panel-theme input:focus,
[data-theme="dark"] .panel-theme select:focus,
[data-theme="dark"] .panel-theme textarea:focus {
  background: rgba(22, 38, 30, 0.96);
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1), 0 8px 20px rgba(0, 0, 0, 0.18);
}

/* ─── dark mode: labels, hints, section titles ─── */
[data-theme="dark"] .panel-theme label {
  color: var(--text, #ecfdf5);
}

[data-theme="dark"] .panel-theme .hint,
[data-theme="dark"] .panel-theme .panel__head p,
[data-theme="dark"] .panel-theme .section__title p,
[data-theme="dark"] .panel-theme .brand__text p,
[data-theme="dark"] .panel-theme .brand p {
  color: var(--muted, rgba(203, 213, 225, 0.78));
}

/* ─── dark mode: stat-item and tip-item cards ─── */
[data-theme="dark"] .panel-theme .stat-item,
[data-theme="dark"] .panel-theme .tip-item {
  background: rgba(18, 28, 24, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .panel-theme .stat-item strong,
[data-theme="dark"] .panel-theme .tip-item strong {
  color: var(--text, #ecfdf5);
}

[data-theme="dark"] .panel-theme .stat-item span,
[data-theme="dark"] .panel-theme .tip-item span {
  color: var(--muted, rgba(203, 213, 225, 0.78));
}

[data-theme="dark"] .panel-theme .stat-item b {
  color: #4ade80;
}

/* ─── dark mode: notice / form messages ─── */
[data-theme="dark"] .panel-theme .notice.is-success {
  background: rgba(21, 128, 61, 0.18);
  border-color: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

[data-theme="dark"] .panel-theme .notice.is-error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

/* ─── dark mode: preview image placeholder ─── */
[data-theme="dark"] .panel-theme .preview-image {
  background: rgba(18, 28, 24, 0.7);
}

/* ─── dark mode: panel head border ─── */
[data-theme="dark"] .panel-theme .panel__head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ─── dark mode: field-help popover ─── */
[data-theme="dark"] .panel-theme .field-help-popover {
  background: #1a2e24;
  border-color: rgba(255, 255, 255, 0.12);
  color: #ecfdf5;
}

[data-theme="dark"] .panel-theme .field-help-popover p {
  color: rgba(203, 213, 225, 0.85);
}

[data-theme="dark"] .panel-theme .field-help-popover::after {
  background: #1a2e24;
  border-color: rgba(255, 255, 255, 0.12);
}

/* ─── dark mode: action-message ─── */
[data-theme="dark"] .panel-theme .action-message.is-success {
  background: linear-gradient(135deg, rgba(12, 36, 24, 0.98), rgba(20, 83, 45, 0.86));
  color: #dcfce7;
  border-color: rgba(74, 222, 128, 0.18);
}

[data-theme="dark"] .panel-theme .action-message.is-error {
  background: linear-gradient(135deg, rgba(53, 17, 21, 0.98), rgba(127, 29, 29, 0.82));
  color: #fee2e2;
  border-color: rgba(252, 165, 165, 0.18);
}

[data-theme="dark"] .panel-theme .action-message {
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .panel-theme .notice-wrap .notice {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .panel-theme .notice-wrap .notice-success {
  background: linear-gradient(135deg, rgba(12, 36, 24, 0.98), rgba(20, 83, 45, 0.86));
  border-color: rgba(74, 222, 128, 0.18);
  color: #dcfce7;
}

[data-theme="dark"] .panel-theme .notice-wrap .notice-error {
  background: linear-gradient(135deg, rgba(53, 17, 21, 0.98), rgba(127, 29, 29, 0.82));
  border-color: rgba(252, 165, 165, 0.18);
  color: #fee2e2;
}

[data-theme="dark"] .panel-theme .notice-wrap .notice-info {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 64, 175, 0.84));
  border-color: rgba(147, 197, 253, 0.18);
  color: #dbeafe;
}

/* ─── dark mode: logout button ─── */
[data-theme="dark"] .panel-theme .logout-btn {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

/* ─── dark mode: session value text ─── */
[data-theme="dark"] .panel-theme .session-value {
  color: var(--text, #ecfdf5);
}

/* ─── dark mode: dark mode for non-panel-theme pages (public writer/editor styles) ─── */
[data-theme="dark"] .sidebar .session-card,
[data-theme="dark"] .article-card,
[data-theme="dark"] .card-meta {
  color: var(--text, #ecfdf5);
}

/* ================================================
   القسم: تجاوزات قوية لوضع الداكن - Strong Dark Mode !important Overrides
   الغرض: ضمان تطبيق الألوان الداكنة بأولوية قصوى عند تعارض المحددات
   يستخدم !important لمنع أي تسريب ألوان فاتحة في الوضع الداكن
================================================ */
html[data-theme="dark"] body.panel-theme,
body.panel-theme[data-theme="dark"] {
  --bg: #0e2018;
  --panel-bg:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.07), transparent 28%),
    radial-gradient(circle at left center, rgba(13, 108, 13, 0.1), transparent 24%),
    linear-gradient(180deg, #0e2018 0%, #0a1a10 100%);
  --surface: rgba(20, 42, 28, 0.85);
  --surface-strong: #152a1d;
  --surface-muted: rgba(20, 42, 28, 0.78);
  --surface-hover: rgba(24, 48, 34, 0.94);
  --surface-item: rgba(18, 28, 24, 0.72);
  --surface-input: rgba(18, 28, 24, 0.88);
  --surface-focus: rgba(22, 38, 30, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(34, 197, 94, 0.38);
  --text: #e8f6ea;
  --muted: rgba(203, 213, 225, 0.78);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.24);
  background: var(--panel-bg) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme .sidebar,
html[data-theme="dark"] body.panel-theme .panel,
html[data-theme="dark"] body.panel-theme .card,
html[data-theme="dark"] body.panel-theme .session-box,
html[data-theme="dark"] body.panel-theme .tip-box,
html[data-theme="dark"] body.panel-theme .preview-card,
html[data-theme="dark"] body.panel-theme .stats-card,
html[data-theme="dark"] body.panel-theme .tips-card,
html[data-theme="dark"] body.panel-theme .posts-card,
html[data-theme="dark"] body.panel-theme .stat,
html[data-theme="dark"] body.panel-theme .table-card,
html[data-theme="dark"] body.panel-theme .filters-card,
body.panel-theme[data-theme="dark"] .sidebar,
body.panel-theme[data-theme="dark"] .panel,
body.panel-theme[data-theme="dark"] .card,
body.panel-theme[data-theme="dark"] .session-box,
body.panel-theme[data-theme="dark"] .tip-box,
body.panel-theme[data-theme="dark"] .preview-card,
body.panel-theme[data-theme="dark"] .stats-card,
body.panel-theme[data-theme="dark"] .tips-card,
body.panel-theme[data-theme="dark"] .posts-card,
body.panel-theme[data-theme="dark"] .stat,
body.panel-theme[data-theme="dark"] .table-card,
body.panel-theme[data-theme="dark"] .filters-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme .session-card,
body.panel-theme[data-theme="dark"] .session-card {
  background: var(--surface-strong) !important;
  box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] body.panel-theme .session-label,
body.panel-theme[data-theme="dark"] .session-label,
html[data-theme="dark"] body.panel-theme .hint,
body.panel-theme[data-theme="dark"] .hint,
html[data-theme="dark"] body.panel-theme .panel__head p,
body.panel-theme[data-theme="dark"] .panel__head p,
html[data-theme="dark"] body.panel-theme .section__title p,
body.panel-theme[data-theme="dark"] .section__title p,
html[data-theme="dark"] body.panel-theme .brand__text p,
body.panel-theme[data-theme="dark"] .brand__text p,
html[data-theme="dark"] body.panel-theme .brand p,
body.panel-theme[data-theme="dark"] .brand p {
  color: var(--muted) !important;
}

html[data-theme="dark"] body.panel-theme .session-value,
body.panel-theme[data-theme="dark"] .session-value,
html[data-theme="dark"] body.panel-theme label,
body.panel-theme[data-theme="dark"] label {
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme .nav-btn,
html[data-theme="dark"] body.panel-theme .side__link,
html[data-theme="dark"] body.panel-theme .btn-secondary,
html[data-theme="dark"] body.panel-theme .chip,
html[data-theme="dark"] body.panel-theme .chip--danger,
body.panel-theme[data-theme="dark"] .nav-btn,
body.panel-theme[data-theme="dark"] .side__link,
body.panel-theme[data-theme="dark"] .btn-secondary,
body.panel-theme[data-theme="dark"] .chip,
body.panel-theme[data-theme="dark"] .chip--danger {
  background: var(--surface-muted) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] body.panel-theme .nav-btn:hover,
html[data-theme="dark"] body.panel-theme .side__link:hover,
html[data-theme="dark"] body.panel-theme .btn-secondary:hover,
body.panel-theme[data-theme="dark"] .nav-btn:hover,
body.panel-theme[data-theme="dark"] .side__link:hover,
body.panel-theme[data-theme="dark"] .btn-secondary:hover {
  background: var(--surface-hover) !important;
  border-color: var(--border-strong) !important;
}

html[data-theme="dark"] body.panel-theme .filter-pill,
html[data-theme="dark"] body.panel-theme .filter-cat-select,
html[data-theme="dark"] body.panel-theme .search-input,
html[data-theme="dark"] body.panel-theme .external-like-toolbar input[type="search"],
html[data-theme="dark"] body.panel-theme .toolbar input[type="search"],
body.panel-theme[data-theme="dark"] .filter-pill,
body.panel-theme[data-theme="dark"] .filter-cat-select,
body.panel-theme[data-theme="dark"] .search-input,
body.panel-theme[data-theme="dark"] .external-like-toolbar input[type="search"],
body.panel-theme[data-theme="dark"] .toolbar input[type="search"] {
  background: var(--surface-muted) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 18px rgba(0, 0, 0, 0.12) !important;
}

html[data-theme="dark"] body.panel-theme .filter-pill:hover,
body.panel-theme[data-theme="dark"] .filter-pill:hover {
  background: rgba(34, 197, 94, 0.14) !important;
  border-color: rgba(34, 197, 94, 0.22) !important;
  color: #dcfce7 !important;
}

html[data-theme="dark"] body.panel-theme .filter-pill.active,
html[data-theme="dark"] body.panel-theme .filter-pill.active:hover,
body.panel-theme[data-theme="dark"] .filter-pill.active,
body.panel-theme[data-theme="dark"] .filter-pill.active:hover {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

html[data-theme="dark"] body.panel-theme .search-input::placeholder,
html[data-theme="dark"] body.panel-theme .external-like-toolbar input[type="search"]::placeholder,
html[data-theme="dark"] body.panel-theme .toolbar input[type="search"]::placeholder,
body.panel-theme[data-theme="dark"] .search-input::placeholder,
body.panel-theme[data-theme="dark"] .external-like-toolbar input[type="search"]::placeholder,
body.panel-theme[data-theme="dark"] .toolbar input[type="search"]::placeholder {
  color: var(--muted) !important;
}

html[data-theme="dark"] body.panel-theme .search-input:focus,
html[data-theme="dark"] body.panel-theme .external-like-toolbar input[type="search"]:focus,
html[data-theme="dark"] body.panel-theme .toolbar input[type="search"]:focus,
body.panel-theme[data-theme="dark"] .search-input:focus,
body.panel-theme[data-theme="dark"] .external-like-toolbar input[type="search"]:focus,
body.panel-theme[data-theme="dark"] .toolbar input[type="search"]:focus,
html[data-theme="dark"] body.panel-theme .filter-cat-select:focus,
body.panel-theme[data-theme="dark"] .filter-cat-select:focus {
  border-color: rgba(34, 197, 94, 0.28) !important;
  box-shadow:
    0 0 0 4px rgba(34, 197, 94, 0.12),
    0 10px 22px rgba(0, 0, 0, 0.14) !important;
}

html[data-theme="dark"] body.panel-theme #backLink,
body.panel-theme[data-theme="dark"] #backLink {
  background: var(--surface-muted) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] body.panel-theme #backLink:hover,
html[data-theme="dark"] body.panel-theme #backLink:focus,
html[data-theme="dark"] body.panel-theme #backLink:active,
body.panel-theme[data-theme="dark"] #backLink:hover,
body.panel-theme[data-theme="dark"] #backLink:focus,
body.panel-theme[data-theme="dark"] #backLink:active {
  background: var(--surface-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme input,
html[data-theme="dark"] body.panel-theme select,
html[data-theme="dark"] body.panel-theme textarea,
body.panel-theme[data-theme="dark"] input,
body.panel-theme[data-theme="dark"] select,
body.panel-theme[data-theme="dark"] textarea {
  background: var(--surface-input) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme input::placeholder,
html[data-theme="dark"] body.panel-theme textarea::placeholder,
body.panel-theme[data-theme="dark"] input::placeholder,
body.panel-theme[data-theme="dark"] textarea::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}

html[data-theme="dark"] body.panel-theme input:focus,
html[data-theme="dark"] body.panel-theme select:focus,
html[data-theme="dark"] body.panel-theme textarea:focus,
body.panel-theme[data-theme="dark"] input:focus,
body.panel-theme[data-theme="dark"] select:focus,
body.panel-theme[data-theme="dark"] textarea:focus {
  background: var(--surface-focus) !important;
  border-color: var(--border-strong) !important;
}

html[data-theme="dark"] body.panel-theme .stat-item,
html[data-theme="dark"] body.panel-theme .tip-item,
html[data-theme="dark"] body.panel-theme .post-item,
body.panel-theme[data-theme="dark"] .stat-item,
body.panel-theme[data-theme="dark"] .tip-item,
body.panel-theme[data-theme="dark"] .post-item {
  background: var(--surface-item) !important;
  border-color: var(--border) !important;
}

html[data-theme="dark"] body.panel-theme .stat-item strong,
html[data-theme="dark"] body.panel-theme .tip-item strong,
body.panel-theme[data-theme="dark"] .stat-item strong,
body.panel-theme[data-theme="dark"] .tip-item strong {
  color: var(--text) !important;
}

html[data-theme="dark"] body.panel-theme .stat-item span,
html[data-theme="dark"] body.panel-theme .tip-item span,
html[data-theme="dark"] body.panel-theme .post-item__summary,
html[data-theme="dark"] body.panel-theme .preview-summary,
html[data-theme="dark"] body.panel-theme .preview-meta,
html[data-theme="dark"] body.panel-theme .session-box p,
body.panel-theme[data-theme="dark"] .stat-item span,
body.panel-theme[data-theme="dark"] .tip-item span,
body.panel-theme[data-theme="dark"] .post-item__summary,
body.panel-theme[data-theme="dark"] .preview-summary,
body.panel-theme[data-theme="dark"] .preview-meta,
body.panel-theme[data-theme="dark"] .session-box p {
  color: var(--muted) !important;
}

html[data-theme="dark"] body.panel-theme .post-item__actions .btn-danger,
html[data-theme="dark"] body.panel-theme .post-actions .btn-danger,
body.panel-theme[data-theme="dark"] .post-item__actions .btn-danger,
body.panel-theme[data-theme="dark"] .post-actions .btn-danger {
  background: rgba(248, 113, 113, 0.14) !important;
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.24) !important;
  box-shadow: 0 10px 20px rgba(248, 113, 113, 0.08) !important;
}

html[data-theme="dark"] body.panel-theme .post-item__actions .btn-danger:hover,
html[data-theme="dark"] body.panel-theme .post-actions .btn-danger:hover,
body.panel-theme[data-theme="dark"] .post-item__actions .btn-danger:hover,
body.panel-theme[data-theme="dark"] .post-actions .btn-danger:hover {
  background: rgba(248, 113, 113, 0.2) !important;
  color: #fee2e2 !important;
  border-color: rgba(248, 113, 113, 0.32) !important;
}

html[data-theme="dark"] body.panel-theme .small-chip,
body.panel-theme[data-theme="dark"] .small-chip {
  background: var(--surface-muted) !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
}

html[data-theme="dark"] body.panel-theme .empty-state,
body.panel-theme[data-theme="dark"] .empty-state {
  background: var(--surface-item) !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
}

html[data-theme="dark"] body.panel-theme .btn-danger,
body.panel-theme[data-theme="dark"] .btn-danger {
  background: rgba(220, 38, 38, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.24) !important;
  color: #fca5a5 !important;
  box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] body.panel-theme .status-deleted,
body.panel-theme[data-theme="dark"] .status-deleted {
  background: rgba(148, 163, 184, 0.14) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: rgba(226, 232, 240, 0.84) !important;
}

/* ================================================
   القسم: استجابة العناصر العائمة - Floating Elements Responsive
   الغرض: تعديل موضع الأزرار العائمة وتوسيعها على الشاشات الصغيرة
================================================ */
@media (max-width: 640px) {
  .global-home-link {
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    min-width: 168px;
    padding: 12px 18px;
  }

  .global-home-link:hover {
    transform: translateX(-50%) translateY(-2px);
  }

  .auth-entry-link {
    width: 100%;
  }

  .advanced-search-wrap.is-open .advanced-search-inline {
    padding: 12px;
  }

  .global-theme-btn {
    left: 50%;
    bottom: 68px;
    transform: translateX(-50%);
    padding: 9px 16px;
  }

  .global-theme-btn:hover {
    transform: translateX(-50%) translateY(-2px);
  }
}

/* ── nav-badge: شارة العدد في الشريط الجانبي (مشتركة بين جميع الصفحات) ── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 20px;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

[data-theme="dark"] .nav-badge {
  background: #ef4444;
}
/* ── unified sidebar nav button layout with badges ── */
.panel-theme .sidebar-nav .nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-decoration: none;
}

.panel-theme .sidebar-nav .nav-btn>span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shared admin review preview */
.admin-shell .crs,
.editor-shell .crs,
.dashboard-shell .crs {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.admin-shell .crs > div,
.editor-shell .crs > div,
.dashboard-shell .crs > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.6;
}

.admin-shell .crs strong,
.editor-shell .crs strong,
.dashboard-shell .crs strong {
  color: #334155;
  font-size: 12.5px;
  font-weight: 700;
}

.admin-shell .crs small,
.editor-shell .crs small,
.dashboard-shell .crs small {
  color: #64748b;
  font-size: 12px;
}

[data-theme="dark"] .admin-shell .crs,
[data-theme="dark"] .editor-shell .crs,
[data-theme="dark"] .dashboard-shell .crs {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .admin-shell .crs strong,
[data-theme="dark"] .editor-shell .crs strong,
[data-theme="dark"] .dashboard-shell .crs strong {
  color: #e2e8f0;
}

[data-theme="dark"] .admin-shell .crs small,
[data-theme="dark"] .editor-shell .crs small,
[data-theme="dark"] .dashboard-shell .crs small {
  color: rgba(203,213,225,0.72);
}

/* Shared notification cards */

body.panel-theme .notification-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

body.panel-theme .notification-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

body.panel-theme .notification-card.is-unread {
  border-right: 4px solid #2563eb;
  background: #f8fbff;
}

body.panel-theme .notification-card__body {
  flex: 1;
  min-width: 0;
}

body.panel-theme .notification-card__title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

body.panel-theme .notification-card__message {
  font-size: 13px;
  line-height: 1.7;
  color: #475569;
  margin-bottom: 8px;
}

body.panel-theme .notification-card__date {
  font-size: 12px;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

body.panel-theme .notification-card__date small {
  font-size: 11px;
  opacity: 0.82;
}

body.panel-theme .notification-card__action {
  flex-shrink: 0;
  align-self: center;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease;
}

body.panel-theme .notification-card__action:hover {
  background: #dbeafe;
}

[data-theme="dark"] body.panel-theme .notification-card {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] body.panel-theme .notification-card.is-unread {
  background: rgba(30, 41, 59, 0.9);
}

[data-theme="dark"] body.panel-theme .notification-card__title {
  color: #f1f5f9;
}

[data-theme="dark"] body.panel-theme .notification-card__message {
  color: #cbd5e1;
}

[data-theme="dark"] body.panel-theme .notification-card__date {
  color: rgba(203,213,225,0.72);
}

[data-theme="dark"] body.panel-theme .notification-card__action {
  background: rgba(37, 99, 235, 0.16);
  color: #93c5fd;
}
