@use "../variable" as *;
@use "../mixin" as *;

.rbfb-top-level-wrapper {
    .rbfb-context-menu-content {
        z-index: 50;
        min-width: 13rem;
        overflow-x: hidden;
        overflow-y: auto;
        border-radius: 8px;
        border: 1px solid $primary-light;
        background-color: $white;
        color: $black;
        padding: 0.25rem;
        box-shadow:
            0 4px 6px -1px $shadow-xs,
            0 2px 4px -1px $shadow-sm;
        animation:
            rbfb-fade-in 0.2s ease-out,
            rbfb-zoom-in 0.2s ease-out;

        &:empty {
            display: none;
        }

        .rbfb-context-menu-item {
            position: relative;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.375rem 0.5rem;
            border-radius: 0.125rem;
            cursor: pointer;
            user-select: none;
            outline: none;
            font-size: 14px;
            font-weight: 400;

            &:hover,
            &:focus {
                background-color: $primary-light;
                color: $black;
            }

            &.destructive {
                color: $error;

                &:hover,
                &:focus {
                    background-color: $error-50;
                    color: $error;
                }
            }

            &.disabled {
                pointer-events: none;
                opacity: 0.5;
            }
        }

        .rbfb-context-menu-separator {
            height: 1px;
            background-color: $primary-light;
            margin: 0.25rem -0.25rem;
        }

        .rbfb-context-menu-sub {
            display: contents;

            &-trigger {
                display: flex;
                align-items: center;
                padding: 0.375rem 0.5rem;
                font-size: 14px;
                font-weight: 400;
                border-radius: 0.125rem;
                cursor: default;
                user-select: none;
                outline: none;
                gap: 0.5rem;

                &:hover,
                &:focus {
                    background-color: $primary-light;
                    color: $black;
                }

                &.disabled {
                    pointer-events: none;
                    opacity: 0.5;
                }

                .rbfb-icon {
                    margin-left: auto;
                    pointer-events: none;
                }
            }

            &-content {
                z-index: 50;
                min-width: 13rem;
                overflow: hidden;
                border-radius: 0.375rem;
                border: 1px solid $primary-light;
                background-color: $white;
                color: $black;
                padding: 0.25rem;
                box-shadow:
                    0 4px 6px -1px $shadow-xs,
                    0 2px 4px -1px $shadow-sm;
                animation:
                    rbfb-fade-in 0.2s ease-out,
                    rbfb-zoom-in 0.2s ease-out;
            }
        }
    }

    @keyframes rbfb-fade-in {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes rbfb-zoom-in {
        from {
            transform: scale(0.95);
        }
        to {
            transform: scale(1);
        }
    }
}
