/* ========================================
   MOBILE MENU - Premium Parent Level Design
   ======================================== */

:root {
    --mobile-menu-width: 85%;
    --mobile-menu-max-width: 360px;
}

/* Mobile Menu Toggle Button */
.nlh-mobile-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #333333;
}

.nlh-hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
}

.nlh-hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: #333333;
    transition: all 0.3s ease;
}

.nlh-menu-text {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Mobile Menu Overlay */
.nlh-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nlh-mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Panel */
.nlh-mobile-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--mobile-menu-width);
    max-width: var(--mobile-menu-max-width);
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nlh-mobile-menu-panel.active {
    transform: translateX(0);
}

/* Mobile Menu Header */
.nlh-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #1a1a1a;
    color: #ffffff;
    border-bottom: 2px solid var(--theme-color, #dc3545);
}

.nlh-mobile-menu-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nlh-mobile-menu-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nlh-mobile-menu-close:hover {
    color: var(--theme-color, #dc3545);
}

/* Mobile Menu Content */
.nlh-mobile-menu-content {
    padding: 0;
}

.nlh-mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Mobile Menu Items - Consistent Premium Styling */
.nlh-mobile-menu-item {
    border-bottom: 1px solid #eaeaea;
}

.nlh-mobile-menu-item:first-child {
    border-top: none;
}

.nlh-mobile-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.nlh-mobile-menu-link:hover,
.nlh-mobile-menu-link:active {
    background: #f8f8f8;
    color: var(--theme-color, #dc3545);
}

.nlh-mobile-menu-arrow {
    font-size: 22px;
    color: #999999;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nlh-mobile-menu-link:hover .nlh-mobile-menu-arrow {
    color: var(--theme-color, #dc3545);
    transform: translateX(2px);
}

/* Vehicle Selector - Subtle premium treatment */
.nlh-mobile-vehicle-select .nlh-mobile-menu-link {
    font-weight: 600;
}

.nlh-mobile-vehicle-select .nlh-mobile-menu-arrow {
    color: var(--theme-color, #dc3545);
}

/* Submenu Styling */
.nlh-mobile-submenu {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--mobile-menu-width);
    max-width: var(--mobile-menu-max-width);
    height: 100%;
    background: #ffffff;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Categories submenu - must match panel width exactly */
.nlh-mobile-categories-submenu {
    width: 100vw !important;
    max-width: var(--mobile-menu-max-width) !important;
}

.nlh-mobile-submenu.active {
    transform: translateX(0);
}

/* Submenu Back Button */
.nlh-mobile-submenu-back {
    background: var(--theme-color, #dc3545);
    border: none;
    margin: 0;
    padding: 0;
}

.nlh-mobile-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--theme-color, #dc3545);
    border: none;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
    text-transform: uppercase;
}

.nlh-mobile-back-btn:hover {
    background: #c82333;
}

.nlh-mobile-back-arrow {
    font-size: 22px;
    color: #ffffff;
}

/* Submenu Header */
.nlh-mobile-submenu-header {
    background: #1a1a1a;
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.nlh-mobile-submenu-header a,
.nlh-mobile-submenu-header a:link,
.nlh-mobile-submenu-header a:visited,
.nlh-mobile-submenu-header a:focus {
    display: block;
    padding: 14px 20px;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nlh-mobile-submenu-header a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Submenu Items */
.nlh-mobile-submenu-item {
    border-bottom: 1px solid #eaeaea;
}

.nlh-mobile-submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.2s ease, color 0.2s ease;
}

.nlh-mobile-submenu-link:hover,
.nlh-mobile-submenu-link:active {
    background: #f8f8f8;
    color: var(--theme-color, #dc3545);
}

.nlh-mobile-submenu-item.has-children .nlh-mobile-submenu-link {
    font-weight: 500;
}

.nlh-mobile-submenu-link .nlh-mobile-menu-arrow {
    font-size: 20px;
}

/* Children Submenu - Third Level */
.nlh-mobile-children-submenu {
    z-index: 10001;
}

/* Empty State */
.nlh-mobile-menu-empty {
    padding: 20px;
    text-align: center;
    color: #999999;
    font-style: italic;
}

/* Prevent body scroll when menu open */
body.nlh-mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Show mobile menu only on mobile */
@media (max-width: 768px) {
    .nlh-mobile-menu-toggle {
        display: flex;
    }
}

/* Hide on desktop */
@media (min-width: 769px) {
    .nlh-mobile-menu {
        display: none !important;
    }
}

/* Larger mobile screens - slightly wider panel */
@media (min-width: 480px) and (max-width: 768px) {
    .nlh-mobile-menu-panel,
    .nlh-mobile-submenu {
        max-width: 380px;
    }
}

/* ========================================
   STICKY NAVIGATION FIX
   Back button and header stay fixed at top while scrolling
   ======================================== */
li.nlh-mobile-submenu-back {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
    background: var(--theme-color, #dc3545) !important;
    border: none !important;
}

li.nlh-mobile-submenu-back .nlh-mobile-back-btn {
    color: #ffffff;
    background: var(--theme-color, #dc3545);
    margin: 0;
}

li.nlh-mobile-submenu-back .nlh-mobile-back-arrow {
    color: #ffffff;
}

li.nlh-mobile-submenu-header {
    position: sticky;
    top: 47px; /* Must match back button height exactly */
    z-index: 9;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
    background: #1a1a1a !important;
    border: none !important;
}

/* Remove any gaps/borders between sticky elements */
.nlh-mobile-submenu > li.nlh-mobile-submenu-back,
.nlh-mobile-submenu > li.nlh-mobile-submenu-header {
    border: none !important;
    margin: 0 !important;
}

/* First item after header should have no top margin/border */
.nlh-mobile-submenu > li.nlh-mobile-submenu-header + li {
    border-top: none !important;
}

/* ========================================
   CHILD SUBMENU (Third Level) 
   Must completely overlay parent menu
   ======================================== */
.nlh-mobile-children-submenu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: var(--mobile-menu-max-width) !important;
    height: 100% !important;
    background: #ffffff !important;
    z-index: 10001 !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    /* Use flex layout for fixed header + scrollable content */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.nlh-mobile-children-submenu.active {
    transform: translateX(0) !important;
}

/* Fixed back button for child submenu - no scroll */
.nlh-mobile-children-submenu > li.nlh-mobile-submenu-back {
    position: relative !important;
    top: 0 !important;
    flex-shrink: 0 !important;
    background: var(--theme-color, #dc3545) !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Fixed header for child submenu - no scroll */
.nlh-mobile-children-submenu > li.nlh-mobile-submenu-header {
    position: relative !important;
    top: 0 !important;
    flex-shrink: 0 !important;
    background: #1a1a1a !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Scrollable area for child submenu items */
.nlh-mobile-children-submenu > .nlh-mobile-submenu-item {
    background: #ffffff !important;
}

/* Make all items after header scrollable by wrapping behavior */
.nlh-mobile-children-submenu {
    overflow-y: hidden !important;
}

/* When child submenu is active, completely hide parent scrolling */
.nlh-mobile-categories-submenu.child-open {
    overflow: hidden !important;
}

/* Lock the entire panel when child submenu is open */
#nlh-mobile-menu-panel.child-submenu-open {
    overflow: hidden !important;
}

#nlh-mobile-menu-panel.child-submenu-open .nlh-mobile-menu-content {
    overflow: hidden !important;
}

#nlh-mobile-menu-panel.child-submenu-open .nlh-mobile-categories-submenu {
    overflow: hidden !important;
    max-height: 100vh;
}

/* Wrapper for scrollable items - added via JS */
.nlh-mobile-children-scroll-wrapper {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    min-height: 0;
}

/* Ensure scroll wrapper fills all remaining space even with few items */
.nlh-mobile-children-submenu.active {
    transform: translateX(0) !important;
}

/* Add large bottom padding inside scroll wrapper to prevent parent showing through */
.nlh-mobile-children-scroll-wrapper::after {
    content: '';
    display: block;
    height: 100vh;
    background: #ffffff;
}
