.PageJumpNavigation {
    position: relative;
    z-index: 210;
}

.PageJumpNavigation.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.PageJumpNavigation-content {
    background-color: #fff;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.15);

    & ul {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        margin: 0 auto;
        padding: 0.5rem 0 0;
        list-style: none;
    }

    & li {
        width: 100%;
        padding: 0;
    }

    & a,
    & button:not(.PageJumpNavigation-mobileToggle) {
        display: block;
        padding: 0.5em 1.5em;
        font-size: 1rem;
        font-weight: 500;
        color: rgba(var(--bs-link-color-rgb), 1);
        text-decoration: none;
        transition: opacity 0.2s;
        white-space: nowrap;
        position: relative;

        &.is-active {
            font-weight: 700;
            text-decoration: underline;
            color: rgba(var(--bs-link-color-rgb), 1);
        }

        &:hover {
            background-color: #f8f8f8;
        }

        /* &.is-active::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 1em;
            right: 1em;
            height: 3px;
            background-color: rgba(var(--bs-link-color-rgb), 1);
        } */
    }

    & ul:nth-of-type(2) {
        padding: 0;

        & a,
        & button {
            font-size: 0.9em;

            &:hover {
                background-color: #fff;
            }
        }
    }
}

/* Mobile toggle button - visible on mobile by default */
.PageJumpNavigation-mobileToggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    background: white;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(var(--bs-link-color-rgb), 1);
    cursor: pointer;
    text-align: left;

    & > svg {
        transition: transform 0.2s;
        flex-shrink: 0;
    }

    &.is-active {
        font-weight: 700;
        text-decoration: underline;
    }

    &.is-active > svg {
        transform: rotateZ(180deg);
    }
}

/* Nav lists - collapsed on mobile by default */
.PageJumpNavigation-navLists {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
    transition-timing-function: ease-out;

    &.is-active {
        max-height: 1000px;
        transition-timing-function: ease-in;
    }
}

/* More button styles */
.PageJumpNavigation-moreButtonWrapper {
    position: relative;
    align-items: center;
}

.PageJumpNavigation-moreButton {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: opacity 0.2s;

    &:hover {
        opacity: 0.8;
    }

    &.is-active {
        font-weight: 700;
    }

    & > svg {
        transition: transform 0.2s;
        margin-top: 0.2em;
    }
}

.PageJumpNavigation-moreButtonWrapper.is-active
    .PageJumpNavigation-moreButton
    svg {
    transform: rotateX(180deg);
}

/* Popover styles */
.PageJumpNavigation-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;

    & a {
        display: block;
        text-decoration: none;
        transition: background-color 0.2s;
        white-space: nowrap;
        font-size: 0.9375rem;

        &:hover {
            background-color: #f5f5f5;
        }
    }
}

.PageJumpNavigation-popoverList {
    flex-direction: column !important;
    border: 0;
    background-color: #f8f8f8;

    & li {
        width: 100% !important;
    }

    & a:hover {
        background-color: #fff !important;
    }
}

@media (max-width: 650px) {
    .PageJumpNavigation-content {
        & ul:nth-of-type(1) li:last-child {
            display: none;
        }

        & ul:nth-of-type(2) {
            padding-bottom: 0.5rem;
        }

        & a {
            padding-left: 1.5rem !important;
        }
    }
}

/* Desktop styles */
@media (min-width: 651px) {
    /* Hide mobile toggle on desktop */
    .PageJumpNavigation-mobileToggle {
        display: none;
    }

    /* Show nav lists by default on desktop */
    .PageJumpNavigation-navLists {
        max-height: none;
        overflow: visible;
    }

    /* Primary navigation - desktop horizontal layout */
    .PageJumpNavigation-content {
        & ul {
            flex-direction: row;
            gap: 0;
            justify-content: center;
            align-items: center;
            padding: 0;
        }

        & ul:nth-of-type(1):not(.PageJumpNavigation-popoverList) li:last-child {
            background-color: #f8f8f8;
        }

        & ul:nth-of-type(2) {
            background-color: #f8f8f8;
        }

        & li {
            width: auto;
        }

        & a {
            padding: 0.5em;
            font-size: min(1.5rem, 2.8vw);
        }

        & ul:nth-of-type(2) {
            gap: 1em;
            padding: 0;

            & a,
            & button {
                font-size: 1rem;
            }
        }
    }
}

@media (min-width: 992px) {
    .PageJumpNavigation-navLists a {
        padding: 0.5em 1em;
    }

    .PageJumpNavigation-navLists ul:nth-of-type(1) {
        max-width: 980px;
        margin: 0 auto;
        justify-content: space-between;
    }
}
