/* =========================================================
   الهيدر / القائمة العلوية - تصميم احترافي متجاوب
   يعتمد على متغيرات theme.css (لازم يُحمَّل theme.css قبل هذا الملف)
   ========================================================= */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 1000;
  background: linear-gradient(180deg, #1c2e38, #16242c 90%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 66px;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* -------- الشعار -------- */
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-logo i {
  color: var(--brand-primary);
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* -------- زر القائمة (جوال) -------- */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}
.menu-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------- القائمة -------- */
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__list > li {
  position: relative;
}

.site-nav__list a,
.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s ease, color .2s ease;
  white-space: nowrap;
}

.site-nav__list a:hover,
.dropdown-trigger:hover,
.site-nav__list a.is-active {
  background: rgba(255,255,255,.09);
  color: #fff;
}

.dropdown-trigger i {
  transition: transform .25s ease;
  font-size: .9rem;
}
.has-dropdown.is-open .dropdown-trigger i {
  transform: rotate(180deg);
}

/* -------- القائمة المنسدلة (ديسكتوب) -------- */
.dropdown-panel {
  list-style: none;
  margin: 0;
  padding: 8px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.has-dropdown.is-open .dropdown-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary) !important;
  font-size: .9rem;
  padding: 10px 12px;
  border-radius: 8px;
}
.dropdown-panel a:hover {
  background: var(--link-hover-bg) !important;
  color: var(--brand-primary) !important;
}
.dropdown-panel li.is-disabled a {
  opacity: .45;
  pointer-events: none;
}

/* -------- زر تبديل الوضع داخل الهيدر -------- */
.site-header .theme-switcher {
  margin-inline-start: 6px;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.12);
}
.site-header .theme-switcher button { color: rgba(255,255,255,.75); }
.site-header .theme-switcher button:hover { color: #fff; background: rgba(255,255,255,.12); }
.site-header .theme-switcher button.active { background: var(--brand-primary); color: #fff; }

/* عشان محتوى الصفحة ما ينحشر تحت الهيدر الثابت */
body { padding-top: 66px !important; }

/* =========================================================
   الجوال / التابلت
   ========================================================= */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }

  .site-nav {
    position: fixed;
    inset-inline: 0;
    top: 66px;
    background: #16242c;
    max-height: 0;
    overflow: hidden;
    flex-direction: column;
    align-items: stretch;
    transition: max-height .35s ease;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .site-nav.is-open {
    max-height: 80vh;
    overflow-y: auto;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 14px;
    width: 100%;
  }

.site-nav__list a,
.dropdown-trigger {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    direction: rtl;
    padding: 13px 14px;
    font-size: .95rem;
}

.site-nav__list a i {
    font-size: 20px;
    flex-shrink: 0;
}
  .dropdown-panel {
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,.03);
    margin-top: 2px;
    max-height: 0;
    overflow: hidden;
    padding: 0 4px;
    transition: max-height .3s ease, padding .3s ease;
  }
  .has-dropdown.is-open .dropdown-panel {
    max-height: 260px;
    padding: 6px 4px;
  }
  .dropdown-panel a { color: rgba(255,255,255,.8) !important; }
  .dropdown-panel a:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }

  .site-header .theme-switcher {
    justify-content: center;
    margin: 14px auto 16px;
  }

  body { padding-top: 66px !important; }
}
