/* الشريط العلوي + القائمة الصغيرة — نسخة مطابقة لما في الصفحة الرئيسية، لتظهر في صفحة الشروط */

:root {
  --accent-blue: #008cff;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Handicrafts', 'Inter', system-ui, sans-serif;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.header {
  position: fixed;
  top: 15px;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  animation: fadeInUp 0.8s ease;
}

.nav {
  position: relative;
  overflow: hidden;
  width: 92%;
  max-width: 1000px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 50px;
  background: var(--g-bg);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow);
}
.nav::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--g-line-a), transparent);
}
.nav::after {
  content: ''; position: absolute; top: 0; left: 0; width: 1px; height: 100%; pointer-events: none;
  background: linear-gradient(180deg, var(--g-line-a), transparent, var(--g-line-b));
}
@media (max-width: 480px) { .nav { width: 90%; } }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 1;
}
.logo-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: none;
  box-shadow: 0 0 10px rgba(0, 140, 255, 0.35);
  border: 1px solid rgba(0, 140, 255, 0.3);
}
.logo-img img { width: 100%; height: 100%; object-fit: cover; }
html[data-theme="light"] .logo-img { box-shadow: 0 0 10px rgba(0, 140, 255, 0.25); }

.brand-name {
  font-family: 'Inter', 'Handicrafts', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--text-main);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.menu-toggle,
.theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}
.menu-toggle:hover,
.theme-toggle:hover {
  background: var(--accent-blue);
  color: #fff;
  transform: scale(1.08);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* في الداكن تظهر الشمس، وفي الفاتح يظهر القمر */
html[data-theme="light"] .theme-toggle .icon-sun,
html:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }

html[data-theme="light"] .menu-toggle,
html[data-theme="light"] .theme-toggle {
  background: rgba(20, 24, 36, 0.05);
  border-color: rgba(20, 24, 36, 0.12);
  color: var(--text-main);
}
html[data-theme="light"] .menu-toggle:hover,
html[data-theme="light"] .theme-toggle:hover { background: var(--accent-blue); color: #fff; }

/* على اللمس: لا تبقى حالة hover مضاءة بعد الضغط */
html.is-touch .theme-toggle:hover,
html.is-touch .menu-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: none;
}
html.is-touch[data-theme="light"] .theme-toggle:hover,
html.is-touch[data-theme="light"] .menu-toggle:hover {
  background: rgba(20, 24, 36, 0.05);
  color: var(--text-main);
}

/* ---------- القائمة الصغيرة ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  z-index: 1050;
}
.overlay.active { opacity: 1; visibility: visible; }

.menu-pop {
  --m-bg: #0d1117;
  --m-line: #21262c;
  --m-hover: #21262c;
  --m-active: #1a1f24;
  --m-text: #ffffff;
  --m-icon: #7d8590;
  --m-accent: #2f81f7;

  position: fixed;
  top: 84px;
  left: max(calc(4% + 12px), calc(50% - 488px));
  z-index: 1100;
  width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--m-bg);
  border: 1px solid var(--m-line);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  transform-origin: top left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.menu-pop.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
html[data-theme="light"] .menu-pop {
  --m-bg: #ffffff;
  --m-line: rgba(20, 24, 36, 0.12);
  --m-hover: #eef1f6;
  --m-active: #e4e9f1;
  --m-text: #141824;
  --m-icon: #6a7285;
  box-shadow: 0 14px 34px rgba(20, 24, 36, 0.16);
}

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--m-text);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.menu-item svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--m-icon);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s ease;
}
.menu-item::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 3px;
  height: 56%;
  transform: translateY(-50%);
  border-radius: 3px;
  background: var(--m-accent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
@media (hover: hover) {
  .menu-item:hover { background: var(--m-hover); }
  .menu-item:hover svg { stroke: var(--m-text); }
}
.menu-item:focus-visible,
.menu-item:active { background: var(--m-active); outline: none; }
.menu-item:focus-visible::before,
.menu-item:active::before { opacity: 1; }
.menu-item:active svg,
.menu-item:focus-visible svg { stroke: var(--m-accent); }

@media (prefers-reduced-motion: reduce) {
  .menu-pop, .menu-pop.active, .menu-item { transition: none; }
}
