/*!
 * Mobile Menu System for existing #menu structure
 * Works with the current menu CSS without breaking desktop
 */

/* ========================================
   MOBILE HAMBURGER MENU
   ONLY affects screens ≤767px
   ======================================== */

@media screen and (max-width: 767px) {

  /* Mobile menu container adjustments */
  #menu {
    width: 100% !important;
    margin: 0 !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    box-sizing: border-box;
    background: linear-gradient(to bottom, #FFFFFF, #FAFAFA);
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    z-index: 9999;
  }

  /* Logo in navbar */
  #menu .navbar-logo {
    display: block;
    max-width: 91% !important;
    overflow: hidden;
    transition: transform 0.3s ease;
  }

  #menu .navbar-logo img {
    max-width: 100% !important;
    height: auto !important;
    width: 100% !important;
  }

  /* Hide the regular menu on mobile initially */
  #menu ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    background: #FFF;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin: 0 !important;
    margin-left: -10px !important;
    padding: 0 !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Show menu when active */
  #menu.menu-active ul {
    display: block;
  }

  /* Mobile menu items */
  #menu li {
    float: none !important;
    margin: 0 !important;
    display: block;
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
  }

  #menu li:last-child {
    border-bottom: none;
  }

  #menu li a {
    display: block;
    padding: 15px 20px;
    font-size: 16px;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    color: #333;
  }

  #menu li a:hover {
    background-color: rgba(172, 20, 41, 0.05);
    border-left-color: #AC1429;
    color: #AC1429;
    padding-left: 25px;
  }

  /* Hamburger button */
  .menu-toggle {
    display: block;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    transition: all 0.3s ease;
  }

  .menu-toggle:hover {
    transform: translateY(-50%) scale(1.1);
  }

  /* Hamburger lines */
  .menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: linear-gradient(135deg, #AC1429, #C23750);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(172, 20, 41, 0.3);
  }

  /* Active hamburger animation */
  .menu-toggle.active {
    transform: translateY(-50%);
  }

  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }

  /* Add some space for the hamburger button */
  #menu {
    padding-right: 60px;
  }

}

/* ========================================
   DESKTOP PRESERVATION
   Ensure desktop menu works normally
   ======================================== */

@media screen and (min-width: 768px) {
  
  /* Hide mobile elements on desktop */
  .menu-toggle {
    display: none;
  }

  /* Ensure desktop menu works normally */
  #menu ul {
    display: block !important;
  }

  #menu li {
    float: left;
  }

}