@use '../../css/breakpoints.scss' as breakpoints;

.docsNavBurger {
    display: flex;
}

.docsMobileMenu {
    transition-property: transform, opacity;
    transition-duration: 250ms;
    transition-timing-function: ease-in-out;
}

.docsMobileMenuActive {
    position: fixed;
    z-index: 9999; // Much higher z-index to ensure it's on top
    left: 0;
    top: 0;
    height: 100vh;
    width: 100%;
    transform: translate3d(0, 0, 0);
    margin: 0;
    padding: 0 1rem;
    overflow-x: hidden;
    overflow-y: auto; // Allow scrolling if content is too tall
    opacity: 1;
    background: transparent; // Ensure no background interferes
}

.docsMobileMenuHidden {
    display: none;
    position: absolute;
    opacity: 0;
    transform: translate3d(-100%, 0, 0);
}

.docsMobileMenuBackdropInactive {
    display: none;
}

[data-theme="dark"] .docsMobileMenuBackdropActive {
    background-color: #1f1f1c;
    display: flex;
    position: fixed;
    width: 100%;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 9998; // Just below the menu content
    transform: translate3d(0, 0, 0);
}

[data-theme="light"] .docsMobileMenuBackdropActive {
    background-color: white;
    display: flex;
    position: fixed;
    width: 100%;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 9998; // Just below the menu content
    transform: translate3d(0, 0, 0);
}

[data-theme="dark"] .searchBar {
    button {
        background: #303030;
    }
}

.docsMobileMenuItems {
    margin-top: 1em;
    margin-bottom: 2em;
}

.docsMobileMenu_header {
    padding-top: 0.75rem;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: none;
    position: relative;
    z-index: 1;
    background: inherit;
}

.headerActions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    position: relative; // Ensure proper stacking
    z-index: 1;
}

.headerActions > * {
    margin: 0;
    flex-shrink: 0; // Prevent action items from shrinking
}

.arrow {
    width: 8px;
    height: 8px;
    margin: 0 0.25rem;
}

[data-theme="dark"] .arrow {
    color: white;
}

[data-theme="light"] .arrow {
    color: black;
}

[data-theme="light"] .logo {
    color: black;
}

.toplevel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5rem;
    min-height: 2.5rem; // Ensure minimum height for logo
    position: relative;
    z-index: 1;
}

.leftSection {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.logoLink {
    display: flex;
    align-items: center;
    text-decoration: none;

    &:hover {
        text-decoration: none;
    }
}

.logo {
    height: 2rem;
    width: auto;
    max-width: 200px;
    display: block;
}

.bottomLevel {
    display: flex;
    justify-content: left;
    width: 100%;
    position: relative;
    z-index: 1;
}

.levelToggleButton {
    border: none;
    border-radius: 5px;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
    cursor: pointer;

    &:hover {
        opacity: 0.8;
    }
}

[data-theme="dark"] .levelToggleButton {
    background-color: #303030;
    color: white;
}

[data-theme="light"] .levelToggleButton {
    background-color: var(--ifm-menu-color-background-active);
    color: black;
}

.arrow {
    width: 8px;
    height: 8px;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

[data-theme="dark"] .arrow {
    color: white;
}

[data-theme="light"] .arrow {
    color: black;
}

@media (min-width: breakpoints.$laptop-breakpoint) {
    .docsNavBurger {
        display: none;
    }
}

// Additional z-index overrides to ensure mobile menu is always on top
.docsMobileMenuActive {
    // Override any potential conflicting z-index from other components
    * {
        position: relative;
    }

    // Ensure dropdown components within the menu have appropriate z-index
    .languagePicker {
        position: relative;
        z-index: 1;

        .languageDropdown {
            z-index: 10000 !important; // Ensure dropdowns appear above menu content
        }
    }
}

// Ensure the mobile menu content has a solid background
[data-theme="dark"] .docsMobileMenuActive {
    background-color: #1f1f1c;
}

[data-theme="light"] .docsMobileMenuActive {
    background-color: white;
}

.iconClose {
    padding: 1px;
    border-radius: 6px;
    display: flex;
}

.iconClose:hover {
    background: var(--ifm-menu-color-background-active) !important;
}
