/* =============================================================
   Battery Swap — Custom Header CSS
   Overrides Astra Header Builder completely
   ============================================================= */

/* ── Hide Astra header (SPECIFIC selectors only — NEVER target body classes) ── */
div.ast-hfb-header,
header.site-header,
header#masthead.site-header,
.main-header-bar-wrap,
#ast-desktop-header,
#ast-mobile-header,
.ast-above-header-bar,
.ast-below-header-bar,
.ast-masthead-custom-menu-items {
  display: none !important;
}

/* ────────────────────────────────
   HEADER SHELL
──────────────────────────────── */
#bs-masthead {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #ffffff;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  border-bottom: 3px solid #C8102E;
  font-family: 'Cairo', sans-serif;
}

.bs-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
  height: 70px;
  gap: 20px;
}

/* ────────────────────────────────
   LOGO
──────────────────────────────── */
.bs-logo-wrap { flex-shrink: 0; }
.bs-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none !important;
}
.bs-logo-img {
  height: 46px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  display: block;
}
.bs-logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1A1A1A;
  letter-spacing: -0.3px;
}

/* ────────────────────────────────
   DESKTOP NAVIGATION
──────────────────────────────── */
#bs-primary-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

ul.bs-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
  flex-wrap: nowrap;
}

ul.bs-nav-list > li { position: relative; }

ul.bs-nav-list > li > a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  font-family: 'Cairo', sans-serif !important;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151 !important;
  text-decoration: none !important;
  white-space: nowrap;
  border-radius: 6px;
  transition: color 0.18s ease, background 0.18s ease;
  line-height: 1.4;
}

ul.bs-nav-list > li > a:hover {
  color: #C8102E !important;
  background: rgba(200,16,46,0.06);
}

ul.bs-nav-list > li.current-menu-item > a,
ul.bs-nav-list > li.current-page-ancestor > a,
ul.bs-nav-list > li.current-menu-ancestor > a {
  color: #C8102E !important;
}

/* Dropdown chevron */
ul.bs-nav-list > li.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid currentColor;
  border-inline-end: 4px solid transparent;
  border-inline-start: 4px solid transparent;
  opacity: 0.65;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

ul.bs-nav-list > li.menu-item-has-children:hover > a::after {
  transform: rotate(180deg);
  opacity: 1;
}

/* ── Submenu Dropdown ── */
ul.bs-nav-list .sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: auto;
  inset-inline-end: 0;
  min-width: 210px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14);
  border-top: 3px solid #C8102E;
  padding: 6px 0;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 10001;
}

ul.bs-nav-list > li:hover > .sub-menu,
ul.bs-nav-list > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

ul.bs-nav-list .sub-menu li { list-style: none; }

ul.bs-nav-list .sub-menu li a {
  display: block;
  padding: 10px 20px;
  font-family: 'Cairo', sans-serif !important;
  font-size: 0.86rem;
  font-weight: 500;
  color: #374151 !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, padding 0.15s ease;
}

ul.bs-nav-list .sub-menu li a:hover {
  background: #FFF5F7;
  color: #C8102E !important;
  padding-inline-start: 26px;
}

/* ────────────────────────────────
   HEADER END (CTA + HAMBURGER)
──────────────────────────────── */
.bs-header-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bs-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #C8102E !important;
  color: #ffffff !important;
  padding: 9px 22px;
  border-radius: 50px;
  font-family: 'Cairo', sans-serif !important;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 16px rgba(200,16,46,0.28);
  border: none;
  cursor: pointer;
}

.bs-cta-btn:hover {
  background: #a50d26 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(200,16,46,0.38);
  color: #ffffff !important;
}

/* ── Hamburger ── */
.bs-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  transition: border-color 0.2s ease;
}

.bs-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #374151;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.2s;
}

.bs-hamburger:hover { border-color: #C8102E; }
.bs-hamburger:hover span { background: #C8102E; }

.bs-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bs-hamburger.is-active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.bs-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ────────────────────────────────
   MOBILE NAV OVERLAY
──────────────────────────────── */
#bs-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#bs-nav-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* ────────────────────────────────
   RESPONSIVE — TABLET & MOBILE (≤ 920px)
──────────────────────────────── */
@media (max-width: 920px) {
  .bs-hamburger { display: flex; }
  .bs-cta-btn   { display: none; }

  #bs-primary-nav {
    position: fixed;
    top: 0;
    width: 300px;
    height: 100vh;
    background: #ffffff;
    z-index: 9995;
    padding: 76px 0 40px;
    overflow-y: auto;
    box-shadow: -4px 0 30px rgba(0,0,0,0.18);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
  }

  html[dir="ltr"] #bs-primary-nav {
    right: auto; left: -320px;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  html[dir="ltr"] #bs-primary-nav.is-open { left: 0; }
  html[dir="rtl"] #bs-primary-nav {
    right: -320px; left: auto;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  html[dir="rtl"] #bs-primary-nav.is-open { right: 0; }

  ul.bs-nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
  }

  ul.bs-nav-list > li > a {
    padding: 14px 24px;
    font-size: 0.95rem;
    border-radius: 0;
    border-bottom: 1px solid #F3F4F6;
    justify-content: space-between;
    white-space: normal;
  }

  ul.bs-nav-list > li.menu-item-has-children > a::after { flex-shrink: 0; }

  ul.bs-nav-list .sub-menu {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    border-top: none !important;
    border-radius: 0;
    background: #F9FAFB;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    display: block;
    transition: max-height 0.3s ease;
  }

  ul.bs-nav-list li.is-open > .sub-menu { max-height: 400px; }

  ul.bs-nav-list .sub-menu li a {
    padding: 12px 36px;
    border-bottom: 1px solid #EEEEEE;
    font-size: 0.875rem;
  }

  ul.bs-nav-list .sub-menu li a:hover { padding-inline-start: 42px; }
}

@media (max-width: 480px) {
  .bs-header-inner { padding: 0 16px; height: 62px; }
  .bs-logo-img     { height: 38px; }
}

.site-content { min-height: calc(100vh - 73px); }
