/**
 * Header Pro — تصميم هيدر إخباري احترافي
 * يعمل في Light + Dark Mode
 * @package jory-news-theme
 */

/* ========== Top Bar ========== */
.top-bar-premium {
  background: #0b1220;
  color: #94a3b8;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.top-bar-premium .container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar-right,
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-date,
.top-bar-weather {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  white-space: nowrap;
}

.top-bar-date svg,
.top-bar-weather svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.9;
}

.weather-city {
  color: #cbd5e1;
  font-weight: 600;
}

.social-links-premium {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-links-premium a {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #94a3b8;
  transition: color 0.15s, background 0.15s;
}

.social-links-premium a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.social-links-premium svg {
  width: 14px;
  height: 14px;
}

/* ========== Main Header ========== */
.main-header-premium {
  background: #ffffff;
  border-bottom: 1px solid #e8edf3;
  position: relative;
  z-index: 1000;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.main-header-premium.sticky-enabled {
  position: sticky;
  top: 0;
}

.main-header-premium.is-scrolled {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

.header-content-premium {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

/* Brand */
.site-branding-premium {
  flex-shrink: 0;
}

.site-info-premium {
  display: flex;
  flex-direction: column;
  text-decoration: none !important;
  gap: 0;
}

.site-title-premium {
  margin: 0 !important;
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em;
  color: #0f172a !important;
  background: none !important;
}

.site-info-premium:hover .site-title-premium {
  color: #0f172a !important;
  opacity: 0.85;
}

.site-tagline-premium {
  display: none !important;
}

.site-logo-premium img {
  height: 44px;
  width: auto;
  display: block;
}

/* Nav */
.main-nav-premium {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav-menu-premium {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-menu-premium::-webkit-scrollbar {
  display: none;
}

.nav-menu-premium > li {
  position: relative;
  flex-shrink: 0;
}

.nav-menu-premium > li > a {
  display: inline-flex !important;
  align-items: center;
  padding: 8px 14px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
  text-decoration: none !important;
  border-radius: 999px !important;
  background: transparent !important;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s !important;
  line-height: 1.3;
}

.nav-menu-premium > li > a:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

.nav-menu-premium > li.current-menu-item > a,
.nav-menu-premium > li.current_page_item > a {
  color: #ffffff !important;
  background: #0f172a !important;
}

/* Dropdown */
.nav-menu-premium .sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 50;
}

.nav-menu-premium > li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-premium .sub-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #334155 !important;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
}

.nav-menu-premium .sub-menu a:hover {
  background: #f8fafc;
  color: #0f172a !important;
}

/* Actions */
.header-actions-premium {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-action-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  cursor: pointer;
  box-shadow: none !important;
  line-height: 1 !important;
  font-size: 0 !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s !important;
}

.header-action-btn:hover {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  transform: none !important;
  box-shadow: none !important;
}

.header-action-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.header-action-btn svg,
.header-action-btn__icon,
.header-action-btn path {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  fill: currentColor !important;
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.header-action-btn--search,
.header-action-btn--darkmode {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
}

.header-cta-btn {
  display: none !important;
}

/* Mobile toggle */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  background: #0f172a;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ========== Search Overlay ========== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
}

.search-overlay-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
}

.search-overlay-close {
  position: absolute;
  top: -48px;
  left: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-overlay-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  margin-bottom: 16px;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.search-input-icon {
  position: absolute;
  right: 18px;
  color: #94a3b8;
  pointer-events: none;
}

.search-overlay-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 18px 52px 18px 120px;
  font-size: 1rem;
  color: #0f172a;
  background: transparent;
  font-family: inherit;
}

.search-overlay-submit {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.search-overlay-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}

.search-overlay-tags .tags-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8125rem;
}

.search-overlay-tags a {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  text-decoration: none;
}

.search-overlay-tags a:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ========== Back to Top ========== */
#back-to-top-btn,
.btt-premium {
  position: fixed !important;
  bottom: 28px !important;
  left: 28px !important;
  right: auto !important;
  width: 48px !important;
  height: 48px !important;
  border: none !important;
  border-radius: 14px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28) !important;
  cursor: pointer !important;
  z-index: 99990 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(12px) !important;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.15s !important;
}

#back-to-top-btn.show,
.btt-premium.show,
#back-to-top-btn.visible,
.back-to-top.visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

#back-to-top-btn:hover,
.btt-premium:hover {
  background: #1e293b !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35) !important;
}

#back-to-top-btn .btt-progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

#back-to-top-btn .btt-progress-bg {
  stroke: rgba(255, 255, 255, 0.15);
}

#back-to-top-btn .btt-progress-bar {
  stroke: #60a5fa;
  transition: stroke-dashoffset 0.1s linear;
}

#back-to-top-btn .btt-icon {
  position: relative;
  z-index: 1;
  display: flex;
  color: #fff;
}

#back-to-top-btn .btt-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* ========== Dark Mode ========== */
html[data-theme="dark"] .main-header-premium,
body.dark-mode .main-header-premium {
  background: #0f172a !important;
  border-bottom-color: #1e293b !important;
}

html[data-theme="dark"] .main-header-premium.is-scrolled,
body.dark-mode .main-header-premium.is-scrolled {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .site-title-premium,
body.dark-mode .site-title-premium {
  color: #f8fafc !important;
}

html[data-theme="dark"] .nav-menu-premium > li > a,
body.dark-mode .nav-menu-premium > li > a {
  color: #cbd5e1 !important;
  background: transparent !important;
}

html[data-theme="dark"] .nav-menu-premium > li > a:hover,
body.dark-mode .nav-menu-premium > li > a:hover {
  color: #ffffff !important;
  background: #1e293b !important;
}

html[data-theme="dark"] .nav-menu-premium > li.current-menu-item > a,
html[data-theme="dark"] .nav-menu-premium > li.current_page_item > a,
body.dark-mode .nav-menu-premium > li.current-menu-item > a,
body.dark-mode .nav-menu-premium > li.current_page_item > a {
  color: #0f172a !important;
  background: #f8fafc !important;
}

html[data-theme="dark"] .header-action-btn,
html[data-theme="dark"] .header-action-btn--search,
html[data-theme="dark"] .header-action-btn--darkmode,
body.dark-mode .header-action-btn,
body.dark-mode .header-action-btn--search,
body.dark-mode .header-action-btn--darkmode {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .header-action-btn:hover,
body.dark-mode .header-action-btn:hover {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .mobile-menu-toggle,
body.dark-mode .mobile-menu-toggle {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .hamburger-icon span,
body.dark-mode .hamburger-icon span {
  background: #f1f5f9;
}

html[data-theme="dark"] .nav-menu-premium .sub-menu,
body.dark-mode .nav-menu-premium .sub-menu {
  background: #152033;
  border-color: #2a3a52;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .nav-menu-premium .sub-menu a,
body.dark-mode .nav-menu-premium .sub-menu a {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .nav-menu-premium .sub-menu a:hover,
body.dark-mode .nav-menu-premium .sub-menu a:hover {
  background: #1e293b;
  color: #fff !important;
}

html[data-theme="dark"] #back-to-top-btn,
html[data-theme="dark"] .btt-premium,
body.dark-mode #back-to-top-btn,
body.dark-mode .btt-premium {
  background: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4) !important;
  border: 1px solid #334155 !important;
}

html[data-theme="dark"] #back-to-top-btn:hover,
body.dark-mode #back-to-top-btn:hover {
  background: #334155 !important;
}

html[data-theme="dark"] #back-to-top-btn .btt-progress-bg,
body.dark-mode #back-to-top-btn .btt-progress-bg {
  stroke: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] #back-to-top-btn .btt-progress-bar,
body.dark-mode #back-to-top-btn .btt-progress-bar {
  stroke: #93c5fd;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .header-content-premium {
    grid-template-columns: auto auto 1fr;
    min-height: 60px;
    gap: 12px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    order: 0;
  }

  .site-branding-premium {
    order: 1;
  }

  .header-actions-premium {
    order: 2;
    margin-inline-start: auto;
  }

  .main-nav-premium {
    display: none;
  }

  .site-title-premium {
    font-size: 1.25rem !important;
  }
}

@media (max-width: 640px) {
  .top-bar-premium .container {
    padding: 0 12px;
    min-height: 32px;
  }

  .header-content-premium {
    padding: 0 12px;
  }

  #back-to-top-btn,
  .btt-premium {
    bottom: 18px !important;
    left: 16px !important;
    width: 44px !important;
    height: 44px !important;
  }
}
