.ub-menu-layout-shrink {
    .ub-menu-layout-container {
        padding-left: 3rem;
    }

    .ub-menu-layout {
        & > .body {
            width: 3rem;

            .item {
                color: #333;
                padding: 0.4rem 0;
                text-align: center;
                display: none;

                .icon {
                    line-height: 1.4rem;
                    display: block;
                    font-size: 1rem;
                    text-align: center;
                    width: 100%;
                }

                .text {
                    font-size: var(--font-size-small);
                    display: block;
                    padding: 0;
                    line-height: 1rem;
                }

                &.item-main {
                    display: block;
                }
            }

            .item-main {
                display: block;
            }

            .foot {
                display: none;
            }

            .item-title {
                display: none;

                &.item-main {
                    display: block;
                }
            }
        }
    }
}

.ub-menu-layout-container {
    padding-left: 10rem;
}

.ub-menu-layout {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;

    .toggle {
        position: fixed;
        width: 3rem;
        height: 3rem;
        left: 0;
        top: 0;
        line-height: 3rem;
        text-align: center;
        color: #333;
        font-size: 1rem;
    }

    & > .body {
        position: fixed;
        top: 3rem;
        left: 0;
        bottom: 0;
        overflow-y: auto;
        background: var(--color-content-bg);
        border-right: 1px solid #EEE;
        width: 16em;

        .item {
            color: #333;
            display: block;
            padding: 0 1rem;
            line-height: 1.8rem;

            &.active {
                color: var(--color-primary);

                &:hover {
                    color: var(--color-primary);
                    background: var(--color-content-bg);
                }
            }

            &:hover {
                background: var(--color-body-bg);
            }

            .icon {
                display: inline-block;
                width: 1.2rem;
            }

            .text {
                display: inline-block;
            }
        }

        .item-title {
            margin-top: 1rem;
            padding: 0.5rem 1rem;
            font-size: 0.8rem;
            font-weight: 500;
            color: #1d1d1d;
            border-top: 1px solid #f0f0f0;
        }

        .foot {
            margin-top: 1rem;
            padding: 1rem;

            .link {
                overflow: hidden;

                a {
                    color: #c4cfdb;
                    display: block;
                    width: 50%;
                    float: left;
                }
            }

            .copy {
                padding-top: 0.5rem;

                a {
                    color: #c4cfdb;
                }
            }
        }
    }
}

.ub-menu {
    border-radius: 0.25rem;
    background: #FFF;
    padding: 0.5rem 0;

    &.lg {
        font-size: 0.7rem;

        .title {
            line-height: 2.5rem;
        }

        .items {
            a {
                line-height: 2.5rem;
            }
        }
    }

    &.simple {
        .title {
            &:before {
                transform: rotate(0deg);
            }
        }
    }

    .title {
        line-height: 2rem;
        padding: 0 1rem;
        display: block;
        color: #333;
        cursor: pointer;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        &:has(+ .open) {
            &:before {
                transform: rotate(90deg);
            }
        }

        a {
            color: var(--color-text);

            &:hover {
                color: var(--color-primary);
            }
        }

        &:before {
            content: '';
            background: var(--icon-arrow) no-repeat center;
            background-size: contain;
            width: 0.4rem;
            height: 0.4rem;
            margin-top: 0.8rem;
            opacity: 0.3;
            display: block;
            color: #CCC;
            float: right;
            transform: rotate(0deg);
            transition: all 0.3s;
        }

        &.active {
            color: var(--color-primary);
            border-right: 4px solid var(--color-primary);
            background-color: var(--color-primary-light-bg);

            a {
                color: var(--color-primary);
            }
        }

        &:hover {
            color: var(--color-primary);
        }

        .icon {
            display: inline-block;
            width: 1.2em;
        }
    }

    .items {
        display: none;

        &.open {
            display: block;
        }

        a {
            line-height: 2rem;
            padding: 0 0.5rem 0 1.9rem;
            display: block;
            color: var(--color-text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;

            &.active {
                color: var(--color-primary);
                background-color: var(--color-primary-light-bg);
                border-right: 4px solid var(--color-primary);
            }

            &:hover {
                color: var(--color-primary);
            }
        }
    }
}


.ub-menu.nav-menu {
    padding: 0.25rem 0;
}

@media screen and (max-width: 40rem) {

    .ub-menu.simple {
        white-space: nowrap;
        overflow-x: auto;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        line-height: 0;

        .title {
            display: inline-block;
            min-width: 4em;
            border-right: none;
            border-radius: 0.5rem;

            &:before {
                display: none;
            }
        }
    }

    // nav-menu
    .ub-menu.nav-menu {
        display: flex;
        margin-bottom: 0.5rem;
        white-space: nowrap;
        overflow-x: auto;
        padding: 0;

        .title {
            display: inline-block;
            padding: 0 0.2rem;
            flex-grow: 1;
            text-align: center;
            min-width: 5rem;
        }

        .items.open {
            display: block;
            background: #FFF;
            box-shadow: 0 0 5px #CCC;
            border-radius: 0 0 0.4rem 0.4rem;
            position: absolute;
            z-index: 1000;
            top: 2rem;

            a {
                padding: 0 0.15rem;
                text-align: center;
                text-overflow: ellipsis;
                overflow: hidden;
            }
        }
    }
}

.ub-menu-tree {
    border-radius: 0.25rem;
    background: #FFF;
    padding: 0.5rem 0;

    &.no-arrow {
        .item {
            .title {
                padding-left: 0;

                &:before {
                    display: none;
                }
            }
        }
    }

    .page-menu-container > .item, & > .item {
        padding: 0 0.5rem;
    }

    .item {
        a {
            color: var(--color-text);
        }

        .title {
            display: flex;
            line-height: 1.5;
            cursor: pointer;
            padding-left: 0.7rem;
            position: relative;
            margin: 0.5rem 0;
            border-radius: 0.25rem;

            &.active {
                background-color: var(--color-body-block-bg-hover);

                .title-text {
                    color: var(--color-primary);
                }
            }

            &.group-active, &:hover {
                .title-text {
                    color: var(--color-primary);
                }
            }

            &:before {
                content: '';
                background: var(--icon-arrow) no-repeat center;
                background-size: contain;
                width: 0.4rem;
                height: 0.4rem;
                opacity: 0.3;
                transform: rotate(0deg);
                transition: all 0.3s;
                position: absolute;
                top: 0.5rem;
                left: 0.25rem;
            }

            .title-text {
                flex-grow: 1;
                width: 0;
                padding: 0.25rem;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .title-action {
                padding: 0.25rem 0;

                .title-action-icon {
                    line-height: 1rem;
                    display: none;
                    width: 1rem;
                    text-align: center;
                    border-radius: 0.25rem;

                    &:hover {
                        background-color: var(--color-body-block-bg-hover);
                    }
                }
            }

            &.open {
                &:before {
                    transform: rotate(90deg);
                }
            }

            &.open + .group {
                display: block;
            }

            & > .title-action {
                & > .title-action-icon.title-action-icon-open {
                    display: inline-block;
                }
            }

            &.open {
                & > .title-action {
                    & > .title-action-icon.title-action-icon-open {
                        display: none;
                    }

                    & > .title-action-icon.title-action-icon-close {
                        display: inline-block;
                    }
                }
            }
        }

        .group {
            padding-left: 0.5rem;
            display: none;
        }
    }
}

// page-menu start

.page-menu {
    .page-menu-container {
        overflow-x: hidden;
        overflow-y: auto;
        height: 100%;
    }
}

.page-menu-toggle {
    display: none;
}

@media screen and (max-width: 40rem) {
    .page-menu {
        position: fixed;
        z-index: 100;
        width: 50%;
        left: -50%;
        bottom: 0;
        top: 0;
        transition: left 0.3s;

        .page-menu-toggle {
            display: block;
            width: 2.5rem;
            height: 2.5rem;
            position: absolute;
            background: #FFF;
            bottom: 2.5rem;
            right: -2.5rem;
            border-radius: 0 var(--size-radius) var(--size-radius) 0;
            border-left: none;
            font-size: var(--font-size-large);
            line-height: 2.5rem;
            text-align: center;
            color: #c4cfdb;
            box-shadow: 0.1rem 0 0.15rem #c4cfdb;

            i {
                display: block;
            }
        }
    }

    body.ub-menu-page-show {
        overflow: hidden;

        .page-menu {
            transition: left 0.3s;
            left: 0;
            box-shadow: 0.1rem 0 0.15rem #c4cfdb;
        }
    }
}

// page-menu end

// ub-menu-tree-simple

.ub-menu-tree-simple {
    border-radius: 0.25rem;
    background: #FFF;
    padding: 0.5rem;
    box-shadow: var(--box-shadow);
    transition: top 0.3s;

    &.close {

        width: 2rem;

        .item {
            display: none;
        }

        .tool {
            .tool-open {
                display: block;
            }

            .tool-close {
                display: none;
            }
        }
    }

    &.page {
        .item-container {
            max-height: calc(100vh - 7rem);
        }
    }

    a {
        color: var(--color-text);

        &:hover {
            color: var(--color-primary);
        }
    }


    .item-container {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        margin: 0.25rem 0;

        &.active {
            a {
                color: var(--color-primary);
            }
        }

        &.level-1 {
            padding-left: 0;
        }

        &.level-2 {
            padding-left: 0.5rem;
        }

        &.level-3 {
            padding-left: 1rem;
        }

        &.level-4 {
            padding-left: 1.5rem;
        }

        &.level-5 {
            padding-left: 2rem;
        }
    }

    .tool {
        text-align: center;

        a {
            display: none;
            border-radius: 0.25rem;

            &:hover {
                background-color: var(--color-body-block-bg-hover);
            }
        }

        .tool-close {
            display: block;
        }
    }
}
