/**
 * Mobile Menu Redesign - Full-Screen Slide-In Menu
 * Colors: #2077ba (title), #ffbe5f, #f9b33b, #2c91ce
 * Background: White
 */

/* ============================================
   MOBILE MENU REDESIGN - FULL OVERRIDE
   This file MUST load after custom-style.css
   ============================================ */

/* Reset conflicting styles from custom-style.css */
@media (max-width: 1199px) {
    /* Override old mobile menu positioning - CRITICAL: must override custom-style.css line 646 */
    #access .menu,
    #access ul.menu,
    #menu-primary-menu-1 {
        right: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        position: relative !important;
        padding-top: 0 !important;
        z-index: 10 !important;
        transition: none !important;
    }
    
    #access .menu.menu-slide {
        right: auto !important;
    }
    
    /* Reset old hamburger styles */
    #access a.menu-btn,
    #access .menu-btn {
        position: absolute !important;
        top: 50% !important;
        right: 0 !important;
        transform: translateY(-50%) !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
    }
    
    /* Override old menu item styles from custom-style.css */
    #access li a {
        border-bottom: none !important;
        color: #2077ba !important;
        margin: 0 !important;
    }
}

/* ============================================
   MOBILE MENU - ONLY ACTIVE ON MOBILE/TABLET
   ============================================ */
@media (max-width: 1199px) {

    /* ----------------------------------------
       HAMBURGER BUTTON (TRIGGER)
       ---------------------------------------- */
    #access .menu-btn,
    #access a.menu-btn {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 44px !important;
        height: 44px !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        position: absolute !important;
        top: 50% !important;
        right: 0 !important;
        transform: translateY(-50%) !important;
        background: transparent !important;
        border: none !important;
        padding: 8px !important;
        gap: 5px !important;
    }

    #access .menu-btn div,
    #access a.menu-btn div {
        width: 24px !important;
        height: 3px !important;
        background-color: #2077ba !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
        margin: 0 !important;
        position: static !important;
        top: auto !important;
        left: auto !important;
    }

    /* Hamburger animation when menu is open */
    #access .menu-btn.active div:nth-child(1),
    #access a.menu-btn.active div:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px) !important;
    }

    #access .menu-btn.active div:nth-child(2),
    #access a.menu-btn.active div:nth-child(2) {
        opacity: 0 !important;
    }

    #access .menu-btn.active div:nth-child(3),
    #access a.menu-btn.active div:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px) !important;
    }

    /* ----------------------------------------
       OVERLAY (BACKDROP) - Must be BELOW the menu (z-index 10001)
       Light semi-transparent overlay that fades in smoothly
       ---------------------------------------- */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.25); /* Light overlay - page structure remains visible */
        z-index: 10001; /* Below menu (10002) but above everything else */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.5s ease-out, visibility 0.5s ease-out; /* Slower fade for smooth feel */
        pointer-events: none;
    }

    .mobile-menu-overlay.active {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    /* ----------------------------------------
       MAIN MENU CONTAINER - Smooth slide-in + fade animation
       Combined movement and opacity transition for connected feel
       ---------------------------------------- */
    #access .header-menu,
    .header_wrapper #access .header-menu,
    .header-menu {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
        background: rgba(255, 255, 255, 0.98) !important;
        background-color: rgba(255, 255, 255, 0.98) !important;
        z-index: 10002 !important;
        /* Slower, smoother animation with ease-out for soft stop */
        transition: right 0.55s cubic-bezier(0.25, 0.1, 0.25, 1), 
                    opacity 0.5s ease-out,
                    transform 0.55s cubic-bezier(0.25, 0.1, 0.25, 1),
                    backdrop-filter 0.4s ease-out !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.08) !important; /* Subtle shadow initially */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 150px !important; /* Extra padding to ensure last menu items are visible above mobile browser UI */
        opacity: 0; /* Start fully invisible */
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        transform: translateX(0); /* Prepare for transform animation */
        will-change: right, opacity, transform; /* Optimize for animation */
    }

    #access .header-menu.active,
    .header_wrapper #access .header-menu.active,
    .header-menu.active {
        right: 0 !important;
        opacity: 1; /* Fully opaque at final position */
        background: #ffffff !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: -8px 0 35px rgba(0, 0, 0, 0.15) !important; /* Stronger shadow when open */
        transform: translateX(0);
    }

    /* Lock body scroll when menu is open */
    body.mobile-menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    /* ----------------------------------------
       MENU HEADER (LOGO + CLOSE)
       ---------------------------------------- */
    .mobile-menu-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid #e8e8e8;
        background: #ffffff;
        position: sticky;
        top: 0;
        z-index: 10;
        min-height: 60px;
        flex-shrink: 0;
    }

    .mobile-menu-logo {
        display: flex;
        align-items: center;
    }

    .mobile-menu-logo img {
        max-height: 36px;
        width: auto;
    }

    /* Hide original close button from HTML */
    #access > .header-menu > a.menu-close-btn,
    .header-menu > a.menu-close-btn {
        display: none !important;
    }

    /* Close Button (X) - Blue circle with white X */
    .mobile-menu-header .menu-close-btn,
    .menu-close-btn.mobile-menu-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        position: relative;
        background: #2077ba;
        border: none;
        border-radius: 50%;
        transition: background-color 0.2s ease, transform 0.2s ease;
        box-shadow: 0 2px 8px rgba(32, 119, 186, 0.3);
    }

    .menu-close-btn:hover,
    .menu-close-btn:active {
        background-color: #1a6299;
        transform: scale(1.05);
    }

    .menu-close-btn div {
        position: absolute;
        width: 18px;
        height: 2px;
        background-color: #ffffff;
        border-radius: 2px;
        transition: background-color 0.2s ease;
    }

    .menu-close-btn div:first-child {
        transform: rotate(45deg);
    }

    .menu-close-btn div:last-child {
        transform: rotate(-45deg);
    }

    .mobile-menu-header .menu-close-btn:hover div,
    .mobile-menu-header .menu-close-btn:active div {
        background-color: #ffffff;
    }

    /* ----------------------------------------
       MENU LIST CONTAINER
       ---------------------------------------- */
    #access ul.menu,
    .header-menu ul.menu {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        margin-bottom: 80px !important; /* Extra space at bottom for last items */
        flex: 1;
        display: flex !important;
        flex-direction: column !important;
    }

    /* ----------------------------------------
       FIRST LEVEL MENU ITEMS
       ---------------------------------------- */
    #access ul.menu > li,
    .header-menu ul.menu > li {
        border-bottom: 1px solid #f0f0f0 !important;
        position: relative !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        float: none !important;
        width: 100% !important;
    }

    /* Menu item link wrapper */
    #access ul.menu > li > a,
    #access ul.menu > li > .header_sub_link > a,
    .header-menu ul.menu > li > a,
    .header-menu ul.menu > li > .header_sub_link > a {
        display: block !important;
        padding: 18px 60px 18px 20px !important;
        color: #2077ba !important;
        font-weight: 500 !important;
        font-size: 17px !important;
        text-decoration: none !important;
        transition: background-color 0.2s ease, color 0.2s ease !important;
        line-height: 1.4 !important;
        position: relative !important;
    }

    /* Hover/Active state for menu items */
    #access ul.menu > li > a:hover,
    #access ul.menu > li > a:active,
    #access ul.menu > li > .header_sub_link > a:hover,
    #access ul.menu > li > .header_sub_link > a:active {
        background-color: rgba(32, 119, 186, 0.05) !important;
        color: #2c91ce !important;
    }

    /* Header sub link wrapper (for items with children) */
    #access ul.menu > li > .header_sub_link,
    .header-menu ul.menu > li > .header_sub_link {
        display: flex !important;
        align-items: stretch !important;
        position: relative !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #access ul.menu > li > .header_sub_link > a {
        flex: 1 !important;
    }

    /* ----------------------------------------
       EXPAND/COLLAPSE TOGGLE (+/-)
       ---------------------------------------- */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 54px;
        min-height: 54px;
        cursor: pointer;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        background: transparent;
        border: none;
        border-left: 1px solid #f0f0f0;
        transition: background-color 0.2s ease;
        z-index: 5;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:active {
        background-color: rgba(249, 179, 59, 0.1);
    }

    /* Plus/Minus Icon */
    .mobile-menu-toggle::before,
    .mobile-menu-toggle::after {
        content: '';
        position: absolute;
        background-color: #f9b33b;
        transition: transform 0.3s ease, background-color 0.2s ease;
    }

    /* Horizontal line (always visible) */
    .mobile-menu-toggle::before {
        width: 14px;
        height: 2px;
    }

    /* Vertical line (hidden when expanded) */
    .mobile-menu-toggle::after {
        width: 2px;
        height: 14px;
    }

    /* Minus state (when expanded) */
    .mobile-menu-toggle.expanded::after {
        transform: rotate(90deg);
        opacity: 0;
    }

    .mobile-menu-toggle.expanded::before,
    .mobile-menu-toggle.expanded::after {
        background-color: #2c91ce;
    }

    /* Hide default arrow icons */
    #access ul.menu > li .header_down_arrow,
    .header-menu ul.menu > li .header_down_arrow {
        display: none !important;
    }

    /* ----------------------------------------
       SUB-MENU (SECOND LEVEL)
       Override custom-style.css line 655: #access ul ul { height: 0px; }
       ---------------------------------------- */
    #access ul.sub-menu,
    .header-menu ul.sub-menu,
    #access ul ul {
        display: none !important;
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        overflow: hidden;
        /* Reset problematic styles from custom-style.css */
        position: relative !important;
        left: 0 !important;
        right: auto !important;
        top: auto !important;
        width: 100% !important;
    }

    /* Expanded state - MUST override custom-style.css line 655 which sets height: 0px */
    #access ul.menu > li.submenu-open > ul.sub-menu,
    .header-menu ul.menu > li.submenu-open > ul.sub-menu,
    #access ul ul.sub-menu.submenu-open,
    #access li.submenu-open > ul,
    #access li.submenu-open > ul.sub-menu,
    .header-menu li.submenu-open > ul.sub-menu {
        display: block !important;
        height: auto !important;
        max-height: 500px !important;
        overflow-y: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        animation: slideDown 0.3s ease forwards;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            max-height: 0;
        }
        to {
            opacity: 1;
            max-height: 500px;
        }
    }

    /* Sub-menu items */
    #access ul.sub-menu > li,
    .header-menu ul.sub-menu > li {
        border-bottom: 1px solid #e8e8e8 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #access ul.sub-menu > li:last-child,
    .header-menu ul.sub-menu > li:last-child {
        border-bottom: none !important;
    }

    /* Sub-menu links */
    #access ul.sub-menu > li > a,
    .header-menu ul.sub-menu > li > a {
        display: block !important;
        padding: 14px 20px 14px 36px !important;
        color: #2077ba !important;
        font-weight: 500 !important;
        font-size: 15px !important;
        text-decoration: none !important;
        transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease !important;
        position: relative !important;
        line-height: 1.4 !important;
        background: white !important;
    }

    /* Indent indicator */
    #access ul.sub-menu > li > a::before,
    .header-menu ul.sub-menu > li > a::before {
        content: '';
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #ffbe5f;
        transition: background-color 0.2s ease;
    }

    /* Sub-menu hover state */
    #access ul.sub-menu > li > a:hover,
    #access ul.sub-menu > li > a:active,
    .header-menu ul.sub-menu > li > a:hover,
    .header-menu ul.sub-menu > li > a:active {
        background-color: rgba(249, 179, 59, 0.1) !important;
        color: #2077ba !important;
        padding-left: 42px !important;
    }

    #access ul.sub-menu > li > a:hover::before,
    #access ul.sub-menu > li > a:active::before {
        background-color: #2077ba;
    }

    /* ----------------------------------------
       MOBILE AUTH BUTTONS (SIGN IN/UP)
       NOTE: Disabled - auth buttons already exist in header top bar
       ---------------------------------------- */
    .mobile-auth-section {
        display: none !important;
    }

    .mobile-auth-buttons {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-auth-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 20px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 15px;
        text-decoration: none !important;
        text-align: center;
        transition: all 0.2s ease;
        min-height: 48px;
    }

    .mobile-auth-btn.signin {
        background: transparent;
        border: 2px solid #2077ba;
        color: #2077ba !important;
    }

    .mobile-auth-btn.signin:hover,
    .mobile-auth-btn.signin:active {
        background: #2077ba;
        color: #ffffff !important;
    }

    .mobile-auth-btn.signup {
        background: linear-gradient(135deg, #f9b33b 0%, #ffbe5f 100%);
        border: 2px solid transparent;
        color: #ffffff !important;
    }

    .mobile-auth-btn.signup:hover,
    .mobile-auth-btn.signup:active {
        background: linear-gradient(135deg, #e5a235 0%, #f0b050 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(249, 179, 59, 0.3);
    }

    /* ----------------------------------------
       LANGUAGE SELECTOR IN MOBILE MENU
       NOTE: Disabled - using header language selector instead
       ---------------------------------------- */
    .mobile-language-section {
        display: none !important;
    }

    .mobile-language-section label {
        display: none !important;
        font-size: 12px;
        font-weight: 600;
        color: #888888;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
    }

    .mobile-language-section select {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        color: #333333;
        background: #ffffff;
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232077ba' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
    }

    .mobile-language-section select:focus {
        outline: none;
        border-color: #2077ba;
        box-shadow: 0 0 0 3px rgba(32, 119, 186, 0.1);
    }

    /* ----------------------------------------
       VISUAL FEEDBACK ON TAP
       ---------------------------------------- */
    #access ul.menu > li > a:active,
    #access ul.menu > li > .header_sub_link > a:active,
    #access ul.sub-menu > li > a:active,
    .mobile-menu-toggle:active {
        transform: scale(0.98);
    }

    /* ----------------------------------------
       HIDE DESKTOP ELEMENTS ON MOBILE - CRITICAL
       The mega-menu-container causes a gray overlay issue
       Must override .destinations-menu.active .mega-menu-container rules
       NOTE: Only hide .mega-menu-container, NOT the parent li.destinations-menu
       ---------------------------------------- */
    .mega-menu-container,
    .destinations-mega-menu,
    div.mega-menu,
    .mega-menu-inner,
    .mega-menu-column,
    .mega-menu-title,
    .explore-menu,
    .mega-menu-list,
    #select-area-content,
    .destinations-menu .mega-menu-container,
    .destinations-menu.active .mega-menu-container,
    #access .mega-menu-container,
    .header-menu .mega-menu-container,
    .header-menu div.mega-menu,
    .header-menu .mega-menu-inner,
    ul.menu .mega-menu-container,
    ul.menu div.mega-menu,
    li.destinations-menu .mega-menu-container,
    li.destinations-menu.active .mega-menu-container,
    li.mega-menu .mega-menu-container,
    li.destinations-menu > .mega-menu-container,
    li.mega-menu > .mega-menu-container,
    .header-menu .destinations-menu.active .mega-menu-container,
    #access .destinations-menu.active .mega-menu-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        max-height: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
    }
    
    /* Hide any overlay elements that might interfere */
    .header-menu::before,
    .header-menu::after,
    #access .menu::before,
    #access .menu::after {
        display: none !important;
    }
    
    /* Ensure menu content is above any overlays */
    .header-menu ul.menu {
        position: relative !important;
        z-index: 10 !important;
        background: #ffffff !important;
    }
    
    .header-menu ul.menu > li {
        background: #ffffff !important;
    }
    
    /* Ensure destinations menu item shows as simple link on mobile */
    #access ul.menu > li.destinations-menu,
    .header-menu ul.menu > li.destinations-menu,
    .header-menu li.destinations-menu,
    .header-menu li.mega-menu,
    ul#menu-primary-menu-1 > li.destinations-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: #ffffff !important;
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
    }
    
    #access ul.menu > li.destinations-menu > a,
    .header-menu ul.menu > li.destinations-menu > a,
    .header-menu li.destinations-menu > a,
    .header-menu li.mega-menu > a,
    .header-menu li.destinations-menu > a.destinations-link,
    .header-menu li.destinations-menu > a.menu-item-link,
    ul#menu-primary-menu-1 > li.destinations-menu > a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 16px 20px !important;
        color: #2077ba !important;
        font-weight: 500 !important;
        font-size: 16px !important;
        text-decoration: none !important;
        border-bottom: 1px solid #e8e8e8 !important;
        height: auto !important;
        width: 100% !important;
    }
    
    /* Ensure the span inside destinations link is visible */
    .header-menu li.destinations-menu > a span,
    .header-menu li.destinations-menu > a .mega-menu-destinations,
    #access li.destinations-menu > a span,
    #access li.destinations-menu > a .mega-menu-destinations {
        display: inline !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #2077ba !important;
    }

    /* Hide mobile search form in menu if exists */
    #access ul.menu > li > form,
    #access ul.menu > li > select {
        display: none !important;
    }

    /* ----------------------------------------
       SCROLLBAR STYLING
       ---------------------------------------- */
    .header-menu::-webkit-scrollbar {
        width: 4px;
    }

    .header-menu::-webkit-scrollbar-track {
        background: #f0f0f0;
    }

    .header-menu::-webkit-scrollbar-thumb {
        background: #cccccc;
        border-radius: 4px;
    }

    .header-menu::-webkit-scrollbar-thumb:hover {
        background: #aaaaaa;
    }

}

/* ============================================
   DESKTOP - HIDE MOBILE ELEMENTS
   ============================================ */
@media (min-width: 1200px) {
    .mobile-menu-overlay,
    .mobile-menu-header,
    .mobile-auth-section,
    .mobile-language-section,
    .mobile-menu-toggle {
        display: none !important;
    }

    /* Ensure desktop menu displays normally */
    .header-menu {
        position: static !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        transform: none !important;
        right: auto !important;
    }

    #access ul.menu {
        display: flex !important;
        flex-direction: row !important;
    }

    #access ul.menu > li {
        border-bottom: none !important;
    }

    /* Show default arrow on desktop */
    #access ul.menu > li .header_down_arrow {
        display: inline-block !important;
    }
}

/* ============================================
   ACCESSIBILITY & FOCUS STATES
   ============================================ */
@media (max-width: 1199px) {
    .menu-btn:focus,
    .menu-close-btn:focus,
    .mobile-menu-toggle:focus,
    #access ul.menu > li > a:focus,
    #access ul.sub-menu > li > a:focus,
    .mobile-auth-btn:focus {
        outline: 2px solid #2077ba;
        outline-offset: 2px;
    }

    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        .header-menu,
        .mobile-menu-overlay,
        #access ul.sub-menu,
        .mobile-menu-toggle::before,
        .mobile-menu-toggle::after {
            transition: none !important;
            animation: none !important;
        }
    }
}
