/* ============================================
   Header - موحد لجميع الصفحات
   اللغة + المظهر
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.75rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  z-index: 100;
  background: var(--glass);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  animation: slideDown 0.6s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

[dir="ltr"] .site-header { justify-content: flex-start; }

/* زر الهيدر: إطار شفاف فقط — الـ 3D كله على .icon-circle (مثل Neumorphic في التطبيق) */
.menu-btn {
  position: relative;
  padding: 0.2rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: none;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn:hover {
  box-shadow: none;
}

.menu-btn:active {
  box-shadow: none;
}

.menu-btn .menu-text,
.menu-btn .menu-icon {
  display: none !important;
}

/* نيومورفيك مرفوع: سطح بلون الخلفية + ظل ثنائي + هايلايت/ظل داخلي (Soft UI) */
.menu-btn .icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .menu-btn .icon-circle {
  background: linear-gradient(155deg, rgb(250, 252, 255) 0%, rgb(232, 240, 250) 48%, rgb(220, 230, 242) 100%);
  box-shadow:
    8px 8px 18px rgba(0, 55, 95, 0.12),
    -6px -6px 14px rgba(255, 255, 255, 0.98),
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    inset 0 -2px 4px rgba(0, 70, 120, 0.06);
}

[data-theme="light"] .menu-btn:hover .icon-circle {
  box-shadow:
    10px 10px 22px rgba(0, 55, 95, 0.14),
    -7px -7px 16px rgba(255, 255, 255, 1),
    inset 0 2px 3px rgba(255, 255, 255, 1),
    inset 0 -2px 4px rgba(0, 70, 120, 0.07);
  transform: translateY(-1px);
}

[data-theme="light"] .menu-btn:active .icon-circle {
  transform: translateY(0) scale(0.97);
  box-shadow:
    inset 6px 6px 14px rgba(0, 45, 80, 0.12),
    inset -3px -3px 10px rgba(255, 255, 255, 0.85),
    inset 0 1px 2px rgba(0, 60, 100, 0.06);
}

[data-theme="dark"] .menu-btn .icon-circle {
  background: linear-gradient(155deg, rgb(38, 54, 64) 0%, rgb(26, 41, 51) 45%, rgb(18, 32, 42) 100%);
  box-shadow:
    10px 10px 22px rgba(0, 0, 0, 0.55),
    -6px -6px 14px rgba(255, 255, 255, 0.05),
    inset 0 2px 3px rgba(255, 255, 255, 0.1),
    inset 0 -3px 8px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .menu-btn:hover .icon-circle {
  box-shadow:
    12px 12px 26px rgba(0, 0, 0, 0.6),
    -7px -7px 16px rgba(255, 255, 255, 0.06),
    inset 0 2px 4px rgba(255, 255, 255, 0.12),
    inset 0 -3px 8px rgba(0, 0, 0, 0.48);
  transform: translateY(-1px);
}

[data-theme="dark"] .menu-btn:active .icon-circle {
  transform: translateY(0) scale(0.97);
  box-shadow:
    inset 7px 7px 16px rgba(0, 0, 0, 0.65),
    inset -4px -4px 12px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(0, 160, 210, 0.08);
}

.menu-btn .icon-circle .icon {
  font-size: 17px;
  line-height: 1;
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

[data-theme="dark"] .menu-btn .icon-circle .icon {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.menu-btn:hover .icon-circle .icon {
  transform: scale(1.06);
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  width: max-content;
  max-width: calc(100vw - 2rem);
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1.5px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px var(--shadow-dark), 0 3px 8px rgba(0,0,0,0.08), inset 0 0 0 1px rgba(255,255,255,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 1000;
  padding: 8px 10px;
}

[data-theme="light"] .menu-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 104, 184, 0.15);
  box-shadow: 0 8px 24px rgba(0, 104, 184, 0.12), 0 3px 8px rgba(0,0,0,0.06), inset 0 0 0 1px rgba(255,255,255,0.3);
}

[data-theme="dark"] .menu-dropdown {
  background: rgba(31, 46, 56, 0.95);
  border-color: rgba(0, 160, 210, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 3px 8px rgba(0, 160, 210, 0.15), inset 0 0 0 1px rgba(255,255,255,0.08);
}

[dir="ltr"] .menu-dropdown { right: auto; left: 0; direction: ltr; text-align: left; }

.menu-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.menu-dropdown-item {
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 3px;
}

[dir="ltr"] .menu-dropdown-item { flex-direction: row; justify-content: flex-start; direction: ltr; }
[dir="ltr"] .menu-dropdown-item .checkmark { order: 1; }
[dir="ltr"] .menu-dropdown-item > span:not(.checkmark) { order: 0; }

.menu-dropdown-item > span:not(.checkmark) { flex: 1 1 auto; min-width: min-content; white-space: nowrap; text-align: right; padding-right: 0.5rem; }
[dir="ltr"] .menu-dropdown-item > span:not(.checkmark) { text-align: left; padding-right: 0; padding-left: 0.5rem; }
.menu-dropdown-item .checkmark { flex-shrink: 0; width: 16px; text-align: center; order: -1; }
.menu-dropdown-item:last-child { margin-bottom: 0; }

[data-theme="light"] .menu-dropdown-item { color: rgb(26, 26, 38); }
[data-theme="dark"] .menu-dropdown-item { color: rgba(255, 255, 255, 0.9); }

.menu-dropdown-item:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  transform: translateX(-2px);
  box-shadow: 0 3px 8px rgba(0,104,184,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

[dir="ltr"] .menu-dropdown-item:hover { transform: translateX(2px); }
[data-theme="dark"] .menu-dropdown-item:hover { box-shadow: 0 3px 8px rgba(0,160,210,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
.menu-dropdown-item:hover .checkmark { color: white; transform: scale(1.2); }

.menu-dropdown-item.active {
  background: linear-gradient(135deg, rgba(0,104,184,0.1), rgba(0,160,210,0.05));
  border-right: 2px solid var(--primary);
  padding-right: calc(0.9rem - 2px);
}

[dir="ltr"] .menu-dropdown-item.active { border-right: none; border-left: 2px solid var(--primary); padding-right: 0.9rem; padding-left: calc(0.9rem - 2px); }
[data-theme="dark"] .menu-dropdown-item.active { background: rgba(0,160,210,0.12); }

.menu-dropdown-item .checkmark { color: var(--primary); font-size: 16px; font-weight: 900; transition: all 0.25s ease; }
[data-theme="light"] .menu-dropdown-item .checkmark { color: rgb(0, 104, 184); }
[data-theme="dark"] .menu-dropdown-item .checkmark { color: rgb(0, 160, 210); }
.menu-dropdown-item:hover .checkmark { color: white; }

/* Spacer for fixed header on sub-pages */
body.has-site-header { padding-top: 52px; }

/* Mobile - توسيط الهيدر */
@media (max-width: 768px) {
  .site-header {
    justify-content: center;
  }
  [dir="ltr"] .site-header {
    justify-content: center;
  }
}
