/**
 * RPH Menu Builder - Mobile Styles
 */

.rph-menu-mobile-wrapper {
    position: relative;
    display: block;
}

/* --- Style the trigger area --- */
.rph-menu-mobile-header-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 5px 10px;
    cursor: pointer;
}

/* --- Style the header label --- */
.rph-menu-mobile-header-label {
    font-family: var(--rph-menu-font-family, inherit);
    font-weight: var(--rph-menu-font-weight, normal);
    color: var(--rph-menu-mobile-toggle-color, var(--rph-menu-link-color, #333));
    font-size: 1.1em;
    margin-right: 8px;
    display: inline-block;
    line-height: 1.2;
}


/* Mobile Toggle Button (Hamburger) - SVG VISIBLE */
.rph-menu-mobile-toggle {
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    position: relative;
    z-index: 1051;
    /* SVG hamburger icon - VISIBLE (removed text-indent and color:transparent) */
    color: var(--rph-menu-mobile-toggle-color, var(--rph-menu-link-color, #333));
    box-shadow: none;
    border-radius: 4px;
    outline: none;
    margin: 0;
    flex-shrink: 0;
}

/* SVG inside toggle button */
.rph-menu-mobile-toggle svg {
    display: block;
    width: 24px;
    height: 24px;
}

/* Mobile Panel (Fullscreen Overlay) */
.rph-menu-mobile-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: var(--rph-menu-bg-color, #fff);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease, visibility 0s linear 0.4s;
    /* Use relative positioning for absolute children */
}

.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease, visibility 0s linear 0s;
}

/* Prevent body scroll when mobile menu is open - iOS compatible */
body.rph-mobile-menu-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    /* Removed touch-action: none - it was blocking scroll in the menu */
}


/* Mobile Top Bar (Inside Panel) - Fixed height for absolute positioning */
.rph-menu-mobile-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    background-color: var(--rph-menu-bg-color, #fff);
    color: var(--rph-menu-mobile-toggle-color, var(--rph-menu-link-color, #333));
    z-index: 2;
}

.rph-menu-mobile-panel-title {
    font-size: 1.2em;
    font-weight: bold;
    color: inherit;
    display: inline-block;
    opacity: 1;
    visibility: visible;
}

.rph-menu-mobile-close {
    font-size: 2em;
    line-height: 1;
    background: transparent;
    border: none;
    color: inherit;
    padding: 5px;
    opacity: 1;
    visibility: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rph-menu-mobile-close svg {
    width: 20px;
    height: 20px;
}

.rph-menu-mobile-close:hover,
.rph-menu-mobile-close:focus {
    color: var(--rph-menu-link-hover-color, #0073aa);
    background: transparent;
}


/* Mobile Navigation List Container (Scrollable Area) - Absolute positioned */
nav.rph-menu-mobile {
    position: absolute;
    top: 60px;
    /* Below topbar */
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: scroll;
    /* Force scrollbar */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

ul.rph-menu-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

li.rph-menu-item {
    border-bottom: 1px solid #eee;
}

li.rph-menu-item:last-child {
    border-bottom: none;
}

/* Style top-level links */
li.rph-menu-item>a {
    display: block;
    padding: 15px 20px;
    font-size: 1.1em;
}


/* Accordion Styles */
li.rph-accordion-item>.rph-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    text-align: left;
    font-size: 1.1em;
    color: var(--rph-menu-link-color, #333);
    background: none;
    border: none;
    cursor: pointer;
}

li.rph-accordion-item>.rph-accordion-header:hover,
li.rph-accordion-item>.rph-accordion-header:focus {
    color: var(--rph-menu-link-hover-color, #0073aa);
    background-color: #f9f9f9;
}


.rph-accordion-indicator {
    font-size: 1.5em;
    font-weight: bold;
    line-height: 1;
    width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

li.rph-accordion-item.is-open>.rph-accordion-header .rph-accordion-indicator {
    transform: rotate(45deg);
}


/* Accordion Panel - CLOSED by default */
.rph-accordion-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s cubic-bezier(0.23, 1, 0.32, 1), padding 0.4s ease;
    background-color: #f9f9f9;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 0;
    padding-bottom: 0;
}

/* Accordion Panel - OPEN when parent has .is-open class */
li.rph-accordion-item.is-open>.rph-accordion-panel {
    max-height: 2000px;
    /* Use fixed large value instead of vh for proper scrolling */
    padding-top: 15px;
    padding-bottom: 15px;
    transition: max-height 0.5s cubic-bezier(0.23, 1, 0.32, 1), padding 0.5s ease;
}

/* Submenu List within Accordion (2 columns) */
.rph-accordion-panel ul.rph-submenu-list.rph-submenu-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
}

/* Submenu Items within Accordion */
.rph-accordion-panel li.rph-submenu-item {
    border-bottom: none;
    break-inside: avoid;
    position: relative;
}

/* Container for link + toggle in mobile */
.rph-menu-mobile-wrapper .rph-submenu-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.rph-menu-mobile-wrapper .rph-submenu-item-header a {
    flex-grow: 1;
    margin-right: 5px;
    display: inline-block;
    max-width: calc(100% - 40px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    padding: 8px 0;
    font-size: 1em;
}

.rph-menu-mobile-wrapper .rph-location-child-toggle {
    padding: 8px;
    flex-shrink: 0;
}

/* Nested Child Lists within Accordion (Dynamic Categories - always visible) */
.rph-accordion-panel li.rph-submenu-item:not(.rph-location-parent-item) ul.rph-submenu-child-list {
    margin-top: 5px;
    padding-left: 10px;
    list-style: none;
}

.rph-accordion-panel li.rph-submenu-item:not(.rph-location-parent-item) ul.rph-submenu-child-list li a {
    font-size: 0.9em;
    color: #555;
    padding: 4px 0;
}

/* Location Child List Specific Mobile Styles */
.rph-menu-mobile-wrapper .rph-location-parent-item>ul.rph-submenu-child-list {
    padding-left: 15px;
}

.rph-menu-mobile-wrapper .rph-location-parent-item>ul.rph-submenu-child-list a {
    font-size: 0.9em;
    color: #555;
    padding: 4px 0;
}

/* Media Query for smaller screens if 2 columns is too much */
@media (max-width: 480px) {
    .rph-accordion-panel ul.rph-submenu-list.rph-submenu-cols-2 {
        grid-template-columns: 1fr;
        gap: 5px 0;
    }

    .rph-accordion-panel {
        padding-left: 15px;
        padding-right: 15px;
    }

    .rph-menu-mobile-wrapper .rph-submenu-item-header a {
        max-width: calc(100% - 35px);
    }

    .rph-menu-mobile-wrapper .rph-location-parent-item>ul.rph-submenu-child-list {
        padding-left: 10px;
    }
}