.besalp-mobile-menu-wrapper {
    position: relative;
}

/* Initially hide the original container to prevent flashing */
.besalp-mobile-menu-container {
    display: none !important;
    flex-direction: column;
    background-color: #fff;
    box-sizing: border-box;
    /* Hiding will now be handled by JavaScript */
}

.besalp-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 30px;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1000;
}

.besalp-hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #000;
    transition: transform 0.3s ease;
}

.besalp-hamburger.active .besalp-hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.besalp-hamburger.active .besalp-hamburger-line:nth-child(2) {
    opacity: 0;
}

.besalp-hamburger.active .besalp-hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* Specific styles for the container when moved to body */
.besalp-mobile-menu-body-container {
    display: none !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: calc(100vw + 2px) !important;
    height: calc(100vh + 2px) !important;
    z-index: 999999 !important; /* Higher z-index to ensure it's above everything */
    overflow-y: auto !important;
    visibility: hidden !important; /* Hide by default */
    opacity: 1 !important; /* Start transparent */
    transform: translateX(100%) !important;
    transition: transform 0.3s cubic-bezier(0.05, 0.86, 0.25, 1), right 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
    padding: 15px !important;
    box-shadow: 0 0 25px 0 rgba(0,0,0,0.3);
}

body > .besalp-mobile-menu-body-container {
    display: flex !important;
}
/* Active state for moved containers */
/* .besalp-mobile-menu-body-container.active {
    visibility: visible !important;
    opacity: 1 !important;
} */

/* Elementor editor styles - hide the container completely */
.elementor-editor-active .besalp-mobile-menu-wrapper .besalp-mobile-menu-container {
    display: none !important; /* Hide in editor completely */
    visibility: hidden !important;
    opacity: 0 !important;
}

.besalp-mobile-menu-header {
    padding: 20px;
    position: relative;
}

.besalp-mobile-menu-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.besalp-mobile-menu-footer {
    padding: 20px;
}

/* Close Button Styles */
.besalp-close-button {
    position: absolute;
    top: 33px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent !important;
}

.besalp-close-button:active {
    background-color: transparent !important;
}

.besalp-close-icon {
    position: relative;
    width: 20px;
    height: 20px;
}

.besalp-close-icon:before,
.besalp-close-icon:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: white;
    top: 50%;
    left: 0;
    transition: background-color 0.3s ease;
}

.besalp-close-icon:before {
    transform: rotate(45deg);
}

.besalp-close-icon:after {
    transform: rotate(-45deg);
}

/* Menu Styles */
.besalp-mobile-nav-menu {
    width: 100%;
}

.besalp-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.besalp-menu-items li {
    margin: 0;
    padding: 0;
}

.besalp-menu-items a {
    display: block;
    padding: 12px 0;
    font-size: 18px;
    text-decoration: none;
    color: white !important;
    transition: color 0.3s ease;
}

.besalp-menu-items > li:last-child > a {
    border-bottom: none;
}

/* Submenu Styles */
.besalp-menu-items .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 20px;
}

.besalp-menu-items .sub-menu a {
    font-size: 16px;
    padding: 10px 0;
}

/* Template Containers */
.besalp-mobile-menu-header,
.besalp-mobile-menu-footer {
    width: 100%;
}

/* Elementor Template Overrides */
.besalp-mobile-menu-header .elementor-section-wrap,
.besalp-mobile-menu-footer .elementor-section-wrap {
    width: 100%;
}

/* Elementor editor placeholder styling */
.elementor-placeholder {
    border: 2px dashed #d5dadf;
    margin: 10px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.elementor-placeholder-title {
    color: #a4afb7;
    font-size: 14px;
}

/* Class to make container visible when JavaScript is ready */
.besalp-mobile-menu-body-container.js-ready {
    display: flex !important;
    visibility: hidden !important; /* Still keep hidden until activated */
    opacity: 0 !important;
    right: 100% !important;
}

/* Active state makes the container visible */
.besalp-mobile-menu-body-container.active {
    visibility: visible !important;
    opacity: 1 !important;
    right: 0 !important;
    display: flex !important;
    transform: translateX(0) !important;
}

/* Menu item with collapse button */
.menu-item-has-collapse-button {
    position: relative;
}

/* Menu item wrapper to contain both anchor and collapse button */
.besalp-menu-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Anchor inside wrapper */
.besalp-menu-item-wrapper > a {
    flex: 1;
    width: calc(100% - 40px); /* Make room for the collapse button */
}

/* Collapse button styles */
.besalp-menu-collapse-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    height: 100% !important;
    background-color: transparent !important;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 0;
    aspect-ratio: 1 / 1;
    z-index: 2;
}

/* Collapse icon (plus/minus) */
.besalp-collapse-icon {
    position: relative;
    width: 14px;
    height: 14px;
}

.besalp-collapse-icon:before,
.besalp-collapse-icon:after {
    content: '';
    position: absolute;
    background-color: white;
    transition: transform 0.3s ease;
}

.besalp-collapse-icon:before {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.besalp-collapse-icon:after {
    width: 2px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Active state (minus sign) */
.besalp-menu-collapse-button.active .besalp-collapse-icon:after {
    transform: translateX(-50%) rotate(90deg);
    opacity: 0;
}

/* Submenu style adjustments */
.besalp-menu-items .sub-menu.collapsed {
    display: block;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Update the padding-right for menu items with children to make room for the button */
.besalp-menu-items .menu-item-has-collapse-button > a {
    padding-right: 35px;
}

/* With the new wrapper structure, we don't need as much right padding */
.besalp-menu-items .menu-item-has-collapse-button .besalp-menu-item-wrapper > a {
    padding-right: 10px; /* Reduced padding as the button is now positioned in the wrapper */
}

/* Make the collapse button and icon bigger for easier tapping on mobile */
@media (max-width: 767px) {
    .besalp-collapse-icon {
        width: 16px;
        height: 16px;
    }
}

/* Preserve font styles for all menu items */
.besalp-menu-items a,
.besalp-menu-items li,
.besalp-menu-items .sub-menu a,
.besalp-menu-items .besalp-menu-item-wrapper a {
    font-family: inherit; /* Inherit from parent container */
}

/* Ensure submenu items have the same font family */
.besalp-menu-items .sub-menu a {
     /* Force inheritance even against other rules */
     /* Keep your white text color */
     width: 100% !important;
     font-size: 14px !important;
}

/* Apply inherited styles to menu item wrapper */
.besalp-menu-item-wrapper {
    font-family: inherit;
}

/* Menu Logo Styles */
.besalp-menu-logo {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 20px;
}

.besalp-menu-logo img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

/* Background Image Overlay Styles */
.besalp-mobile-menu-container {
    position: relative;
}

.besalp-mobile-menu-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    border-radius: inherit;
    pointer-events: none;
}

.besalp-mobile-menu-body-container {
    position: relative;
}

.besalp-mobile-menu-body-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    border-radius: inherit;
    border-top-left-radius: 0 !important;
    pointer-events: none;
    /* Use custom properties set by JavaScript for moved containers */
    background-image: var(--background-overlay-image, none);
    background-size: var(--background-overlay-size, cover);
    background-position: var(--background-overlay-position, center center);
    background-repeat: var(--background-overlay-repeat, no-repeat);
    opacity: var(--background-overlay-opacity, 1);
}

/* Social Media Links Styles */
.besalp-mobile-menu-social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: auto;
    padding-top: 20px;
    padding-bottom: 10px;
}

.besalp-mobile-menu-social-links .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
    font-size: 20px;
    line-height: 1;
}

.besalp-mobile-menu-social-links .social-link:hover {
    color: #cccccc;
    transform: translateY(-2px);
}

.besalp-mobile-menu-social-links .social-link i,
.besalp-mobile-menu-social-links .social-link svg {
    width: 20px;
    height: 20px;
}

.besalp-mobile-menu-social-links .social-link svg {
    fill: currentColor;
}

/* Footer Text Styles */
.besalp-mobile-menu-footer-text {
    text-align: center;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 10px;
    padding-bottom: 20px;
    opacity: 0.8;
}

/* Ensure menu navigation takes available space */
.besalp-mobile-nav-menu {
    flex: 1;
}

/* Override margin for when elements are stacked at bottom */
.besalp-mobile-menu-social-links + .besalp-mobile-menu-footer-text {
    margin-top: 0;
}