@import '../../common/styles/theme.less';

.sp-button2 {
    background-color: var(--color-white);
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border-color-base);
    border-color: var(--border-color-base);
    color: var(--color-text-regular);
    -webkit-appearance: none;
    text-align: center;
    box-sizing: border-box;
    outline: none;
    margin: 0;
    transition: all .2s, background-color .1s;
    font-weight: 500;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 4px;

    >.sp-icon {
        line-height: 1;
        vertical-align: baseline;
        display: inline-block;
    }

    &:active {
        border-color: #3a8ee6;
        color: #136dc9;
    }

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

    &--primary {
        background-color: var(--color-primary);
        border-color: var(--color-primary);
        color: var(--color-white);
        border: none;
        box-shadow: rgb(0 0 0 / 20%) 0px 3px 1px -2px, rgb(0 0 0 / 14%) 0px 2px 2px 0px, rgb(0 0 0 / 12%) 0px 1px 5px 0px;

        &:hover,
        &:focus {
            filter: brightness(1.1);
            color: var(--color-white);
        }

        &:active {
            filter: brightness(0.9);
            opacity: 1;
        }
    }

    &--dashed {
        border-style: dashed;

        &:active {
            border-color: #136dc9;
        }
    }

    &--danger {
        color: var(--color-white);
        background-color: var(--color-danger);
        border-color: var(--color-danger);
        border: none;
        box-shadow: rgb(0 0 0 / 20%) 0px 3px 1px -2px, rgb(0 0 0 / 14%) 0px 2px 2px 0px, rgb(0 0 0 / 12%) 0px 1px 5px 0px;

        &:hover,
        &:focus {
            filter: brightness(1.1);
            color: var(--color-white);
            border-color: var(--color-danger);
        }

        &:active {
            filter: brightness(0.95);
            opacity: 1;
        }
    }

    &--text {
        border-style: none;
        background-color: var(--background-color-base);

        &:active {
            filter: brightness(0.9);
        }
    }

    &--link {
        color: var(--color-primary);
        border: none;

        &:active {
            color: #136dc9;
        }
    }

    &-shape {
        &--circle {
            border-radius: 50%;
            padding: 12px;
            min-width: 40px;
        }

        &--round {
            border-radius: 20px;
            // padding: 12px 23px;
        }
    }


    &-size {
        &--mini {
            font-size: 12px;
            padding: 6px 10px;

            &.sp-button2-shape--circle {
                padding: 7px;
                min-width: 32px;
            }

            &.is-loading {
                padding-left: 24px;

                >.sp-icon-loading {
                    left: 6px;
                    width: 14px;
                    height: 14px;
                    font-size: 12px;
                    animation: loadingLeftTmeMini .4s linear;
                }
            }

            &.empty-loading {
                padding: 6px;
            }
        }

        &--small {
            font-size: 13px;
            padding: 9px 13px;

            &.sp-button2-shape--circle {
                padding: 10px;
                min-width: 35px;
            }

            &.is-loading {
                padding-left: 27px;

                >.sp-icon-loading {
                    left: 9px;
                    width: 15px;
                    height: 15px;
                }
            }

            &.empty-loading {
                padding: 9px;
            }
        }
    }

    &.is-loading {
        transition: .4s;
        position: relative;
        padding-left: 32px;

        >.sp-icon-loading {
            position: absolute;
            display: inline-block;
            left: 12px;
            width: 16px;
            height: 16px;
            animation: loadingLeftTme .4s linear;
        }
    }

    &.empty-loading {
        position: inherit;
        padding: 12px;

        >.sp-icon-loading {
            position: inherit;
        }
    }

    &.is-disabled {
        border-color: inherit;
        pointer-events: none;
        color: var(--color-text-disabled);
        box-shadow: none;
        background-color: transparent;
        border-width: 0.2px;

        &:hover {
            color: var(--color-text-disabled);
            background-color: transparent;
            border-color: inherit;
        }

        &:active {
            border-color: inherit;
        }

        &.sp-button2--link {
            color: var(--color-text-disabled);

            &:hover {
                color: var(--color-text-disabled);

            }
        }

        &.sp-button2--text {
            background-color: rgba(0, 0, 0, 0.04);
            border: none;

            &:hover {
                color: var(--color-text-disabled);
                background-color: rgba(0, 0, 0, 0.04);
            }
        }

        &.sp-button2--primary,
        &.sp-button2--danger {
            background-color: rgba(0, 0, 0, 0.12);
            border: none;

            &:hover {
                color: var(--color-text-disabled);
                background-color: rgba(0, 0, 0, 0.12);

            }
        }

    }

}

@keyframes loadingLeftTme {
    from {
        left: 0px;
    }

    to {
        left: 12px;
    }
}


@keyframes loadingLeftTmeMini {
    from {
        left: 0px;
    }

    to {
        left: 6px;
    }
}