.megamenu-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(37, 32, 41, 0.9);
  backdrop-filter: blur(10px);
}

.megamenu-container.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.megamenu {
  height: 90%;
  background: var(--shadow-color);
  display: flex;
  overflow: hidden;
  position: relative;
  width: 90%;
}

/* Level sections */
.megamenu-level {
  flex: 0 0 260px;
  background: var(--shadow-color);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  position: relative;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.megamenu-level.active {
  opacity: 1;
  visibility: visible;
}

/* Navigation lists */
.megamenu-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  height: 100vh;
}

.megamenu-item {
  position: relative;
  width: 320px;
  min-height: 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.megamenu-item:last-child {
  border-bottom: none;
}

.megamenu-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 320px;
  min-height: 60px;
  color: var(--light-color);
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  transition: all 0.3s ease;
  position: relative;
  background: transparent;
  letter-spacing: 0.03em;
  border: none;
  outline: none;
  margin: 0;
  padding: 0;
  /* Force proper capitalization */
  text-transform: capitalize !important;
  font-variant: normal;
}

.megamenu-link:hover,
.megamenu-link.active {
  background: var(--primary-color);
  color: var(--light-color);
}

.megamenu-link:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-color);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.megamenu-link:hover:before,
.megamenu-link.active:before {
  transform: scaleY(1);
}

.megamenu-link .chevron {
  position: absolute;
  right: 20px;
  opacity: 0.6;
  transition: all 0.3s ease;
  color: var(--light-color);
  font-size: 12px;
}

.megamenu-link:hover .chevron,
.megamenu-link.active .chevron {
  opacity: 1;
  color: var(--light-color);
}

/* Level 4 sub-items within level 3 */
.megamenu-sub-items {
  margin-top: 8px;
  padding-left: 20px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.megamenu-sub-item {
  position: relative;
  width: 280px;
  height: 45px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.megamenu-sub-item:last-child {
  border-bottom: none;
}

.megamenu-sub-link {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 280px;
  height: 45px;
  color: rgba(242, 245, 241, 0.8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 300;
  transition: all 0.3s ease;
  position: relative;
  background: transparent;
  letter-spacing: 0.02em;
  border: none;
  outline: none;
  margin: 0;
  padding: 0 15px;
  /* Force proper capitalization for sub-items */
  text-transform: capitalize !important;
  font-variant: normal;
}

.megamenu-sub-link:hover {
  background: rgba(0, 128, 129, 0.2);
  color: var(--light-color);
}

.megamenu-sub-link:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--secondary-color);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.megamenu-sub-link:hover:before {
  transform: scaleY(1);
}

/* Close button */
.megamenu-close {
  position: absolute;
  top: 25px;
  right: 25px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  z-index: 1001;
  transition: all 0.3s ease;
  overflow: hidden;
}

.megamenu-close-icon {
  position: relative;
  width: 30px;
  height: 30px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Create the X using pseudo-elements */
.megamenu-close-icon::before,
.megamenu-close-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 3px;
  background: var(--primary-color);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center;
}

.megamenu-close-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.megamenu-close-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Hover animations */
.megamenu-close:hover .megamenu-close-icon {
  transform: scale(1.2) rotate(180deg);
}

.megamenu-close:hover .megamenu-close-icon::before {
  background: var(--accent-red);
  width: 120%;
  height: 4px;
}

.megamenu-close:hover .megamenu-close-icon::after {
  background: var(--accent-red);
  width: 120%;
  height: 4px;
}

/* Active state animation */
.megamenu-close:active .megamenu-close-icon {
  transform: scale(0.8) rotate(270deg);
}

/* Pulse effect on hover */
.megamenu-close:hover::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(231, 76, 60, 0.3), transparent 70%);
  transform: translate(-50%, -50%);
  animation: megamenuClosePulse 1s infinite;
  z-index: -1;
}

@keyframes megamenuClosePulse {
  0% {
    width: 60px;
    height: 60px;
    opacity: 1;
  }
  100% {
    width: 100px;
    height: 100px;
    opacity: 0;
  }
}

/* Empty state for levels */
.megamenu-level-empty {
  width: 320px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(242, 245, 241, 0.6);
  font-style: italic;
  font-size: 14px;
  text-align: center;
}

/* Loading State */
.megamenu-loading {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--light-color);
  font-size: 16px;
  background: var(--shadow-color);
}

.megamenu-loading:after {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: megamenuSpin 1s linear infinite;
  margin: 15px auto 0;
}

@keyframes megamenuSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Error State */
.megamenu-error {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-red);
  font-size: 16px;
  background: var(--shadow-color);
  font-weight: 500;
}

/* Megamenu Description Section */
.megamenu-description {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.megamenu-description::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.megamenu-image {
  position: relative;
  width: 400px;
  height: 400px;
  margin-bottom: 30px;
  z-index: 2;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.megamenu-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.4s ease;
  border-radius: 12px;
}

.megamenu-text {
  z-index: 2;
  max-width: 400px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.megamenu-text.visible {
  opacity: 1;
  transform: translateY(0);
}

.megamenu-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--light-color);
  margin: 0 0 15px 0;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  position: relative;
}

.megamenu-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 2px;
  opacity: 0;
  transition: all 0.4s ease;
}

.megamenu-text.visible .megamenu-title::after {
  opacity: 1;
}

.megamenu-description-text {
  font-size: 15px;
  font-weight: 300;
  color: rgba(242, 245, 241, 0.8);
  line-height: 1.6;
  margin: 0;
  letter-spacing: 0.01em;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-delay: 0.2s;
}

.megamenu-text.visible .megamenu-description-text {
  opacity: 1;
}

/* Default state - show placeholder */
.megamenu-description.empty .megamenu-image {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.megamenu-description.empty .megamenu-image::before {
  content: "";
  width: 60px;
  height: 60px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='rgba(255,255,255,0.3)' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E")
    no-repeat center;
  background-size: contain;
}

.megamenu-description.empty .megamenu-image img {
  display: none;
}

/* Loading animation */
.megamenu-description.loading .megamenu-image {
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.megamenu-description.loading .megamenu-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: megamenuImageLoading 1.5s infinite;
}

@keyframes megamenuImageLoading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .megamenu-description {
    padding: 30px 20px;
  }

  .megamenu-image {
    width: 150px;
    height: 150px;
    margin-bottom: 20px;
  }

  .megamenu-title {
    font-size: 20px;
  }

  .megamenu-description-text {
    font-size: 14px;
  }

  .megamenu-text {
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .megamenu-description {
    padding: 20px 15px;
  }

  .megamenu-image {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
  }

  .megamenu-title {
    font-size: 18px;
  }

  .megamenu-description-text {
    font-size: 13px;
  }

  .megamenu-text {
    max-width: 250px;
  }
}

/* Animation delays for better UX */
.megamenu-level:nth-child(1) {
  transition-delay: 0ms;
}
.megamenu-level:nth-child(2) {
  transition-delay: 80ms;
}
.megamenu-level:nth-child(3) {
  transition-delay: 160ms;
}
.megamenu-level:nth-child(4) {
  transition-delay: 240ms;
}

/* Custom scrollbar styling */
.megamenu-level::-webkit-scrollbar {
  width: 4px;
}

.megamenu-level::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.megamenu-level::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 2px;
}

.megamenu-level::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* Firefox scrollbar */
.megamenu-level {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0.05);
}

/* Ensure proper stacking */
.megamenu-container * {
  max-width: 100%;
  max-height: 100%;
}

/* Hover indicators */
.megamenu-item:hover {
  background: rgba(0, 128, 129, 0.1);
}

/* Item animations */
.megamenu-item {
  transition: all 0.2s ease;
}

.megamenu-item:hover .megamenu-link {
  transform: none;
}

/* Clean separation lines */
.megamenu-item:not(:last-child):after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 25px;
  right: 25px;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}
