/* ===== ELEMENTOR / GENERATEPRESS LAYOUT OVERRIDES ===== */

/* GeneratePress applies disc bullets and left margin to ALL <ul>.
   Elementor nav and layout need these overridden globally. */
.elementor-nav-menu,
.elementor-nav-menu ul,
.elementor-nav-menu li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Force horizontal flex layout on desktop nav */
@media (min-width: 1025px) {
  .elementor-nav-menu--layout-horizontal .elementor-nav-menu {
    display: flex !important;
    flex-wrap: wrap !important;
  }
  .elementor-nav-menu--layout-horizontal .elementor-nav-menu > li {
    display: flex !important;
  }
}

/* Elementor section columns - ensure flex layout works */
.elementor-section .elementor-container {
  display: flex !important;
}
.elementor-column {
  position: relative;
  min-height: 1px;
  display: flex;
}
.elementor-widget-wrap {
  width: 100%;
}

/* Column widths - Elementor uses these classes */
.elementor-col-50 { width: 50%; }
.elementor-col-33 { width: 33.333%; }
.elementor-col-25 { width: 25%; }
.elementor-col-100 { width: 100%; }

@media (max-width: 767px) {
  .elementor-section .elementor-container {
    flex-wrap: wrap !important;
  }
  .elementor-column {
    width: 100% !important;
  }
}

/* Elementor background images (set via inline CSS in data-settings) */
.elementor-section[data-settings*="background_background"] {
  background-size: cover;
  background-position: center;
}

/* Fix the sticky header positioning */
.elementor-sticky--active {
  position: fixed !important;
  width: 100% !important;
  top: 0 !important;
  z-index: 999 !important;
}

/* Add body padding when sticky header is present */
body {
  padding-top: 0;
}

/* Elementor full-width sections */
.elementor-section-full_width {
  width: 100%;
}
.elementor-section-boxed > .elementor-container {
  max-width: 1140px;
  margin: 0 auto;
}

/* GeneratePress overrides that break Elementor page builder */
.elementor-page .site-content {
  display: block;
}
.elementor-template-full-width .site-content {
  padding: 0;
}
.elementor .elementor-element {
  box-sizing: border-box;
}

/* Image sizing */
.elementor-widget-image img {
  max-width: 100%;
  height: auto;
}

/* ===== NAV DROPDOWN FIX - Pure CSS dropdowns ===== */

/* Desktop dropdowns on hover */
@media (min-width: 1025px) {
  /* Reset SmartMenus display:none */
  .elementor-nav-menu--main .elementor-nav-menu .menu-item-has-children > .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 99999;
    min-width: 220px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-radius: 0 0 4px 4px;
    padding: 0;
    margin: 0 !important;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0);
    transition: opacity 0.25s ease, visibility 0.25s;
  }

  /* Show first-level dropdown on hover */
  .elementor-nav-menu--main .elementor-nav-menu > .menu-item-has-children:hover > .sub-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
  }

  /* Nested submenu positioning (e.g., Areas We Work In) - flyout right */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
    top: 0 !important;
    left: 100% !important;
    position: absolute !important;
    border-radius: 0 4px 4px 4px;
    margin: 0 !important;
    background-color: #fff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 999999 !important;
    overflow: visible !important;
    min-width: 200px !important;
  }

  /* Invisible bridge to prevent hover gap */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: -15px;
    width: 15px;
    height: 100%;
  }

  /* Ensure all nested submenu items have solid background */
  .elementor-nav-menu--main .sub-menu .sub-menu li {
    background-color: #fff !important;
  }

  /* First-level dropdown must not clip nested flyout */
  .elementor-nav-menu--main .elementor-nav-menu > .menu-item-has-children > .sub-menu {
    overflow: visible !important;
  }

  /* Show nested dropdown on hover */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children:hover > .sub-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
  }

  /* Dropdown item styling */
  .elementor-nav-menu--main .sub-menu li {
    display: block;
    width: 100%;
  }

  .elementor-nav-menu--main .sub-menu a {
    display: block;
    padding: 12px 20px;
    color: #333;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
  }

  .elementor-nav-menu--main .sub-menu li:hover {
    background-color: var(--e-global-color-primary, #333) !important;
  }
  .elementor-nav-menu--main .sub-menu li:hover > a {
    color: #fff;
  }

  /* Keep parent item highlighted while dropdown is open */
  .elementor-nav-menu--main .menu-item-has-children:hover > a {
    color: var(--e-global-color-primary, #333);
  }

  /* Sub-arrow icon styling */
  .elementor-nav-menu--main .sub-menu .sub-arrow {
    float: right;
    margin-left: 8px;
  }
  .elementor-nav-menu--main .sub-menu .sub-arrow i {
    transform: rotate(-90deg);
    font-size: 11px;
  }
}

/* ===== Mobile menu fixes ===== */
@media (max-width: 1024px) {
  /* Mobile dropdown container */
  nav.elementor-nav-menu--dropdown {
    width: 100% !important;
    left: 0 !important;
    max-height: 0;
    overflow: hidden;
    transform: scaleY(0);
    transform-origin: top;
    transition: max-height 0.35s ease, transform 0.35s ease;
  }

  /* When hamburger is active, show mobile menu */
  .elementor-menu-toggle.elementor-active + nav.elementor-nav-menu--dropdown {
    max-height: 100vh !important;
    overflow-y: auto;
    transform: scaleY(1);
  }

  /* Mobile submenus - hidden by default, toggle on click */
  nav.elementor-nav-menu--dropdown .sub-menu {
    display: none;
    padding-left: 15px;
  }

  nav.elementor-nav-menu--dropdown .sub-menu.mobile-open {
    display: block !important;
  }

  nav.elementor-nav-menu--dropdown .sub-menu .sub-menu.mobile-open {
    display: block !important;
  }
}
