/* ============================================================
   HUNTER — Design System v1.0 (نضيف من الصفر)
   ============================================================ */

/* === 1. متغيرات الألوان === */
:root, html[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-card: #1a2332;
  --bg-card-hover: #1e293b;
  --bg-elevated: #111827;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --brand: #10b981;
  --brand-hover: #059669;
  --brand-secondary: #38d9d9;
  --brand-accent: #f0a94e;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.5);
  --gradient-brand: linear-gradient(135deg, #10b981 0%, #38d9d9 100%);
  --gradient-card: linear-gradient(135deg, #1a2332 0%, #0f172a 100%);
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  --text-dim: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --brand: #059669;
  --brand-hover: #047857;
  --brand-secondary: #0891b2;
  --brand-accent: #d97706;
  --shadow-card: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 24px rgba(15, 23, 42, 0.12);
  --gradient-brand: linear-gradient(135deg, #059669 0%, #0891b2 100%);
  --gradient-card: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* === 2. الأساسيات === */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  background-image: radial-gradient(circle at 30% 0%, rgba(16, 185, 129, 0.04), transparent 50%);
  background-attachment: fixed;
  margin: 0;
}

/* === 3. شريط التنقل بين الأقسام (Tabs) === */

/* الحاوية الرئيسية - سنتر */
.sections-nav-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 24px;
  padding: 16px 0;
  position: relative;
  z-index: 35;
}

/* الحاوية الداخلية للـ tabs - شكل حبة */
.hunter-primary-nav {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* زر التبويب */
.hunter-primary-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.hunter-primary-nav-btn .nav-icon {
  font-size: 16px;
  line-height: 1;
}

.hunter-primary-nav-btn .nav-text {
  font-size: 13px;
}

.hunter-primary-nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] .hunter-primary-nav-btn:hover {
  background: rgba(15, 23, 42, 0.04);
}

/* الزر النشط - شيكاني */
.hunter-primary-nav-btn.is-active {
  color: #ffffff;
  background: var(--gradient-brand);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  font-weight: 700;
}

html[data-theme="light"] .hunter-primary-nav-btn.is-active {
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

/* === 4. كروت البوستات — تباين ملحوظ === */

.fb-clean-card,
article.news-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* شريط علوي ملوّن */
.fb-clean-card::before,
article.news-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981 0%, #38d9d9 50%, #60a5fa 100%);
  z-index: 2;
}

article.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(16, 185, 129, 0.3);
}

/* العنوان داخل الكارت */
article.news-card h3 {
  color: var(--text);
  font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  letter-spacing: -0.01em;
}

/* المحتوى */
.fb-content {
  color: var(--text-secondary);
  line-height: 1.85;
}

/* === 5. الـ Header === */

nav.fixed.top-0 {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] nav.fixed.top-0 {
  background: rgba(255, 255, 255, 0.92);
}

/* شريط البحث */
nav.fixed.top-0 input.inp,
nav.fixed.top-0 #searchInput {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 10px 16px 10px 40px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.22s ease;
}

nav.fixed.top-0 input.inp:focus,
nav.fixed.top-0 #searchInput:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  outline: none;
}

html[data-theme="light"] nav.fixed.top-0 input.inp,
html[data-theme="light"] nav.fixed.top-0 #searchInput {
  background: rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] nav.fixed.top-0 input.inp:focus,
html[data-theme="light"] nav.fixed.top-0 #searchInput:focus {
  background: #ffffff;
}

/* === 6. مؤشر التوتر الجيوسياسي === */

.tension-gauge-wrapper svg {
  filter: drop-shadow(0 4px 20px rgba(16, 185, 129, 0.15));
}

html[data-theme="light"] .tension-gauge-wrapper svg {
  filter: drop-shadow(0 4px 12px rgba(5, 150, 105, 0.1));
}

/* نبض المركز */
.tension-center-pulse {
  animation: tension-pulse 2s ease-in-out infinite;
  transform-origin: 140px 150px;
  transform-box: fill-box;
}

@keyframes tension-pulse {
  0%, 100% { opacity: 1; r: 4; }
  50% { opacity: 0.6; r: 6; }
}

/* توهج الإبرة */
.tension-needle {
  animation: needle-glow 3s ease-in-out infinite;
  transform-origin: 140px 150px;
}

@keyframes needle-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.6)); }
  50% { filter: drop-shadow(0 0 12px rgba(45, 212, 191, 0.9)); }
}

/* === 7. الشريط القانوني السفلي === */

#hunterLegalBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  height: 40px;
  background: rgba(10, 15, 28, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] #hunterLegalBar {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.04);
}

#hunterLegalBar a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

#hunterLegalBar a:hover {
  color: var(--brand-accent);
}

#hunterLegalBar span {
  color: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

html[data-theme="light"] #hunterLegalBar span {
  color: rgba(15, 23, 42, 0.15);
}

@media (max-width: 640px) {
  #hunterLegalBar {
    gap: 8px;
    font-size: 11px;
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  #hunterLegalBar span { display: none; }
}

/* === 8. البطاقات الجانبية === */

.hunter-card,
.categories-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}

/* === 9. التقرير الاستراتيجي === */

.hunter-strategic-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid rgba(240, 169, 78, 0.2);
  border-radius: 28px;
  box-shadow: var(--shadow-hover);
  padding: 24px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

html[data-theme="light"] .hunter-strategic-card {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border: 1px solid rgba(217, 119, 6, 0.2);
  box-shadow: 0 16px 48px rgba(217, 119, 6, 0.08);
}

/* البطاقات الداخلية للتقرير */
.hunter-strategic-card .bg-black\/40 {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme="light"] .hunter-strategic-card .bg-black\/40 {
  background: rgba(254, 243, 199, 0.6);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

.hunter-strategic-card .bg-black\/30 {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

html[data-theme="light"] .hunter-strategic-card .bg-black\/30 {
  background: rgba(255, 251, 235, 0.8);
  border: 1px solid rgba(217, 119, 6, 0.1);
}

/* === 10. أزرار التنقل في الـ nav === */

.hunter-primary-nav-btn[aria-selected="true"] {
  color: #ffffff;
}

/* === 11. الأزرار العامة === */

.btn-primary {
  background: var(--brand);
  border-color: var(--brand-hover);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.22s ease;
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

html[data-theme="light"] .btn-ghost:hover {
  background: rgba(15, 23, 42, 0.04);
}

/* === 12. تنسيقات الموبايل === */

@media (max-width: 768px) {
  .hunter-primary-nav-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .hunter-primary-nav-btn .nav-text {
    font-size: 11px;
  }

  .hunter-primary-nav-btn .nav-icon {
    font-size: 14px;
  }

  /* إخفاء النص وإظهار الأيقونة فقط على الموبايل الصغير */
  @media (max-width: 480px) {
    .hunter-primary-nav-btn .nav-text {
      display: none;
    }
    .hunter-primary-nav-btn {
      padding: 10px 14px;
    }
    .hunter-primary-nav-btn .nav-icon {
      font-size: 18px;
    }
  }
}

/* === 13. تأثيرات إضافية === */

/* تحسين الـ focus visible */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* تحديد النص */
::selection {
  background: rgba(16, 185, 129, 0.25);
  color: #ffffff;
}

html[data-theme="light"] ::selection {
  background: rgba(5, 150, 105, 0.2);
  color: var(--text);
}

/* تحسين الـ scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elevated);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  border: 2px solid var(--bg-elevated);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

html[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.15);
  border: 2px solid #f1f5f9;
}

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) var(--bg-elevated); }
html[data-theme="light"] * { scrollbar-color: rgba(15, 23, 42, 0.15) #f1f5f9; }

/* === 14. دعم تقليل الحركة === */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* ============================================================
   FINAL FIXES — إصلاحات نهائية للـ tabs والـ search bar
   ============================================================ */

/* 1. شريط البحث — توسيط */
#searchContainer {
  display: flex !important;
  flex: 1;
  justify-content: center;
  max-width: 32rem;
  margin: 0 1.5rem;
}

@media (max-width: 1023px) {
  #searchContainer {
    display: none !important;
  }
}

/* 2. الـ tabs — إزالة أي حدود مزدوجة */
.hunter-primary-nav,
.sections-nav-shell .hunter-primary-nav {
  background: rgba(30, 41, 59, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 9999px !important;
  padding: 4px !important;
  display: inline-flex !important;
  gap: 4px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  margin: 0 auto !important;
}

html[data-theme="light"] .hunter-primary-nav,
html[data-theme="light"] .sections-nav-shell .hunter-primary-nav {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
}

/* 3. إزالة أي ::after أو ::before ممكن يعمل إطار مزدوج */
.hunter-primary-nav::before,
.hunter-primary-nav::after {
  display: none !important;
  content: none !important;
}

/* 4. زر التبويب — تصميم نضيف */
.hunter-primary-nav-btn {
  padding: 10px 18px !important;
  border-radius: 9999px !important;
  border: none !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.hunter-primary-nav-btn:hover {
  color: #f1f5f9 !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="light"] .hunter-primary-nav-btn {
  color: #475569 !important;
}

html[data-theme="light"] .hunter-primary-nav-btn:hover {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.04) !important;
}

/* الزر النشط */
.hunter-primary-nav-btn.is-active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #10b981 0%, #38d9d9 100%) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .hunter-primary-nav-btn.is-active {
  background: linear-gradient(135deg, #059669 0%, #0891b2 100%) !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25) !important;
}

/* 5. إخفاء indicator القديم تماماً */
.hunter-primary-nav-indicator,
#mainNavIndicator {
  display: none !important;
}

/* 6. الأيقونات داخل الـ tabs — أصغر وأهدا */
.hunter-primary-nav-btn .nav-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}

.hunter-primary-nav-btn .nav-text {
  font-size: 12px;
}

@media (max-width: 640px) {
  .hunter-primary-nav-btn .nav-text {
    display: none;
  }
  .hunter-primary-nav-btn {
    padding: 10px 14px !important;
  }
  .hunter-primary-nav-btn .nav-icon {
    font-size: 18px;
  }
}

/* 7. زر الإدارة — مخفي شبه تماماً */
#adminBtn {
  opacity: 0.2 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

#adminBtn:hover,
#adminBtn:focus-visible {
  opacity: 0.6 !important;
}

#adminBtn svg {
  color: #64748b !important;
}

/* 8. زر دخول — هادي */
#loginBtn {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
  font-weight: 600 !important;
  border-radius: 9999px !important;
  padding: 6px 16px !important;
  transition: all 0.2s ease !important;
}

#loginBtn:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #f1f5f9 !important;
}

html[data-theme="light"] #loginBtn {
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  color: #475569 !important;
}

html[data-theme="light"] #loginBtn:hover {
  background: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(15, 23, 42, 0.2) !important;
  color: #0f172a !important;
}

/* 9. باقي أيقونات الهيدر — هادية */
#themeBtn, #savedBtn, #bellBtn {
  opacity: 0.65 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  transition: opacity 0.2s ease !important;
}

#themeBtn:hover, #savedBtn:hover, #bellBtn:hover {
  opacity: 1 !important;
}

#savedBtn {
  color: #94a3b8 !important;
}

#bellCount {
  background: #475569 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
