.searchbar {
  height: 0;
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: height 0.5s ease, opacity 0.5s ease;
}

/* Wanneer de zoekbalk actief is, wordt hij zichtbaar met een vaste hoogte */
.searchbar.active {
  height: auto;  /* pas dit aan naar de gewenste hoogte */
  width: 100%;
  opacity: 1;
  margin-right: 1em;
}

.searchbar.active + .search_icon {
  width: 20%;
  transition: width 0.5s ease;
}

/* Voeg een transitie toe aan de menu-items */
.menu_items {
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Wanneer verborgen, fade out effect */
.menu_items.hidden {
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

.menu-wrapper {
  position: relative;
  width: 100%;
  background-color: #fff;
}

html, body {
  overflow-x: hidden;
}

.menu {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  /* justify-content: space-between; */
  overflow-x: hidden;
}

.nav {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav > div > a {
  display: flex;
  align-items: center;
  padding: 15px 15px;
  text-decoration: none;
  color: #333;
  font-family: 'Quicksand', sans-serif;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

/* Caret Styles for Menu Items with Children */
.menu-caret {
  margin-left: 8px;
  font-size: 12px;
  transition: transform 0.3s ease;
  color: #009C53;
  font-weight: bold;
}

/* Only show carets on top-level menu items */
.nav > .menu-item-has-children1 > a .menu-caret {
  display: inline-block;
}

/* Hide carets in dropdown menus */
.sub-menu .menu-caret,
.menu-container .menu-caret {
  display: none;
}

.caret-down {
  transform: rotate(0deg);
}

.caret-right {
  transform: rotate(-90deg);
}

/* Caret hover animations - only for top-level items */
.nav > .menu-item-has-children1:hover .caret-down {
  transform: rotate(180deg);
}

.nav > .menu-item-has-children1:hover .caret-right {
  transform: rotate(0deg);
}

.logo-link {
  display: flex;
}

.logo {
  object-fit: contain;
  margin: auto 0;
  max-width: 125px;
}

.menu > div:hover > a {
  background: #f0f0f0;
}

.vertical-devider {
  width: 2px !important;
  padding: 0px !important;
  background-color: #e1e0df;
  margin-right: 7%;
}


/* Mega Menu */

/* Standaard: verberg de menu-container en inhoud */
/* Ensure menu items don't create positioning context */
.nav > .menu-item-has-children1 {
  position: static;
}

.menu-container {
  display: flex !important;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  
  position: fixed;
  left: 0;
  right: 0;
  width: 100vw;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 20px 20px 35px 20px;
  z-index: 999;
}

/* Invisible bridge to prevent menu from closing when moving to submenu */
.nav > .menu-item-has-children1::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
}

@media (min-width: 2000px) {
    .menu-container {
        /* Already full width with margin-left: -50vw approach */
    }

    .nav > .menu-item:hover .sub-menu {
      width: 60% !important;
    }
}

.menu-item-has-children {
  font-family: 'Quicksand' !important;
  color: #333 !important;
}

/* Updated selectors for optimized menu structure */
.nav > .menu-item-has-children1:hover .menu-container {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.mega-column h3 {
  font-family: 'Quicksand';
  color: #009C53 !important;
  font-weight: normal;
}

/* Updated selectors for optimized menu structure */
.nav > .menu-item:hover .sub-menu {
  display: flex; /* Display columns side by side */
  border-radius: 0px 0px 20px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 82%;
}

.nav .sub-menu > .menu-item {
  padding: 0px;
}

.nav .sub-menu > .menu-item > a {
  padding: 8px 0;
  text-decoration: none;
  color: #333;
  font-weight: bold;
  font-family: 'Quicksand', sans-serif;
  font-size: 16px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav .sub-menu > .menu-item .sub-menu {
  position: static;
  display: block;
  /* margin-top: 10px; */
  box-shadow: none;
  width: auto;
}

.nav .sub-menu > .menu-item .sub-menu .menu-item a {
  font-weight: normal;
  padding: 5px 0;
  color: #160F0F;
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.nav .menu-item-has-children1 {
  color: #333 !important;
  font-family: 'Quicksand', sans-serif;
}

.nav .menu-item-has-children2 a:first-of-type {
  color: #009C53;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  font-size: 18px;
}

.menu-item-has-children2 {
  margin-bottom: 40px;
}

.menu-item-has-children3 {
  max-height: 34px;
  overflow: hidden; 
  transition: max-height 0.5s ease; 
}

.menu-item-has-children3:hover {
  max-height: 1000px; 
}

/* Deep Level Menu Animations - Updated selectors */
.nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children .menu-item {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.8s ease, opacity 0.8s ease;
}

.nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children:hover .menu-item {
  max-height: 1000px;
  opacity: 1;
  margin-right: 16%;
}

.nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children .menu-item {
  margin-left: 3%;
}

.nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children {
  min-height: 40px;
}

.nav .menu-item-has-children .sub-menu .mega-menu .menu-item:hover > a:first-of-type {
  color: #009C53;
  font-weight: bold;
}

/* .nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children a:first-of-type {
  font-size: 16px !important;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
} */

/* Accessibility and Performance Improvements */
@media (prefers-reduced-motion: reduce) {
  .menu-caret,
  .menu-container,
  .menu_items,
  .searchbar,
  .menu-item-has-children3,
  .nav .menu-item-has-children .sub-menu .mega-menu .menu-item-has-children .menu-item {
    transition: none;
  }
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
  .menu {
    flex-direction: column;
  }
  
  .nav {
    width: 100%;
    flex-direction: column;
  }
  
  .menu-container {
    position: static;
    transform: none;
    width: 100%;
    box-shadow: none;
  }
  
  .menu-caret {
    font-size: 14px;
  }
}

.big-mobile-link a {
  font-size: 18px!important;
  font-weight: bold;
  /* color: #333; */
}