/* Mobile Menu within Header - Custom Styles */

/* Remove default body margin when enhanced mobile menu is available */
@media only screen and (max-width: 63.9375rem) {
  body.mobile-menu-enabled {
    margin-top: 0 !important;
  }
}

/* Position mobile menu within header container */
.b-mobile-menu.newnav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 0;
  overflow: hidden;
  background: transparent;
  border: none !important;
  box-shadow: none !important;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99;
}

@media only screen and (max-width: 63.9375rem) {
  .b-mobile-menu.newnav {
    display: block;
  }
}

/* When menu is active */
.b-mobile-menu.newnav.b-mobile-menu--is-active {
  height: calc(100vh - 135px);
  overflow-y: auto;
  border: none !important;
  box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.08);
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  color: #20243f;
}

/* Fixed header state - match header width and styling */
.fixed .b-mobile-menu.newnav.b-mobile-menu--is-active {
  height: calc(100vh - 120px);
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
  margin: 0 auto 20px;
  max-width: 1200px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.12);
  background-color: rgba(255, 255, 255, 0.92);
  border: none !important;
}

.b-mobile-menu.newnav .b-mobile-menu__nav-link {
  color: #20243f;
}

.b-mobile-menu.newnav .b-mobile-menu__nav-link svg path,
.b-mobile-menu.newnav .b-mobile-menu__nav-link svg line,
.b-mobile-menu.newnav .b-mobile-menu__nav-link svg polyline {
  stroke: #20243f;
}

/* Animate bottom border radius of fixed header when menu opens */
.fixed .b-main-header__bottom {
  transition: border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fixed.mobile-menu-open .b-main-header__bottom {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Hamburger to X animation */
.e-burger {
  position: relative;
  transition: all 0.3s ease-in-out;
}

.e-burger span {
  transition: all 0.3s ease-in-out;
  transform-origin: center;
}

/* First bar */
.e-burger span:nth-child(1) {
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Second bar */
.e-burger span:nth-child(2) {
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Third bar */
.e-burger span:nth-child(3) {
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Active state - transform to X */
.e-burger--active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.e-burger--active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.e-burger--active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Hover state for active burger (X) */
.e-burger--active:hover span {
  background-color: #218773; /* Darker green on hover */
}

/* Mobile menu header - hide the close button in header */
.b-mobile-menu__header {
  display: none;
}

/* Mobile menu inner adjustments */
.b-mobile-menu__inner {
  padding-top: 40px;
  padding-bottom: 40px;
}

/* Overlay should be hidden when menu is in header */
.b-mobile-menu-overlay {
  display: none !important;
}

/* Ensure header stays on top */
.b-main-header {
  position: relative;
  z-index: 100;
}

.b-main-header__bottom {
  position: relative;
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

/* Smooth scroll for menu content */
.b-mobile-menu__inner {
  -webkit-overflow-scrolling: touch;
}

/* Adjust for different screen sizes */
@media only screen and (max-width: 67.5rem) {
  .b-mobile-menu.newnav.b-mobile-menu--is-active {
    height: calc(100vh - 155px);
  }

  .fixed .b-mobile-menu.newnav.b-mobile-menu--is-active {
    height: calc(100vh - 110px);
  }
}

@media only screen and (max-width: 47.5rem) {
  .b-mobile-menu.newnav.b-mobile-menu--is-active {
    height: calc(100vh - 175px);
  }

  .fixed .b-mobile-menu.newnav.b-mobile-menu--is-active {
    height: calc(100vh - 105px);
  }
}

/* Hide desktop menu items and tune mega menu for mobile */
@media only screen and (max-width: 63.9375rem) {
  .b-main-header__bottom--middle {
    display: none;
  }

  .b-mobile-menu.newnav .e-mega-menu {
    display: none !important;
    position: static !important;
    height: auto !important;
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
    margin-top: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  }

  /* Force display when parent has is-active, regardless of other classes */
  .b-mobile-menu.newnav .vividcare-prodcat-meg.is-active > .e-mega-menu,
  .b-mobile-menu.newnav .js-toggle-submenu.is-active > .e-mega-menu,
  .b-mobile-menu.newnav li.is-active > .e-mega-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .b-mobile-menu.newnav .e-mega-menu__bottom {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
  }

  .b-mobile-menu.newnav .e-mega-menu .menu-bar {
    padding: 0;
  }

  .b-mobile-menu.newnav .e-mega-menu .mega-menu {
    display: block;
  }

  .b-mobile-menu.newnav .e-mega-menu .menu-link {
    color: #20243f;
    padding: 8px 0;
    display: block;
    font-size: 16px;
  }
}
