/*
 * header.css — الشريط العلوي الموحّد لمنصة المحامي الرقمي
 * Ultra Premium Design · RTL · Responsive
 * mohamidigital.online
 */

/* ══════════════════════════════════════════════════
   الـ Header الرئيسي
══════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
  /* خلفية زجاجية داكنة راقية */
  background: linear-gradient(135deg,
    rgba(9, 9, 27, 0.96) 0%,
    rgba(15, 10, 35, 0.95) 50%,
    rgba(8, 12, 30, 0.96) 100%
  );
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border-bottom: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 2px 16px rgba(99, 102, 241, 0.1);
}

/* خط متوهّج في الأعلى */
.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(99,102,241,0.6) 20%,
    rgba(139,92,246,0.9) 40%,
    rgba(99,102,241,1) 60%,
    rgba(16,185,129,0.7) 80%,
    transparent 100%
  );
  animation: headerGlow 4s ease-in-out infinite alternate;
}

@keyframes headerGlow {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ══════════════════════════════════════════════════
   الحاوية الداخلية
══════════════════════════════════════════════════ */
.header-container {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 0 28px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ══════════════════════════════════════════════════
   الشعار (Logo)
══════════════════════════════════════════════════ */
.header-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 60%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow:
    0 4px 20px rgba(99, 102, 241, 0.45),
    0 0 0 1px rgba(255,255,255,0.15) inset;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.logo-badge::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 100%);
  border-radius: 14px 14px 0 0;
}

.header-logo:hover .logo-badge {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.65), 0 0 0 1px rgba(255,255,255,0.2) inset;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-title {
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.3px;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.brand-subtitle {
  font-size: 10.5px;
  font-weight: 800;
  color: #34d399;
  margin-top: 2px;
  white-space: nowrap;
  letter-spacing: 0.1px;
  text-shadow: 0 0 12px rgba(52,211,153,0.4);
}

/* ══════════════════════════════════════════════════
   روابط التنقل
══════════════════════════════════════════════════ */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}

.nav-item {
  position: relative;
  font-size: 13.5px;
  font-weight: 700;
  color: #94a3b8;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 10px;
  transition: color 0.22s ease, background 0.22s ease;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

/* خط متحرك أسفل كل رابط */
.nav-item::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 12px;
  left: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.1);
}

.nav-item:hover::after {
  transform: scaleX(0.6);
}

.nav-item.active {
  color: #fde68a;
  background: rgba(99, 102, 241, 0.15);
  font-weight: 900;
}

.nav-item.active::after {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  transform: scaleX(0.8);
}

/* ══════════════════════════════════════════════════
   أزرار الجانب الأيسر
══════════════════════════════════════════════════ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* زر الدخول */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 60%, #5b21b6 100%);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0.1px;
  box-shadow:
    0 4px 20px rgba(99, 102, 241, 0.4),
    0 0 0 1px rgba(255,255,255,0.12) inset,
    0 1px 0 rgba(255,255,255,0.2) inset;
  border: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.header-cta::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.5s ease;
}

.header-cta:hover::before {
  left: 100%;
}

.header-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 32px rgba(99, 102, 241, 0.6),
    0 0 0 1px rgba(255,255,255,0.2) inset;
  background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 60%, #4c1d95 100%);
}

.header-cta:active {
  transform: translateY(0) scale(0.99);
}

/* زر الهامبرغر (موبايل) */
.header-mobile-toggle {
  display: none;
  background: rgba(30, 27, 75, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.header-mobile-toggle:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  transform: scale(1.05);
}

/* ══════════════════════════════════════════════════
   شاشات متوسطة (1240px → 1120px)
══════════════════════════════════════════════════ */
@media (max-width: 1240px) and (min-width: 1121px) {
  .header-container {
    padding: 0 20px;
    gap: 10px;
  }
  .nav-item {
    font-size: 12.5px;
    padding: 6px 9px;
  }
  .brand-title { font-size: 15px; }
  .brand-subtitle { font-size: 10px; }
  .header-cta {
    padding: 8px 15px;
    font-size: 12.5px;
  }
}

/* ══════════════════════════════════════════════════
   موبايل / تابلت (≤ 1120px)
══════════════════════════════════════════════════ */
@media (max-width: 1120px) {
  .header-nav {
    display: none;
    position: fixed;
    top: 70px;
    right: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg,
      rgba(9, 9, 27, 0.98) 0%,
      rgba(15, 10, 35, 0.99) 100%
    );
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.25);
    padding: 16px 20px 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    z-index: 999;
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .header-nav.active {
    display: flex;
  }

  .nav-item {
    padding: 12px 16px;
    font-size: 14.5px;
    border-radius: 10px;
    border: 1px solid transparent;
  }

  .nav-item:hover,
  .nav-item.active {
    border-color: rgba(99, 102, 241, 0.2);
  }

  .nav-item::after {
    display: none;
  }

  .header-mobile-toggle {
    display: flex;
  }

  .header-cta {
    padding: 8px 14px;
    font-size: 12.5px;
  }
}

/* ══════════════════════════════════════════════════
   شاشات صغيرة جداً (≤ 480px)
══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .header-container {
    padding: 0 14px;
    height: 62px;
    gap: 8px;
  }

  .logo-badge {
    width: 38px;
    height: 38px;
    font-size: 19px;
    border-radius: 11px;
  }

  .brand-title { font-size: 14px; }
  .brand-subtitle { font-size: 9.5px; }

  .header-cta {
    padding: 7px 12px;
    font-size: 11.5px;
    border-radius: 10px;
    gap: 5px;
  }

  .header-mobile-toggle {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 9px;
  }

  .header-nav {
    top: 62px;
    padding: 12px 14px 16px;
  }

  .nav-item {
    font-size: 14px;
    padding: 11px 14px;
  }
}

/* ══════════════════════════════════════════════════
   تأثير scroll — يُضاف بالـ JS
══════════════════════════════════════════════════ */
.site-header.scrolled {
  background: linear-gradient(135deg,
    rgba(7, 7, 22, 0.98) 0%,
    rgba(12, 8, 28, 0.98) 50%,
    rgba(6, 10, 24, 0.98) 100%
  );
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 12px 48px rgba(0, 0, 0, 0.6),
    0 4px 24px rgba(99, 102, 241, 0.15);
}

/* ══════════════════════════════════════════════════
   قائمة «المزيد» المنسدلة — بقية صفحات الموقع
══════════════════════════════════════════════════ */
.nav-more {
  position: relative;
}

.nav-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.1px;
  transition: color 0.22s ease, background 0.22s ease;
}

.nav-more-btn:hover {
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.1);
}

.nav-more-btn[aria-expanded="true"] {
  color: #fde68a;
  background: rgba(99, 102, 241, 0.15);
}

.nav-more-caret {
  display: inline-block;
  transition: transform 0.2s ease;
}

.nav-more-btn[aria-expanded="true"] .nav-more-caret {
  transform: rotate(180deg);
}

.nav-more-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 235px;
  padding: 8px;
  background: linear-gradient(135deg,
    rgba(9, 9, 27, 0.98) 0%,
    rgba(15, 10, 35, 0.98) 100%
  );
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1200;
}

.nav-more.open .nav-more-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-more-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-more-item:hover {
  background: rgba(99, 102, 241, 0.12);
  color: #ffffff;
}

.nav-more-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fde68a;
}

/* شاشات متوسطة — تصغير زر المزيد */
@media (max-width: 1240px) and (min-width: 1121px) {
  .nav-more-btn {
    font-size: 12.5px;
    padding: 6px 9px;
  }
}

/* موبايل / تابلت — القائمة داخل لوحة التنقل المنسدلة */
@media (max-width: 1120px) {
  .nav-more {
    position: static;
  }
  .nav-more-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 14.5px;
    border-radius: 10px;
    border: 1px solid transparent;
  }
  .nav-more-btn:hover,
  .nav-more-btn[aria-expanded="true"] {
    border-color: rgba(99, 102, 241, 0.2);
  }
  .nav-more-menu {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 4px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(99, 102, 241, 0.18);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }
  .nav-more.open .nav-more-menu {
    display: block;
  }
  .nav-more-item {
    padding: 11px 14px;
    font-size: 14px;
  }
}
