/* IBC Master — Header styles */

:root {
  --ibc-navy:         #0d2137;
  --ibc-navy-dark:    #081525;
  --ibc-blue:         #004fa3;
  --ibc-blue-hover:   #003d7a;
  --ibc-blue-light:   #6ba3e0;
  --ibc-grey-100:     #f4f6f8;
  --ibc-grey-200:     #e2e8ee;
  --ibc-grey-400:     #8a9aad;
  --ibc-grey-600:     #4a5568;
  --ibc-text-muted:   #555555;
  --ibc-border:       #e0e0e0;
  --ibc-white:        #ffffff;
  --ibc-shadow:       0 4px 24px rgba(13, 33, 55, 0.12);
  --ibc-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-z:         300;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ibc-font);
  color: var(--ibc-navy);
}

/* ── Top utility bar ─────────────────────────────────────────── */

.top-bar {
  background: var(--ibc-navy-dark);
  color: var(--ibc-white);
  font-size: 0.75rem;
  min-height: 44px;
}

.top-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.top-bar__links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.top-bar__links a {
  color: var(--ibc-white);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.15s;
}

.top-bar__links a:hover { color: var(--ibc-blue-light); }

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.top-bar__phone {
  color: var(--ibc-white);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.top-bar__phone:hover { color: var(--ibc-blue-light); }

.top-bar__auth {
  color: var(--ibc-white);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.top-bar__auth:hover { color: var(--ibc-blue-light); }

/* ── Main nav bar ────────────────────────────────────────────── */

.main-nav {
  background: var(--ibc-navy);
  position: sticky;
  top: 0;
  z-index: 3;
}

.main-nav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 16px 8px;
  display: grid;
  grid-template-columns: auto minmax(300px, 560px) 1fr;
  align-items: center;
  gap: 24px;
}

.main-nav__start {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-width: 0;
  flex-shrink: 0;
}

.main-nav__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  overflow: hidden;
}

.main-nav__logo img {
  display: block;
  height: 56px;
  width: auto;
  object-fit: contain;
}

.main-nav__center {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.main-nav__end {
  display: flex;
  justify-content: flex-end;
  justify-self: end;
}

/* All Products button */
.all-prod-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--ibc-blue);
  color: var(--ibc-white);
  border: none;
  border-radius: 4px;
  font-family: var(--ibc-font);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.all-prod-btn:hover { background: var(--ibc-blue-hover); }

.all-prod-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.all-prod-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Desktop search */
.search-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 4px 0 0 4px;
  font-family: var(--ibc-font);
  font-size: 0.875rem;
  outline: none;
  background: var(--ibc-white);
  box-shadow: inset 0 0 0 2px var(--ibc-blue);
}

.search-input:focus {
  box-shadow: inset 0 0 0 2px var(--ibc-blue-hover);
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: var(--ibc-blue);
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.search-btn:hover { background: var(--ibc-blue-hover); }

/* Nav actions (account, cart) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 20px;
  color: var(--ibc-white);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.nav-action:first-child {
  padding-left: 0;
}

.nav-action:last-child {
  padding-right: 0;
}

.nav-action + .nav-action {
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.nav-action:hover { color: var(--ibc-blue-light); }

.nav-action img { display: block; }

/* Hamburger (mobile only) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  cursor: pointer;
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ibc-white);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }

.hamburger-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile search row (injected by JS) */
.mobile-search-row {
  display: none;
  width: 100%;
}

.mobile-search-row input {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 4px 0 0 4px;
  font-family: var(--ibc-font);
  font-size: 0.875rem;
  outline: none;
}

.mobile-search-row button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--ibc-blue);
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background 0.15s;
}

.mobile-search-row button:hover { background: var(--ibc-blue-hover); }

/* ── Secondary nav links ─────────────────────────────────────── */

.sub-nav {
  background: var(--ibc-grey-100);
  border-bottom: 1px solid var(--ibc-grey-200);
  position: relative;
  z-index: 3;
}

.sub-nav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.sub-nav__links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
}

.sub-nav__links a {
  display: block;
  padding: 12px 18px;
  color: var(--ibc-grey-600);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.sub-nav__links a:hover {
  color: var(--ibc-blue);
  background: var(--ibc-white);
}

/* ── Mega menu ───────────────────────────────────────────────── */

.mega-menu {
  background: var(--ibc-white);
  border-bottom: 1px solid var(--ibc-border);
  border-top: 3px solid var(--ibc-blue);
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.mega-menu[hidden] { display: none; }

.mega-menu__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.mega-col {
  padding: 20px 16px;
  border-right: 0.5px solid var(--ibc-border);
}

.mega-col:last-child { border-right: none; }

.mega-col__head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ibc-blue);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--ibc-border);
}

.mega-col a {
  display: block;
  font-size: 12px;
  color: var(--ibc-text-muted);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.5;
  transition: color 0.15s ease;
}

.mega-col a:hover { color: var(--ibc-blue); }

.mega-menu__subnav {
  border-top: 1px solid var(--ibc-grey-200);
  background: var(--ibc-grey-100);
}

.mega-menu__subnav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.mega-menu__subnav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mega-menu__subnav-links li {
  list-style: none;
}

.mega-menu__subnav-links a {
  display: block;
  padding: 12px 18px;
  color: var(--ibc-grey-600);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.mega-menu__subnav-links a:hover {
  color: var(--ibc-blue);
  background: var(--ibc-white);
}

/* ── Mobile drawer ───────────────────────────────────────────── */

#mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 88vw);
  height: 100dvh;
  background: var(--ibc-white);
  z-index: calc(var(--header-z) + 2);
  overflow-y: auto;
  box-shadow: 4px 0 32px rgba(13, 33, 55, 0.2);
}

.mobile-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ibc-navy);
  color: var(--ibc-white);
  font-weight: 700;
  font-size: 0.9375rem;
}

.mobile-drawer__nav {
  padding: 8px 0;
}

.mobile-drawer__nav a {
  display: block;
  padding: 14px 20px;
  color: var(--ibc-navy);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--ibc-grey-200);
  transition: background 0.15s, color 0.15s;
}

.mobile-drawer__nav a:hover {
  background: var(--ibc-grey-100);
  color: var(--ibc-blue);
}

.mobile-drawer__section {
  padding: 16px 20px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ibc-grey-400);
}

/* ── Overlay ─────────────────────────────────────────────────── */

#header-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 33, 55, 0.55);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#header-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Site header wrapper ─────────────────────────────────────── */

.site-header {
  position: relative;
  z-index: var(--header-z);
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .top-bar__links { display: none; }

  .main-nav__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .main-nav__start {
    order: 0;
  }

  .main-nav__end {
    order: 1;
    margin-left: auto;
  }

  .main-nav__center {
    order: 10;
    width: 100%;
  }

  .hamburger-btn { display: flex; }

  .all-prod-btn { display: none; }

  .main-nav__logo img {
    max-width: min(240px, 52vw);
  }

  .search-wrap { display: none; }

  .mobile-search-row {
    display: flex;
    width: 100%;
  }

  .nav-action {
    padding: 6px 14px;
  }

  .nav-action:first-child {
    padding-left: 0;
  }

  .sub-nav { display: none; }

  .mega-menu { display: none !important; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .mega-menu__inner { grid-template-columns: repeat(3, 1fr); }
  .mega-col:nth-child(3) { border-right: none; }
  .mega-col:nth-child(4) { border-top: 0.5px solid var(--ibc-border); }
}

@media (min-width: 769px) {
  #mobile-drawer { display: none !important; }

  .mobile-search-row { display: none !important; }
}
