/* Mobile Menu Backdrop - Hidden by default */
.mobile-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  z-index: 1049;
}

.mobile-menu-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile Menu Overlay - Hidden by default (off-screen to the right) */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 400px;
  height: 100vh;
  background-color: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1050;
  transition: right 0.3s ease-in-out;
  overflow-y: auto;
}

.mobile-menu-overlay.active {
  right: 0;
}

.mobile-menu-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #333;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-close:hover {
  color: #000;
}

.mobile-menu-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.mobile-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-list li {
  border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-list a {
  display: block;
  padding: 1rem 1.5rem;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.mobile-menu-list a:hover {
  background-color: #f8f9fa;
  color: #3d50f5;
}

/* Nested menu items - always visible */
.mobile-menu-list .nested-menu {
  display: block;
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: #f8f9fa;
}

.mobile-menu-list .nested-menu li {
  border-bottom: none;
  border-top: 1px solid #e9ecef;
}

.mobile-menu-list .nested-menu a {
  padding-left: 2.5rem;
  font-weight: 400;
  font-size: 0.95rem;
}

/* Additional nesting levels */
.mobile-menu-list .nested-menu .nested-menu a {
  padding-left: 3.5rem;
}

.mobile-menu-list .nested-menu .nested-menu .nested-menu a {
  padding-left: 4.5rem;
}

/* Desktop Menu Styles */
#desktopMenu .nav-item {
  position: relative;
}

#desktopMenu .nav-link {
  padding: 0.5rem 1rem;
  color: #333;
  font-weight: 500;
  transition: color 0.2s ease;
}

#desktopMenu .nav-link:hover {
  color: #3d50f5;
}

#desktopMenu .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  padding: 0.5rem 0;
  z-index: 1000;
}

#desktopMenu .nav-item:hover .dropdown-menu {
  display: block;
}

#desktopMenu .dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  color: #333;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#desktopMenu .dropdown-item:hover {
  background-color: #f8f9fa;
  color: #3d50f5;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
  border: 1px solid #dee2e6;
  padding: 0.375rem 0.75rem;
  margin-left: auto;
  background-color: transparent;
  cursor: pointer;
}

.mobile-menu-toggle:hover {
  background-color: #f8f9fa;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  /* Hide desktop menu on mobile */
  .navbar-collapse {
    display: none !important;
  }
  
  /* Show mobile menu toggle button */
  .mobile-menu-toggle {
    display: block !important;
  }
  
  /* Mobile menu overlay and backdrop are always in DOM but positioned off-screen when inactive */
  .mobile-menu-overlay {
    display: block !important;
  }
  
  .mobile-menu-backdrop {
    display: block !important;
  }
}

@media (min-width: 992px) {
  /* Hide mobile menu toggle on desktop */
  .mobile-menu-toggle {
    display: none !important;
  }
  
  /* Completely hide mobile menu elements on desktop */
  .mobile-menu-overlay {
    display: none !important;
  }
  
  .mobile-menu-backdrop {
    display: none !important;
  }
  
  /* Show desktop menu */
  .navbar-collapse {
    display: flex !important;
  }
}
