/**
 * Modern header — CN-style layout
 * Logo left | Center nav (pill) | Request A Quote right
 * Uses gradient (#07457e → #084f91) with hover/active states
 */

/* Header height: defined on :root so body padding can use it (vars don't inherit up from .mh) */
:root {
  --mh-bar-height: 80px;
}

/* ---- Color palette (gradient + shades) ---- */
.mh {
  --mh-primary: #07457e;
  --mh-primary-dark: #063a6b;
  --mh-primary-darker: #052d54;
  --mh-primary-light: #084f91;
  --mh-primary-pale: rgba(7, 69, 126, 0.08);
  --mh-primary-pale-hover: rgba(7, 69, 126, 0.14);
  --mh-primary-pale-bg: #e8f2fa;
  --mh-border: #d4e4f1;
  --mh-text: #1a1a1a;
  --mh-text-muted: #4a5568;
  --mh-surface: #ffffff;
  --mh-shadow: 0 4px 20px rgba(7, 69, 126, 0.12);
  --mh-shadow-hover: 0 6px 24px rgba(7, 69, 126, 0.18);
  --mh-transition: 0.2s ease;
  --mh-bg-gradient: linear-gradient(90deg, #07457e 0%, #084f91 100%);
  --mh-gradient-border: linear-gradient(90deg, #07457e 0%, #084f91 100%);
  --mh-bar-height: 80px;
  /* Center nav pill: subtle overlay on gradient */
  --mh-nav-pill-bg: rgba(255, 255, 255, 0.1);
  --mh-nav-pill-hover: rgba(255, 255, 255, 0.2);
  --mh-nav-pill-active: rgba(255, 255, 255, 0.28);
}

/* ---- Bar (CN-style: full-width gradient) ---- */
.mh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: var(--mh-bg-gradient);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 12px rgba(0, 0, 0, 0.08);
}

.mh__bar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---- Container: logo (left) | center nav | CTA (right), CN layout ---- */
.mh__container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  max-height: var(--mh-bar-height);
  height: var(--mh-bar-height);
  gap: 16px;
}

@media (min-width: 992px) {
  .mh__container {
    gap: 24px;
  }
  /* Equal-width sides so center nav is visually centered */
  .mh__logo {
    flex: 0 0 auto;
    min-width: 160px;
  }
  .mh__nav {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  .mh__actions {
    flex: 0 0 auto;
    min-width: 160px;
    justify-content: flex-end;
  }
}

/* ---- Logo ---- */
.mh__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 8px;
  padding: 6px 4px;
  transition:
    opacity var(--mh-transition),
    transform var(--mh-transition);
}

.mh__logo:hover {
  opacity: 0.9;
}

.mh__logo:focus-visible {
  outline: 2px solid var(--mh-primary);
  outline-offset: 2px;
}

.mh__logo-img {
  display: block;
  height: 56px;
  width: auto;
  max-height: 64px;
  object-fit: contain;
}

/* ---- Desktop nav (center pill, CN-style) ---- */
.mh__nav {
  display: none;
  align-items: center;
  justify-content: center;
}

.mh__nav__bg {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--mh-nav-pill-bg);
  border-radius: 50px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color var(--mh-transition);
}

/* Sliding pill: follows hover, snaps back to active on mouse leave */
.mh__nav__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 50px;
  background: var(--mh-nav-pill-active);
  transition: left 0.22s ease, width 0.22s ease;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}

@media (min-width: 992px) {
  .mh__nav,
  .mh__nav__bg {
    display: flex;
  }
}

.mh__link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50px;
  transition: color var(--mh-transition);
}

.mh__link:hover,
.mh__dropdown-btn:hover {
  color: #fff;
  text-decoration: none;
}

.mh__link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.mh__link.is-active {
  color: #fff;
  font-weight: 600;
}

.mh__dropdown {
  position: relative;
}

.mh__dropdown-btn {
  gap: 4px;
}

/* Show dropdown on hover (desktop) + when open via click (Bootstrap .show) */
@media (min-width: 992px) {

  /* Invisible bridge so moving from button to menu keeps :hover (no dead zone) */
  .mh__dropdown::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px;
  }

  .mh__dropdown .mh__dropdown-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition:
      visibility var(--mh-transition),
      opacity var(--mh-transition),
      transform var(--mh-transition),
      box-shadow var(--mh-transition);
  }

  .mh__dropdown:hover .mh__dropdown-menu,
  .mh__dropdown.show .mh__dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Dropdown button when open: no extra background, indicator handles it */
.mh__dropdown:hover .mh__dropdown-btn,
.mh__dropdown.show .mh__dropdown-btn {
  color: #fff;
}

/* Caret: rotate 180° when dropdown is open (hover or click) */
.mh__caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  vertical-align: 0.2em;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform var(--mh-transition);
}

.mh__dropdown:hover .mh__caret,
.mh__dropdown.show .mh__caret {
  transform: rotate(180deg);
}

.mh__dropdown-menu {
  margin-top: 6px;
  padding: 6px 0;
  min-width: 200px;
  border-radius: 10px;
  box-shadow: var(--mh-shadow);
  border: 1px solid var(--mh-border);
  transition: box-shadow var(--mh-transition);
  position: absolute;
  z-index: 1060;
  top: 100%;
  left: 0;
}

.mh__dropdown:hover .mh__dropdown-menu,
.mh__dropdown-menu:hover {
  box-shadow: var(--mh-shadow-hover);
}

.mh__dropdown-menu .dropdown-item {
  padding: 10px 18px;
  font-size: 0.9375rem;
  color: var(--mh-text);
  border-radius: 6px;
  margin: 0 6px;
  transition:
    background var(--mh-transition),
    color var(--mh-transition);
}

.mh__dropdown-menu .dropdown-item:hover {
  background: var(--mh-primary-pale);
  color: var(--mh-primary);
}

.mh__dropdown-menu .dropdown-item:active {
  background: var(--mh-primary-pale-hover);
}

/* ---- CTA (right) ---- */
.mh__actions {
  display: none;
  align-items: center;
  flex-shrink: 0;
  gap: 1rem;
}

@media (min-width: 992px) {
  .mh__actions {
    display: flex;
  }
}

@media (min-width: 992px) and (max-width: 1130px) {
  /* @media (min-width: 768px) and (max-width: 1079px) { */
  .mh__actions {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Phone (left of Request A Quote) */
.mh__phone {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--mh-transition, 0.2s ease), opacity 0.2s ease;
}
.mh__phone:hover {
  color: #c2c2c2;
  opacity: 0.9;
  text-decoration: none;
}
.mh__phone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mh__phone-icon svg {
  display: block;
}

.mh__cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--mh-primary);
  border-radius: 8px;
  text-decoration: none;
  transition:
    background var(--mh-transition),
    color var(--mh-transition),
    box-shadow var(--mh-transition),
    transform var(--mh-transition);
}

/* Request A Quote (replaces Dashboard) — CN-style CTA pill */
.mh__actions .mh__cta {
  background: #00a651;
  color: #fff;
  border-radius: 50px;
  text-decoration: none;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 166, 81, 0.35);
  cursor: pointer;
}

.mh__dropdown--cta .mh__dropdown-btn {
  background: #00a651;
  color: #fff;
  border-radius: 50px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 166, 81, 0.35);
}

.mh__dropdown--cta:hover .mh__dropdown-btn,
.mh__dropdown--cta.show .mh__dropdown-btn {
  background: #008f46;
  color: #fff;
}

.mh__cta:hover {
  background: #008f46;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 166, 81, 0.4);
}

.mh__cta:active {
  background: var(--mh-primary-darker);
}

.mh__cta:focus-visible {
  outline: 2px solid var(--mh-primary);
  outline-offset: 2px;
}

/* ---- Mobile toggle ---- */
.mh__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: background var(--mh-transition);
}

.mh__toggle:hover {
  background: var(--mh-primary-pale);
}

.mh__toggle:focus-visible {
  outline: 2px solid var(--mh-primary);
  outline-offset: 2px;
}

@media (min-width: 992px) {
  .mh__toggle {
    display: none;
  }
}

.mh__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--mh-text);
  background: var(--mh-surface);
  border-radius: 2px;
  margin: 0 auto;
  transition: background var(--mh-transition);
}

.mh__toggle:hover span {
  background: var(--mh-primary);
}

/* ---- Mobile offcanvas (gradient match) ---- */
.mh__offcanvas {
  top: var(--mh-bar-height) !important;
  height: auto !important;
  max-height: calc(100dvh - var(--mh-bar-height));
  border-radius: 0 0 16px 16px;
  box-shadow: var(--mh-shadow);
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--mh-bg-gradient);
}

.mh__offcanvas .offcanvas-body {
  padding: 16px 20px;
}

.mh__mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mh__mobile-link {
  display: block;
  padding: 14px 12px;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  border-radius: 8px;
  transition:
    background var(--mh-transition),
    color var(--mh-transition);
}

.mh__mobile-link:hover {
  background: var(--mh-nav-pill-hover);
  color: #fff;
}

.mh__mobile-link.is-active {
  background: var(--mh-nav-pill-active);
  color: #fff;
  font-weight: 600;
}

.mh__mobile-sublink {
  display: block;
  padding: 12px 12px 12px 24px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: 8px;
  transition:
    background var(--mh-transition),
    color var(--mh-transition);
}

.mh__mobile-sublink:hover {
  background: var(--mh-nav-pill-hover);
  color: #fff;
}

.mh__mobile-dropdown .collapse {
  padding-left: 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.25);
  margin-bottom: 4px;
}

.mh__cta--mobile {
  margin-top: 12px;
  justify-content: center;
  width: 100%;
}

/* ---- Body offset (avoid content under fixed header) ---- */
body.with-fixed-header,
body:has(.mh) {
  padding-top: var(--mh-bar-height) !important;
  --header-top-h: var(--mh-bar-height);
}

/* Ensure no other rule removes body top padding on desktop/mobile */
@media (max-width: 768px) {
  body.with-fixed-header,
  body:has(.mh) {
    padding-top: var(--mh-bar-height) !important;
  }
}
@media (min-width: 769px) {
  body.with-fixed-header,
  body:has(.mh) {
    padding-top: var(--mh-bar-height) !important;
  }
}