.mega-menu {
  position: absolute;
  left: 0;
  top: 100%;
  /* Perfectly flush with parent bottom */
  /* Synchronized with header height */
  width: 100%;
  background: #ffffff;
  color: #333;
  z-index: 1000;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(0, 0, 0, 0.05);

  /* Use visibility and opacity for smoother transition and hover persistence */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0s linear 0.1s;
  /* Reduced delay */
  pointer-events: none;
}

/* Invisible bridge to prevent losing hover when moving mouse from link to menu */
.mega-menu::before {
  content: '';
  position: absolute;
  top: -40px;
  /* Even more overlap to be safe */
  left: 0;
  width: 100%;
  height: 40px;
  background: rgba(255, 255, 255, 0.01);
  /* Not fully transparent to ensure hit testing in some browsers */
  display: block;
  z-index: -1;
}

/* Specific Triggers */
#nav-solutions:hover #mega-menu-solutions,
#nav-innovation:hover #mega-menu-innovation,
#nav-news:hover #mega-menu-news,
#nav-about:hover #mega-menu-about,
.nav-dropdown:hover>.mega-menu {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transition-delay: 0s !important;
  animation: slideDownFade 0.3s ease-out forwards;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mega-menu-content {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 450px;
}

/* Column 1: Sidebar */
.mega-menu-sidebar {
  width: 300px;
  background: #f8f9fa;
  padding: 40px 0;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-item {
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: #555;
  border-left: 4px solid transparent;
}

.sidebar-item:hover,
.sidebar-item.active {
  background: #ffffff;
  color: #0755E9;
  border-left-color: #0755E9;
}

.sidebar-item i {
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-item:hover i,
.sidebar-item.active i {
  opacity: 1;
}

/* Main Content Area */
.mega-menu-main {
  flex: 1;
  padding: 40px;
  position: relative;
}

.category-content {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  height: 100%;
}

.category-content.active {
  display: grid;
}

/* Column 2: Context */
.mega-menu-column.middle h3 {
  font-size: 28px;
  color: #111;
  margin-bottom: 20px;
  font-weight: 700;
}

.mega-menu-column.middle p {
  font-size: 16px;
  line-height: 1.6;
  color: #666;
  margin-bottom: 30px;
}

.mega-menu-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #0755E9;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.mega-menu-cta:hover {
  transform: translateX(5px);
}

/* Column 3: Links */
.mega-menu-column.right h4 {
  font-size: 14px;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.mega-menu-column.right ul {
  list-style: none;
  padding: 0;
}

.mega-menu-column.right ul li {
  margin-bottom: 12px;
}

.mega-menu-column.right ul li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  color: #333;
  text-decoration: none;
  font-size: 16px;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.mega-menu-column.right ul li a:hover {
  color: #0755E9;
  border-bottom-color: rgba(7, 85, 233, 0.1);
}

.mega-menu-column.right ul li a i {
  font-size: 12px;
  opacity: 0.3;
}

/* Responsive Hide for Mobile */
@media (max-width: 991px) {
  .mega-menu {
    display: none !important;
  }
}