@import './../theme/vars.scss';
@import './../mixins/reset.scss';

$inputPrefixCls: #{$vender-prefix}-input;
$inputNumberPrefixCls: #{$inputPrefixCls}-number;
$ipt-addon-width: 30px;

.#{$inputNumberPrefixCls} {
  @include reset-component;

  position: relative;
  display: inline-block;

  input::-webkit-outer-spin-button,
  input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
  }

  input {
    padding-right: 2em;
    -moz-appearance: textfield;
  }

  &:hover {
    .#{$inputNumberPrefixCls}-control {
      opacity: 1;
    }
  }

  &-control {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 0;
    width: 2em;
    font-size: 12px;
    opacity: 0;
  }

  &-sub,
  &-add {
    position: relative;
    height: 50%;
    padding: 0 5px;
    overflow: hidden;
    cursor: pointer;
    border-left: 1px solid $ipt-number-color;

    &:hover {
      background-color: $ipt-number-bg-color;
    }

    &:active {
      background-image: none;
      outline: 0;
      box-shadow: inset 0 8px 32px -8px rgba(0, 0, 0, 0.1);
    }

    &::after {
      position: absolute;
      left: 6px;
      width: 10px;
      height: 10px;
      border: 1px solid $ipt-number-control-color;
      border-radius: 2px;
      content: '';
      transform: rotate(45deg);
      box-sizing: border-box;
    }

    &.is-disabled {
      cursor: not-allowed;

      &::after {
        border-color: $ipt-number-control-disabled-color;
      }
    }
  }

  &-add {
    margin-bottom: -1px;
    border-radius: 0 3px 0 0;
    box-shadow: 0 -1px 0 0 $ipt-number-color inset;

    &::after {
      top: 50%;
      margin-top: -2px;
      border-right: 0;
      border-bottom: 0;
    }
  }

  &-sub {
    border-radius: 0 0 3px;

    &::after {
      top: 45%;
      margin-top: -6px;
      border-top: 0;
      border-left: 0;
    }
  }

  // outer
  &-type-outer {
    .amos-input {
      padding-right: 5em;
    }
  }

  &-control-outer {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 0;
    width: 5em;
    font-size: 12px;

    .#{$inputNumberPrefixCls}-control-plus,
    .#{$inputNumberPrefixCls}-control-minus {
      display: inline-block;
      width: 2.5em;
      line-height: 2.3em;
      color: $ipt-number-outer-control-color;
      text-align: center;
      cursor: pointer;
      border-left: 1px solid $ipt-number-color;

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

      &.is-disabled {
        color: $ipt-number-outer-control-disabled-color;
        cursor: not-allowed;
      }
    }
  }

  // addon
  &-hasaddon {
    .#{$inputPrefixCls} {
      padding-left: $ipt-addon-width;
    }
  }

  &-addon {
    position: absolute;
    display: inline-block;
    width: $ipt-addon-width;
    height: 100%;
    line-height: 2.3em;
    text-align: center;
    border-right: 1px solid #e8e8e8;
  }
}

.#{$inputNumberPrefixCls}-sm {
  font-size: 12px;

  .#{$inputNumberPrefixCls}-addon {
    line-height: 1.8em;
  }

  .#{$inputNumberPrefixCls}-control-plus,
  .#{$inputNumberPrefixCls}-control-minus {
    line-height: 1.8em;
  }
}

.#{$inputNumberPrefixCls}-lg {
  font-size: 18px;

  .#{$inputNumberPrefixCls}-addon {
    line-height: 2.8em;
  }

  .#{$inputNumberPrefixCls}-control-plus,
  .#{$inputNumberPrefixCls}-control-minus {
    line-height: 2.8em;
  }
}
