/*
 * Custom Mobile Menu Styles
 * Ensures parent pages are always clickable with separate submenu toggles
 */

/* Hide custom mobile menu on desktop */
@media (min-width: 992px) {
  .custom-mobile-menu,
  .custom-mobile-menu-trigger {
    display: none !important;
  }
}

/* Mobile menu styles (mobile only) */
@media (max-width: 991.98px) {
  /* Mobile menu trigger button */
  .custom-mobile-menu-trigger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 10000;
    margin-left: auto; /* Push to right side */
  }
  
  .custom-mobile-menu-trigger .hamburger-line {
    width: 24px;
    height: 2px;
    background-color: #333333;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
  }
  
  .custom-mobile-menu-trigger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .custom-mobile-menu-trigger.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  
  .custom-mobile-menu-trigger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }

  /* Hide default Bootstrap navbar toggle on mobile */
  .navbar-toggler {
    display: none !important;
  }

  /* Hide default navbar collapse on mobile */
  .navbar-collapse {
    display: none !important;
  }

  /* Custom mobile menu container */
  .custom-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
  }
  
  .custom-mobile-menu.active {
    visibility: visible;
    opacity: 1;
  }
  
  /* Overlay background */
  .mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
  }
  
  /* Menu container - dropdown from top */
  .mobile-menu-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 100vh;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .custom-mobile-menu.active .mobile-menu-container {
    transform: translateY(0);
  }
  
  /* Menu header with close button */
  .mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  .mobile-menu-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #333333;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
  }
  
  .mobile-menu-close:hover {
    color: #6aa433;
  }
  
  /* Navigation container */
  .mobile-menu-nav {
    padding: 0;
  }
  
  /* Main menu list */
  .mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  /* Menu item container */
  .mobile-menu-item {
    border-bottom: 1px solid #e0e0e0;
    position: relative;
  }
  
  .mobile-menu-item:last-child {
    border-bottom: none;
  }
  
  /* Parent menu items with children */
  .mobile-menu-item.has-children {
    display: flex;
    flex-direction: column;
  }
  
  .mobile-menu-item.has-children > .mobile-menu-link {
    flex: 1;
    border-right: 1px solid #e0e0e0;
  }
  
  .mobile-menu-item.has-children .mobile-menu-link,
  .mobile-menu-item.has-children .submenu-toggle {
    display: inline-flex;
    align-items: center;
  }
  
  /* Parent link takes most of the space */
  .mobile-menu-item.has-children .mobile-menu-link {
    flex: 1;
    padding-right: 60px;
  }
  
  /* Toggle button positioned absolutely */
  .mobile-menu-item.has-children .submenu-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60px;
    background: transparent;
    border: none;
    border-left: 1px solid #e0e0e0;
    cursor: pointer;
    font-size: 20px;
    color: #333333;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  
  .mobile-menu-item.has-children .submenu-toggle:hover {
    background: #f8f9fa;
    color: #6aa433;
  }
  
  .mobile-menu-item.has-children .submenu-toggle[aria-expanded="true"] {
    background: #6aa433;
    color: white;
  }
  
  .mobile-menu-item.has-children .submenu-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(45deg);
  }
  
  .mobile-menu-item.has-children .submenu-toggle .toggle-icon {
    transition: transform 0.2s ease;
    font-weight: bold;
  }
  
  /* Parent menu links */
  .mobile-menu-link {
    display: block;
    padding: 16px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  
  .mobile-menu-link:hover {
    background: #f8f9fa;
    color: #6aa433;
    text-decoration: none;
  }
  
  .mobile-menu-link.parent-link {
    min-height: 56px;
    display: flex;
    align-items: center;
  }
  
  /* Submenu container */
  .mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .mobile-submenu.expanded {
    max-height: 500px;
  }
  
  /* Submenu items */
  .mobile-submenu-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .mobile-submenu-item:last-child {
    border-bottom: none;
  }
  
  /* Submenu links */
  .mobile-submenu-link {
    display: block;
    padding: 12px 20px 12px 40px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  
  .mobile-submenu-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #6aa433;
    text-decoration: none;
  }
  
  /* Prevent body scroll when mobile menu is open */
  body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}
