@charset "UTF-8";

@import "../core/index-noreset.scss";
@import "./scss/mixin";
@import "./scss/variable";

#{$number-picker-prefix} {
    @include box-sizing;
    display: inline-block;

    /* stylelint-disable declaration-no-important */
    .#{$css-prefix}btn {
        padding: 0 !important;
        line-height: 0 !important;
        box-shadow: none !important;
    }

    &-normal {
        .#{$css-prefix}input {
            width: 100%;

            .#{$css-prefix}input-control {
                padding-right: 0;
                height: 100%;
            }
        }

        &:not(#{$number-picker-prefix}-no-trigger) .#{$css-prefix}input input {
            padding-right: 2px;
        }

        .#{$css-prefix}btn {
            display: block;

            &:hover {
                z-index: 1;
            }

            &:first-child {
                border-right: none;
                border-top: none;
                height: calc(50%);
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
            }

            &:last-child {
                border-right: none;
                border-bottom: none;
                margin-top: -1px;
                height: calc(50% + 1px);
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
                border-top-right-radius: 0;
            }
        }

        #{$number-picker-prefix}-handler {
            transition: opacity $motion-duration-immediately $motion-linear;
            height: 100%;
            display: block;
        }

        &:not(#{$number-picker-prefix}-show-trigger) #{$number-picker-prefix}-handler {
            opacity: 0;
        }

        &:hover #{$number-picker-prefix}-handler,
        &.hover #{$number-picker-prefix}-handler {
            opacity: 1;
        }

        .#{$css-prefix}input.#{$css-prefix}disabled #{$number-picker-prefix}-handler {
            opacity: 0;
        }

        #{$number-picker-prefix}-up-icon::before {
            content: $number-picker-normal-up-icon;
        }

        #{$number-picker-prefix}-down-icon::before {
            content: $number-picker-normal-down-icon;
        }

        &.#{$css-prefix}small {
            width: 68px;

            .#{$css-prefix}btn {
                width: $number-picker-normal-s-button-width;

                &:first-child {
                    border-top-right-radius: $form-element-small-corner;
                }

                &:last-child {
                    border-bottom-right-radius: $form-element-small-corner;
                }
            }

            .#{$css-prefix}icon {
                @include icon-size($number-picker-normal-s-button-icon-size);
            }
        }

        &.#{$css-prefix}medium {
            width: $number-picker-normal-m-input-width;

            .#{$css-prefix}btn {
                width: $number-picker-normal-m-button-width;

                &:first-child {
                    border-top-right-radius: $form-element-medium-corner;
                }

                &:last-child {
                    border-bottom-right-radius: $form-element-medium-corner;
                }
            }

            .#{$css-prefix}icon {
                @include icon-size($number-picker-normal-m-button-icon-size);
            }
        }

        &.#{$css-prefix}large {
            width: $number-picker-normal-l-input-width;

            .#{$css-prefix}btn {
                width: $number-picker-normal-l-button-width;

                &:first-child {
                    border-top-right-radius: $form-element-large-corner;
                }

                &:last-child {
                    border-bottom-right-radius: $form-element-large-corner;
                }
            }

            .#{$css-prefix}icon {
                @include icon-size($number-picker-normal-l-button-icon-size);
            }
        }
    }

    &-inline {
        input {
            text-align: center;
        }

        .#{$css-prefix}input input {
            padding: 0;
        }

        #{$number-picker-prefix}-add-icon::before {
            content: $number-picker-inline-add-icon;
        }

        #{$number-picker-prefix}-minus-icon::before {
            content: $number-picker-inline-minus-icon;
        }

        &.#{$css-prefix}small {
            width: 68px;
            min-width: calc(#{$form-element-small-height} * 3);

            .#{$css-prefix}icon {
                @include icon-size($number-picker-inline-s-button-icon-size);
            }

            .#{$css-prefix}btn {
                height: $form-element-small-height;
            }

            .#{$css-prefix}before .#{$css-prefix}btn {
                margin-right: $number-picker-inline-s-button-margin;
                border-top-left-radius: $number-picker-inline-s-button-corner;
                border-bottom-left-radius: $number-picker-inline-s-button-corner;
            }

            .#{$css-prefix}after .#{$css-prefix}btn {
                margin-left: $number-picker-inline-s-button-margin;
                border-top-right-radius: $number-picker-inline-s-button-corner;
                border-bottom-right-radius: $number-picker-inline-s-button-corner;
            }
        }

        &.#{$css-prefix}medium {
            width: $number-picker-inline-m-input-width;
            min-width: calc(#{$form-element-medium-height} * 3);

            .#{$css-prefix}icon {
                @include icon-size($number-picker-inline-m-button-icon-size);
            }

            .#{$css-prefix}btn {
                height: $form-element-medium-height;
            }

            .#{$css-prefix}before .#{$css-prefix}btn {
                margin-right: $number-picker-inline-m-button-margin;
                border-top-left-radius: $number-picker-inline-m-button-corner;
                border-bottom-left-radius: $number-picker-inline-m-button-corner;
            }

            .#{$css-prefix}after .#{$css-prefix}btn {
                margin-left: $number-picker-inline-m-button-margin;
                border-top-right-radius: $number-picker-inline-m-button-corner;
                border-bottom-right-radius: $number-picker-inline-m-button-corner;
            }
        }

        &.#{$css-prefix}large {
            width: $number-picker-inline-l-input-width;
            min-width: calc(#{$form-element-large-height} * 3);

            .#{$css-prefix}icon {
                @include icon-size($number-picker-inline-l-button-icon-size);
            }

            .#{$css-prefix}btn {
                height: $form-element-large-height;
            }

            .#{$css-prefix}before .#{$css-prefix}btn {
                margin-right: $number-picker-inline-l-button-margin;
                border-top-left-radius: $number-picker-inline-l-button-corner;
                border-bottom-left-radius: $number-picker-inline-l-button-corner;
            }

            .#{$css-prefix}after .#{$css-prefix}btn {
                margin-left: $number-picker-inline-l-button-margin;
                border-top-right-radius: $number-picker-inline-l-button-corner;
                border-bottom-right-radius: $number-picker-inline-l-button-corner;
            }
        }

        .#{$css-prefix}btn {
            &.#{$css-prefix}small {
                width: $form-element-small-height;
            }

            &.#{$css-prefix}medium {
                width: $form-element-medium-height;
            }

            &.#{$css-prefix}large {
                width: $form-element-large-height;
            }
        }
    }
}

@-moz-document url-prefix() {
    #{$number-picker-prefix}-normal {
        &.#{$css-prefix}small #{$number-picker-prefix}-handler {
            height: calc(#{$form-element-small-height} - 2px);
        }

        &.#{$css-prefix}medium #{$number-picker-prefix}-handler {
            height: calc(#{$form-element-medium-height} - 2px);
        }

        &.#{$css-prefix}large #{$number-picker-prefix}-handler {
            height: calc(#{$form-element-large-height} - 2px);
        }
    }
}

#{$number-picker-prefix}-normal[dir="rtl"] {
    .#{$css-prefix}btn {
        &:first-child {
            border-right: 1px solid $color-line1-3;
            border-left: 0;
            border-top-right-radius: 0;

            &.#{$css-prefix}small {
                border-top-left-radius: $form-element-small-corner;
            }

            &.#{$css-prefix}medium {
                border-top-left-radius: $form-element-medium-corner;
            }

            &.#{$css-prefix}large {
                border-top-left-radius: $form-element-large-corner;
            }
        }

        &:last-child {
            border-right: 1px solid $color-line1-3;
            border-left: 0;
            border-bottom-right-radius: 0;

            &.#{$css-prefix}small {
                border-bottom-left-radius: $form-element-small-corner;
            }

            &.#{$css-prefix}medium {
                border-bottom-left-radius: $form-element-medium-corner;
            }

            &.#{$css-prefix}large {
                border-bottom-left-radius: $form-element-large-corner;
            }
        }
    }

    .#{$css-prefix}input .#{$css-prefix}input-control {
        padding-left: 0;
    }
}

#{$number-picker-prefix}-inline[dir="rtl"] {
    .#{$css-prefix}before .#{$css-prefix}btn {
        margin-right: 0;

        &.#{$css-prefix}small {
            margin-left: $number-picker-inline-s-button-margin;
            border-top-right-radius: $number-picker-inline-s-button-corner !important;
            border-bottom-right-radius: $number-picker-inline-s-button-corner !important;
        }

        &.#{$css-prefix}medium {
            margin-left: $number-picker-inline-m-button-margin;
            border-top-right-radius: $number-picker-inline-m-button-corner !important;
            border-bottom-right-radius: $number-picker-inline-m-button-corner !important;
        }

        &.#{$css-prefix}large {
            margin-left: $number-picker-inline-l-button-margin;
            border-top-right-radius: $number-picker-inline-l-button-corner !important;
            border-bottom-right-radius: $number-picker-inline-l-button-corner !important;
        }
    }

    .#{$css-prefix}after .#{$css-prefix}btn {
        margin-left: 0;

        &.#{$css-prefix}small {
            margin-right: $number-picker-inline-s-button-margin;
            border-top-left-radius: $number-picker-inline-s-button-corner !important;
            border-bottom-left-radius: $number-picker-inline-s-button-corner !important;
        }

        &.#{$css-prefix}medium {
            margin-right: $number-picker-inline-m-button-margin;
            border-top-left-radius: $number-picker-inline-m-button-corner !important;
            border-bottom-left-radius: $number-picker-inline-m-button-corner !important;
        }

        &.#{$css-prefix}large {
            margin-right: $number-picker-inline-l-button-margin;
            border-top-left-radius: $number-picker-inline-l-button-corner !important;
            border-bottom-left-radius: $number-picker-inline-l-button-corner !important;
        }
    }
}
