/* Mega menu inside original Elementor header (keep phone/email/search/Free Quote) */

.elementor-location-header,
.elementor-location-header > .e-con,
.elementor-location-header > .elementor-element,
.elementor-location-header .e-con-inner,
.elementor-location-header .static-mega-nav-slot,
.elementor-location-header #mega-menu-wrap-primary {
  overflow: visible !important;
}

.elementor-location-header #header_pop {
  z-index: 10010;
}

/* Safety: enforce Elementor responsive header variants (desktop / tablet / mobile) */
@media (min-width: 1025px) {
  .elementor-location-header .elementor-hidden-desktop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .elementor-location-header #header_pop.elementor-sticky__spacer {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    pointer-events: none !important;
  }
}
@media (max-width: 1024px) and (min-width: 768px) {
  .elementor-location-header .elementor-hidden-tablet {
    display: none !important;
  }
}
@media (max-width: 767px) {
  .elementor-location-header .elementor-hidden-mobile,
  .elementor-location-header .elementor-hidden-phone {
    display: none !important;
  }
}

/* Mega nav slot in the main header row — do not force huge flex growth */
.static-mega-nav-slot {
  width: auto !important;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}
.static-mega-nav-slot .elementor-widget-container {
  width: 100%;
}

.static-mega-nav-slot #mega-menu-wrap-primary {
  background: transparent !important;
  clear: none !important;
  float: none !important;
  width: 100%;
}

.static-mega-nav-slot #mega-menu-wrap-primary #mega-menu-primary {
  text-align: right;
  float: none !important;
  display: block !important;
  width: 100%;
}

/* Match Elementor main header row height */
.elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
  line-height: 60px !important;
  height: 60px !important;
  padding: 0 8px !important;
  font-size: 15px !important;
  color: #222 !important;
  background: transparent !important;
  transition: color 0.2s, background-color 0.2s;
  white-space: nowrap;
}

.elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover,
.elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:focus,
.elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > a.mega-menu-link {
  color: #1e439d !important;
  background: transparent !important;
}

/* Flyout above content */
.elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-flyout > ul.mega-sub-menu {
  z-index: 99999 !important;
}

/* Hide mega hamburger on desktop; Elementor tablet/mobile headers keep their own menus */
@media (min-width: 1025px) {
  .elementor-location-header #mega-menu-wrap-primary .mega-menu-toggle {
    display: none !important;
  }
  .elementor-location-header #mega-menu-wrap-primary #mega-menu-primary {
    display: block !important;
    visibility: visible !important;
  }

  .elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item {
    position: relative;
  }

  .elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-flyout > ul.mega-sub-menu {
    display: block !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(8px);
    transition:
      opacity 0.16s ease,
      transform 0.16s ease,
      visibility 0s linear 0.16s !important;
  }

  .elementor-location-header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-flyout:hover > ul.mega-sub-menu {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
    transition-delay: 0s !important;
  }
}

/* Keep search + Free Quote above flyouts */
.elementor-location-header .elementor-widget-button,
.elementor-location-header .elementor-widget-bdt-search {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

/* Quote popup modal (matches exported WP popup-overlay markup) */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 99999;
  overflow-y: auto;
  animation: innovaPopupFadeIn 0.3s;
}

.popup-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.popup-overlay .popup-wrapper {
  position: relative;
  width: 100%;
  max-width: 750px;
  margin: auto;
  animation: innovaPopupSlideUp 0.3s;
}

.popup-overlay .popup-close {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 28px;
  color: #555;
  cursor: pointer;
  z-index: 2;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.popup-overlay .popup-close:hover {
  background: #f0f0f0;
  color: #111;
}

.popup-overlay .popup-content {
  background: #fff;
  padding: 48px 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.popup-overlay .popup-content .wpforms-container {
  margin: 0;
}

@media (max-width: 600px) {
  .popup-overlay .popup-content {
    padding: 28px 20px;
  }
}

@keyframes innovaPopupFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes innovaPopupSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
