/* =====================================================
   BITNEKA PREMIUM HEADER CSS — STABILIZED FINAL
   Neutral Black · Stable Geometry · Mega Menu · Mobile Drawer
   ===================================================== */

/* ── 1. Base Header & Geometry ───────────────────── */
header#siteHeader.site-header,
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 999;
  height: 68px;
  padding: 0 !important;
  background: rgba(0, 0, 0, 0.92) !important;
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-sizing: border-box;
  transition: background .25s ease, box-shadow .25s ease, border-color .25s ease;
}

/* Neutral Pure Black Scrolled Header */
html body header#siteHeader.site-header.scrolled,
html[data-theme="dark"] header#siteHeader.site-header.scrolled,
header#siteHeader.site-header.scrolled,
.site-header.scrolled {
  background: rgba(0, 0, 0, 0.98) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.65) !important;
}

/* ── 2. Nav Inner Container ──────────────────────── */
.site-header .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
  box-sizing: border-box;
}

/* ── 3. Logo (Stable scale, vertical alignment) ──── */
.site-header .nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  padding: 0;
  text-decoration: none;
}
.site-header .nav-logo img {
  height: 34px !important;
  width: auto;
  object-fit: contain;
  transition: transform .2s ease;
}
.site-header .nav-logo:hover img {
  transform: scale(1.02);
}
/* Crucial: Stable geometry on scroll with zero jump */
.site-header.scrolled .nav-logo img {
  height: 34px !important;
}

/* ── 4. Desktop Navigation ───────────────────────── */
.site-header .nav-desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  margin: 0 16px;
}

.site-header .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72) !important;
  text-decoration: none;
  background: transparent !important;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  position: relative;
  transition: color .2s ease, background .2s ease;
}

/* Suppress competing underline pseudo-elements from legacy styles */
.site-header .nav-link::after {
  display: none !important;
}

.site-header .nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

/* Unified single active style */
.site-header .nav-link--active,
.site-header .nav-link[aria-current="page"] {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Chevron */
.nav-chevron-svg,
.nav-chevron {
  transition: transform .25s ease;
  flex-shrink: 0;
}
.nav-mega-wrap.open .nav-chevron-svg,
.nav-mega-wrap.open .nav-chevron {
  transform: rotate(180deg);
}

/* ── 5. Mega Menu Wrapper & Panel ────────────────── */
.nav-mega-wrap {
  position: relative;
}

/* Invisible bridge prevents pointer leaving hover zone between trigger and panel */
.nav-mega-wrap::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -20px;
  right: -20px;
  height: 16px;
  pointer-events: auto;
}

.nav-mega-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: min(920px, calc(100vw - 40px));
  max-width: min(920px, calc(100vw - 40px));
  box-sizing: border-box;
  background: #0E0E0E !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .2s ease, transform .2s cubic-bezier(.22, 1, .36, 1), visibility .2s;
  z-index: 1000;
  overflow: hidden;
}

.nav-mega-wrap.open .nav-mega-panel,
.nav-mega-wrap:hover .nav-mega-panel,
.nav-mega-wrap:focus-within .nav-mega-panel {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Mega Hub Link Header */
.mega-hub-link-wrap {
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mega-hub-count {
  font-size: 11px;
  font-weight: 800;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.mega-hub-link {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .2s ease;
}
.mega-hub-link:hover {
  color: #7fa8ff;
}

/* Mega Grid Layout */
.mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 18px 20px;
}
.mega-col {
  padding: 0 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.mega-col:first-child {
  padding-left: 0;
}
.mega-col:last-child {
  padding-right: 0;
  border-right: none;
}
.mega-col-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: block;
}
.mega-col-label.label--green {
  color: #34d399;
}
.mega-col-label.label--blue {
  color: #4F6EF7;
}
.mega-col-label.label--spaced {
  margin-top: 18px;
}

/* Mega Service Links */
.mega-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
  margin-bottom: 2px;
}
.mega-link:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(3px);
}
.mega-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #cbd5e1;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.mega-link:hover .mega-link-icon {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
.mega-link div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mega-link strong {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}
.mega-link span {
  font-size: 11px;
  color: #888888;
  font-weight: 400;
  line-height: 1.35;
}

/* Mega Decision Helper Footer */
.mega-helper-footer {
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #080808;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 16px 16px;
}
.mega-helper-text {
  font-size: 12.5px;
  color: #a0a0a0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mega-helper-link {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .2s ease;
}
.mega-helper-link:hover {
  color: #7fa8ff;
}

/* ── 6. Nav Actions (Right side controls) ────────── */
.site-header .nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  justify-content: flex-end;
}

/* Search Trigger Button */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: inherit;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.nav-search-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}
.nav-search-btn svg {
  flex-shrink: 0;
}
.nav-search-kbd {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.2;
}

/* CTA Let's Talk Button */
.site-header .nav-cta-btn {
  font-size: 14px !important;
  font-weight: 700 !important;
  padding: 9px 18px !important;
  gap: 8px;
  white-space: nowrap;
  border-radius: 999px;
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #ffffff !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.site-header .nav-cta-btn:hover {
  transform: translateY(-1px);
  background: #f1f5f9 !important;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}
.site-header .nav-cta-btn svg {
  transition: transform .2s ease;
  flex-shrink: 0;
}
.site-header .nav-cta-btn:hover svg {
  transform: translateX(3px);
}

/* Hamburger Trigger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: background .2s ease, border-color .2s ease;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: all .25s cubic-bezier(.22, 1, .36, 1);
}
.nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
/* Animate Hamburger to X */
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 7. Mobile Drawer Backdrop ───────────────────── */
.mm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.mm-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* ── 8. Mobile Drawer Menu ───────────────────────── */
#mobileMenu,
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 100vw);
  height: 100vh;
  height: 100dvh;
  background: #0C0C0C !important;
  z-index: 1100 !important;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow: -8px 0 60px rgba(0, 0, 0, 0.85);
  box-sizing: border-box;
}
#mobileMenu.open,
.mobile-menu.open {
  transform: translateX(0);
}

/* MM Top Bar — Sticky at top of drawer */
#mobileMenu .mm-top,
.mobile-menu .mm-top,
.mm-top {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 20px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  flex-shrink: 0 !important;
  background: #080808 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
}
.mm-top .nav-logo img {
  height: 30px;
  width: auto;
  object-fit: contain;
}
.mm-close-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  box-sizing: border-box;
}
.mm-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* MM Search Bar */
.mm-search-wrap {
  padding: 12px 16px 6px;
  flex-shrink: 0;
}
.mm-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #a0a0a0;
  font-size: 13.5px;
  cursor: pointer;
  box-sizing: border-box;
  font-family: inherit;
  transition: background .18s, border-color .18s, color .18s;
}
.mm-search-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.mm-search-kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #ffffff;
}

/* MM Nav Links */
.mm-nav {
  padding: 10px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.mm-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 600;
  color: #FFFFFF;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  font-family: inherit;
  transition: all .2s ease;
}
.mm-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.mm-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #cbd5e1;
  flex-shrink: 0;
  transition: all .2s ease;
}
.mm-link:hover .mm-link-icon {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.mm-link > span:nth-child(2) {
  flex: 1;
  text-align: left;
}
.mm-acc-chevron,
.mm-link-arrow {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.4);
  transition: transform .22s ease, color .2s ease;
  flex-shrink: 0;
}
.mm-link:hover .mm-link-arrow {
  color: #7fa8ff;
  transform: translateX(3px);
}

/* Accordion Active/Open State — JS and CSS Synchronized */
.mm-accordion-trigger.open .mm-acc-chevron,
.mm-accordion-trigger.active .mm-acc-chevron,
.mm-accordion-trigger[aria-expanded="true"] .mm-acc-chevron {
  transform: rotate(180deg);
  color: #7fa8ff;
}
.mm-accordion-body {
  display: none;
}
.mm-accordion-body.open {
  display: block;
}

/* Services Accordion List */
.mm-acc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px 12px;
}
.mm-acc-label {
  font-size: 10.5px;
  font-weight: 800;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px 2px;
  display: block;
}
.mm-acc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 42px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
  transition: all .16s ease;
}
.mm-acc-item i {
  font-size: 12px;
  color: #a0a0a0;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.mm-acc-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.mm-acc-item.mm-acc-finder {
  color: #34d399;
  font-weight: 700;
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.2);
}
.mm-acc-item.mm-acc-finder i {
  color: #34d399;
}

/* MM Footer */
.mm-footer {
  padding: 18px 20px max(24px, env(safe-area-inset-bottom, 24px));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  background: #080808;
  margin-top: auto;
}
.mm-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #ffffff;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.mm-cta-btn:hover {
  transform: translateY(-2px);
  background: #f1f5f9;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}
.mm-cta-btn svg {
  flex-shrink: 0;
  transition: transform .2s ease;
}
.mm-cta-btn:hover svg {
  transform: translateX(3px);
}

.mm-footer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.mm-contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.mm-contact-info a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  color: #a0a0a0;
  text-decoration: none;
  min-height: 36px;
  transition: color .18s;
}
.mm-contact-info a:hover {
  color: #ffffff;
}
.mm-contact-info a i {
  color: #a0a0a0;
  font-size: 11px;
}
.mm-contact-info a:hover i {
  color: #ffffff;
}
.mm-socials {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.mm-socials a {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a0a0a0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  text-decoration: none;
  transition: all .2s ease;
  box-sizing: border-box;
}
.mm-socials a:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: translateY(-2px);
}

/* ── 9. Focus Visible Accessibility ──────────────── */
.nav-link:focus-visible,
.nav-search-btn:focus-visible,
.site-header .nav-cta-btn:focus-visible,
.nav-hamburger:focus-visible,
.mm-close-btn:focus-visible,
.mm-search-btn:focus-visible,
.mm-link:focus-visible,
.mm-acc-item:focus-visible,
.mm-cta-btn:focus-visible,
.mega-link:focus-visible,
.mega-hub-link:focus-visible,
.mega-helper-link:focus-visible {
  outline: 2px solid #4f6ef7 !important;
  outline-offset: 2px !important;
}

/* ── 10. Responsive Breakpoints ───────────────────── */

/* Desktop to Tablet transition at 1024px */
@media (min-width: 1025px) {
  header#siteHeader .nav-desktop {
    display: flex !important;
  }
  header#siteHeader .nav-hamburger {
    display: none !important;
  }
  header#siteHeader .nav-cta-btn,
  header#siteHeader #navCtaBtn {
    display: inline-flex !important;
  }
}

@media (max-width: 1024px) {
  header#siteHeader .nav-desktop {
    display: none !important;
  }
  header#siteHeader .nav-hamburger {
    display: flex !important;
  }
  header#siteHeader .nav-cta-btn,
  header#siteHeader #navCtaBtn {
    display: none !important;
  }
}

/* Mobile header height & sizing */
@media (max-width: 480px) {
  header#siteHeader.site-header {
    height: 60px;
    padding: 0 !important;
  }
  .site-header .nav-inner {
    height: 60px;
    gap: 10px;
  }
  .site-header .nav-logo img,
  .site-header.scrolled .nav-logo img {
    height: 28px !important;
  }
  #mobileMenu,
  .mobile-menu {
    width: 100vw;
  }
}

/* Ultra-compact screens (360px and 320px) */
@media (max-width: 360px) {
  .site-header .nav-inner {
    gap: 6px;
  }
  .site-header .nav-actions {
    gap: 6px;
  }
  .nav-search-btn {
    padding: 0 8px;
  }
  .nav-search-kbd {
    display: none;
  }
}

/* ── 11. Reduced Motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  header#siteHeader,
  .site-header,
  .nav-mega-panel,
  .nav-chevron-svg,
  .nav-chevron,
  .mm-acc-chevron,
  .nav-link,
  .nav-logo img,
  #mobileMenu,
  .mobile-menu,
  .mm-backdrop,
  .nav-hamburger span,
  .mm-link,
  .mm-acc-item,
  .mm-cta-btn,
  .site-header .nav-cta-btn {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
