/* ==========================================================================
   HEADER & MEGA MENU STYLES
   Sticky navigation, transparent-to-solid transition, accessible mega-menu
   ========================================================================== */

.dash-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  transition: background-color var(--duration-normal) var(--ease-out-cubic),
              box-shadow var(--duration-normal) var(--ease-out-cubic),
              backdrop-filter var(--duration-normal) var(--ease-out-cubic),
              padding var(--duration-normal) var(--ease-out-cubic),
              top var(--duration-fast) ease;
  padding: 0.85rem 0;
}

/* WordPress Admin Bar Compatibility */
body.admin-bar .dash-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .dash-header {
    top: 46px;
  }
}

@media screen and (max-width: 600px) {
  body.admin-bar .dash-header {
    top: 0;
  }
}

/* Transparent initially over hero */
.dash-header.header-transparent {
  background-color: rgba(7, 14, 26, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Solid on scroll */
.dash-header.header-scrolled {
  background-color: rgba(11, 25, 44, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(7, 14, 26, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.65rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Dash International Brand Logo */
.dash-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-img {
  height: clamp(40px, 4.5vw, 54px);
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
  transition: transform var(--duration-fast) var(--ease-out-cubic);
}

.dash-brand:hover .brand-logo-img {
  transform: scale(1.04);
}

/* Desktop Navigation Menu */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-link-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out-cubic);
}

[dir="rtl"] .nav-link {
  font-family: var(--font-arabic);
}

.nav-link:hover,
.nav-link.active {
  color: var(--dash-white);
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-link .dropdown-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-fast) var(--ease-out-cubic);
}

.nav-link-item.is-open .nav-link .dropdown-chevron {
  transform: rotate(180deg);
}

/* Products Mega Menu Dropdown */
.mega-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: min(940px, 94vw);
  background: var(--dash-navy-900);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(7, 14, 26, 0.75);
  padding: 1.75rem;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  z-index: var(--z-mega-menu);
}

/* Invisible bridge so mouse never loses hover connection while entering */
.mega-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
  background: transparent;
  pointer-events: auto;
}

.nav-link-item.has-dropdown:hover .mega-menu-dropdown,
.nav-link-item.has-dropdown:focus-within .mega-menu-dropdown,
.nav-link-item.is-open .mega-menu-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-link-item.has-dropdown:hover .dropdown-chevron,
.nav-link-item.is-open .dropdown-chevron {
  transform: rotate(180deg);
}

.mega-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.mega-menu-header-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dash-green-400);
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.mega-category-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-cubic);
}

.mega-category-card:hover {
  background-color: rgba(0, 168, 107, 0.08);
  border-color: rgba(0, 168, 107, 0.3);
  transform: translateY(-2px);
}

.mega-category-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.mega-category-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: rgba(0, 168, 107, 0.15);
  color: var(--dash-green-400);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mega-category-icon svg {
  width: 18px;
  height: 18px;
}

.mega-category-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dash-white);
}

.mega-category-desc {
  font-size: 0.8125rem;
  color: var(--dash-slate-400);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.mega-category-grades {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.mega-grade-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--dash-slate-300);
}

/* Header Actions: Language Switcher & Contact Button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

/* Language Selector Dropdown */
.lang-selector {
  position: relative;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--dash-white);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-cubic);
}

.lang-btn:hover {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.flag-svg {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--dash-navy-900);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  padding: 0.4rem;
  min-width: 140px;
  list-style: none;
  z-index: var(--z-mega-menu);
  display: none;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

.lang-dropdown.open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  background: none;
  color: var(--dash-slate-300);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-cubic);
}

[dir="rtl"] .lang-option {
  text-align: right;
}

.lang-option:hover,
.lang-option.active {
  background-color: rgba(0, 168, 107, 0.15);
  color: var(--dash-green-300);
}

/* Mobile Hamburger Toggle */
.mobile-toggle-btn {
  display: none;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: var(--dash-white);
  padding: 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-toggle-btn svg {
  width: 24px;
  height: 24px;
}

/* Fullscreen Mobile Drawer Navigation */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background-color: var(--dash-navy-950);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out-cubic);
}

[dir="rtl"] .mobile-drawer {
  transform: translateX(-100%);
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.5rem;
}

.drawer-close-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--dash-white);
  padding: 0.5rem;
  cursor: pointer;
}

.drawer-close-btn svg {
  width: 24px;
  height: 24px;
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
  margin-bottom: 2rem;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  color: var(--dash-white);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.04);
}

.mobile-nav-link:hover {
  background-color: rgba(0, 168, 107, 0.15);
  color: var(--dash-green-300);
}

.mobile-drawer-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 1280px) {
  .desktop-nav {
    display: none;
  }
  .mobile-toggle-btn {
    display: inline-flex;
  }
}

/* Phones: keep logo, language and the menu button inside the screen (the contact button lives in the drawer) */
@media (max-width: 640px) {
  .header-inner { gap: 0.5rem; }
  .header-actions { gap: 0.5rem; }
  .header-actions > .dash-btn { display: none; }
  .brand-logo-img { height: 38px; max-width: 150px; }
  .lang-btn { padding: 0.45rem 0.6rem; }
  .mobile-toggle-btn { flex-shrink: 0; }
}

/* Mega menu is centred on the header bar (not on its own link), so it never leaves the screen */
.header-inner { position: relative; }
.desktop-nav .nav-link-item:has(.mega-menu-dropdown) { position: static; }

/* Keep every menu label on one line; tighter spacing on mid-size screens */
.nav-link { white-space: nowrap; }
@media (min-width: 1281px) and (max-width: 1440px) {
  .nav-link { padding: 0.5rem 0.55rem; font-size: 0.875rem; }
  .desktop-nav { gap: 0.1rem; }
  .header-inner { gap: 1rem; }
  .header-actions { gap: 0.6rem; }
}
