/**
 * Mobile Menu - Complete System
 * 
 * All mobile menu related CSS in one file for easy management
 * Includes: Toggle button, Menu container, Overlay, Accordion submenu
 * 
 * @package YenSao_Premium
 */

/* ========== HIDE ON DESKTOP (>992px) ========== */
@media (min-width: 993px) {
  .mobile-menu-toggle,
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-menu-close {
    display: none !important;
  }
}

/* ========== MOBILE MENU SYSTEM (≤992px) ========== */
@media (max-width: 992px) {
  
  /* ===== MOBILE MENU TOGGLE BUTTON ===== */
  .mobile-menu-toggle {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--color-stone-200, #e7e5e4);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-stone-700, #44403c);
  }

  .mobile-menu-toggle i {
    font-size: 1.25rem;
    line-height: 1;
  }

  .mobile-menu-toggle:hover {
    background: var(--color-stone-50, #fafaf9);
    border-color: var(--color-champagne, #c8a75a);
    color: var(--color-champagne, #c8a75a);
  }

  .mobile-menu-toggle:active {
    transform: scale(0.95);
  }

  .mobile-menu-toggle.active {
    background: var(--color-champagne, #c8a75a);
    color: white;
    border-color: var(--color-champagne, #c8a75a);
  }

  /* ===== MOBILE MENU CONTAINER ===== */
  .mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: var(--color-white, #ffffff);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    overflow-y: auto;
    padding: 1.5rem 0;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
  }

  .mobile-menu.active {
    transform: translateX(0) !important;
  }

  /* ===== MOBILE MENU CLOSE BUTTON ===== */
  .mobile-menu-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: var(--color-stone-100, #f5f5f4);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-stone-600, #57534e);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
  }

  .mobile-menu-close:hover {
    background: var(--color-stone-200, #e7e5e4);
    color: var(--color-stone-900, #1c1917);
  }

  .mobile-menu-close:active {
    transform: scale(0.9);
  }

  /* ===== MENU HEADER ===== */
  .mobile-menu::before {
    content: 'Menu';
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-stone-900, #1c1917);
    padding: 0 1.5rem 1rem;
    border-bottom: 2px solid var(--color-stone-200, #e7e5e4);
    margin-bottom: 1rem;
  }

  /* ===== MENU LIST RESET ===== */
  /* Reset WordPress menu styles */
  .mobile-menu ul,
  .mobile-menu #mobile-primary-menu {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  /* ===== TOP LEVEL MENU ITEMS ===== */
  /* ===== TOP LEVEL MENU ITEMS ===== */
  /* All menu items */
  .mobile-menu li {
    margin: 0;
    padding: 0;
    /* Ensure normal flow layout, not absolute */
    position: static !important;
  }

  /* ===== MENU LINKS ===== */
  /* All links and dropdown triggers */
  .mobile-menu a,
  .mobile-menu .dropArrow {
    display: block;
    line-height: 2.5em;
    color: var(--color-stone-700, #44403c);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
    cursor: pointer;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    font-size: 0.938rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: left;
  }

  /* Hover effect */
  .mobile-menu a:hover,
  .mobile-menu .dropArrow:hover {
    color: var(--color-amber-700, #b45309);
    background: var(--color-amber-50, #fff8e5);
  }

  /* Active dropdown arrow */
  .mobile-menu .dropArrow.active {
    color: var(--color-champagne, #c8a75a);
    background: var(--color-amber-50, #fff8e5);
  }

  /* ===== DROPDOWN ARROW INDICATOR ===== */
  /* Arrow indicator for dropdown items */
  .mobile-menu .dropArrow::after {
    content: '\f067'; /* FontAwesome plus icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--color-stone-400, #a8a29e);
    transition: transform 0.3s ease, color 0.3s ease;
  }

  /* Rotate arrow when active */
  .mobile-menu .dropArrow.active::after {
    transform: translateY(-50%) rotate(45deg);
    color: var(--color-champagne, #c8a75a);
  }

  /* ===== SUBMENU (ACCORDION) ===== */
  /* Submenu styling */
  .mobile-menu .sub-menu {
    display: none; /* Hidden by default, controlled by jQuery slideDown/Up */
    background: var(--color-stone-100, #f5f5f4);
    padding: 0;
    margin: 0;
    /* Override desktop menu absolute positioning */
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: auto !important;
    left: auto !important;
    top: auto !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 3px solid var(--color-champagne, #c8a75a);
  }

  /* Submenu items */
  .mobile-menu .sub-menu li {
    margin: 0;
  }

  /* Submenu links */
  .mobile-menu .sub-menu a {
    padding-left: 2.5rem;
    font-size: 0.875rem;
    color: var(--color-stone-700, #44403c);
    line-height: 2.2em;
    font-weight: 500;
  }

  .mobile-menu .sub-menu a:hover {
    color: var(--color-amber-700, #b45309);
    background: var(--color-amber-50, #fff8e5);
  }

  /* Nested submenu (if needed) */
  .mobile-menu .sub-menu .sub-menu {
    background: var(--color-stone-200, #e7e5e4);
    border-left: 3px solid var(--color-amber-700, #b45309);
  }

  .mobile-menu .sub-menu .sub-menu a {
    padding-left: 3.5rem;
    font-size: 0.813rem;
    color: var(--color-stone-800, #292524);
  }

  /* ===== MOBILE MENU OVERLAY ===== */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 997;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
  }

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

  /* ===== CUSTOM SCROLLBAR ===== */
  /* Scrollbar styling for light theme */
  .mobile-menu::-webkit-scrollbar {
    width: 6px;
  }

  .mobile-menu::-webkit-scrollbar-track {
    background: var(--color-stone-100, #f5f5f4);
  }

  .mobile-menu::-webkit-scrollbar-thumb {
    background: var(--color-stone-300, #d6d3d1);
    border-radius: 3px;
  }

  .mobile-menu::-webkit-scrollbar-thumb:hover {
    background: var(--color-stone-400, #a8a29e);
  }

}

/* ========== SMALL MOBILE (≤480px) ========== */
@media (max-width: 480px) {
  .mobile-menu {
    width: 90%;
  }

  .mobile-menu a,
  .mobile-menu .dropArrow {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mobile-menu .dropArrow::after {
    right: 1rem;
  }

  .mobile-menu .sub-menu a {
    padding-left: 2rem;
  }

  .mobile-menu .sub-menu .sub-menu a {
    padding-left: 3rem;
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-menu a,
  .mobile-menu .dropArrow {
    transition: none;
  }
}
