/**
 * RPH Menu Builder - Mobile Styles
 */

.rph-menu-mobile-wrapper {
    position: relative; /* Or static, depending on context */
    display: block;
    /* min-height removed - rely on trigger height */
}

/* --- NEW: Style the trigger area --- */
.rph-menu-mobile-header-trigger {
    display: flex; /* Align label and button */
    align-items: center; /* Vertically center */
    justify-content: flex-end; /* Example: Push to right */
    /* Add padding/margin as needed for positioning */
    padding: 5px 10px;
    cursor: pointer; /* Make the whole area clickable maybe? Optional */
}

/* --- NEW: Style the header label --- */
.rph-menu-mobile-header-label {
    /* Use dynamic variables */
    font-family: var(--rph-menu-font-family, inherit);
    font-weight: var(--rph-menu-font-weight, normal);
    /*color: var(--rph-menu-link-color, #333);*/
    color: #ffffff;
    font-size: 15px; /* Adjust size */
    margin-right: 10px; /* Space between label and hamburger */
    display: inline-block; /* Ensure it takes space */
    line-height: 1.2; /* Adjust line height */
}


/* Mobile Toggle Button (Hamburger) - Remove Debug Styles */
.rph-menu-mobile-toggle {
	display: inline-flex;
    flex-direction: column;
    justify-content: space-around;
	width: 30px;
	height: 26px;
	padding: 5px;
	cursor: pointer;
	/*background: transparent;*/
    background-color: #ffffff00;
	border: none;
    position: relative;
    z-index: 1051;
    /* Reset potential theme interference */
    font-size: initial;
    line-height: initial;
    text-indent: -9999px;
    color: transparent;
    box-shadow: none;
    border-radius: 0;
    outline: none;
    margin: 0; /* Reset margin */
    flex-shrink: 0; /* Prevent shrinking */
}

.rph-menu-mobile-wrapper button:hover,
.rph-menu-mobile-wrapper button:focus {
	background-color: #ffffff00 !important;
}

.rph-menu-mobile-toggle span {
	display: block;
	width: 100%;
	height: 3px;
	background-color: #ffffff !important;
	border-radius: 3px;
	transition: transform 0.3s ease, opacity 0.3s ease;
    margin: 5px 0;
}

/* Hamburger animation to 'X' when open */
.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-toggle span:nth-child(2) {
    opacity: 0;
}
.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-toggle span:nth-child(3) {
     transform: translateY(-8px) rotate(-45deg);
}
.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-toggle span {
    /*background-color: var(--rph-menu-link-color, #333);*/
    background-color: #444444 !important; 
}


/* 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;
	display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.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 */
body.rph-mobile-menu-active {
    overflow: hidden;
}


/* Mobile Top Bar (Inside Panel) - Remove Debug */
.rph-menu-mobile-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 25px 20px;
	border-bottom: 1px solid #eee;
	background-color: var(--rph-menu-bg-color, #fff);
    flex-shrink: 0;
    color: var(--rph-menu-link-color, #333);
    opacity: 1;
    visibility: visible;
    position: relative;
    z-index: 1;
}

/* Rename internal title class for clarity */
.rph-menu-mobile-panel-title {
	font-size: 1.2em;
	font-weight: bold;
    color: inherit;
    display: inline-block;
    opacity: 1;
    visibility: visible;
    /* Remove debug styles */
    /* background-color: rgba(0, 255, 0, 0.1); */
    /* border: 1px solid green; */
}

.rph-menu-mobile-close {
	font-size: 2em;
	line-height: 1;
    background: none;
    border: none;
    color: inherit;
    padding: 5px;
    opacity: 1;
    visibility: hidden;
}
.rph-menu-mobile-close:hover,
.rph-menu-mobile-close:focus {
    color: var(--rph-menu-link-hover-color, #0073aa);
}


/* Mobile Navigation List Container (Scrollable Area) */
nav.rph-menu-mobile {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0;
     -webkit-overflow-scrolling: touch;
}

ul.rph-menu-mobile-list { }

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);
}


.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;
}

li.rph-accordion-item.is-open > .rph-accordion-panel {
    max-height: 1500vh;
    padding-top: 15px;
    padding-bottom: 15px;
    transition: max-height 0.5s cubic-bezier(0.23, 1, 0.32, 1), padding 0.5s ease;
}

/*Fixed the toggle*/
.rph-menu-mobile-wrapper.is-mobile-menu-open .rph-menu-mobile-toggle{
	position: fixed;
}

/* 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); /* Adjust */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    padding: 8px 0; /* Vertical padding */
    font-size: 1em; /* Submenu item font size */
}
.rph-menu-mobile-wrapper .rph-location-child-toggle {
   padding: 8px; /* Larger tap target */
   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; /* Mobile indentation */
}
.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; /* Stack to 1 column */
        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); /* Adjust if button size changes */
     }
    /* Adjust indentation if needed */
    .rph-menu-mobile-wrapper .rph-location-parent-item > ul.rph-submenu-child-list {
        padding-left: 10px;
    }
}