@import "mixins/mixins";
// @import "common/var";
@import "input";

// is-controls-outside
// is-controls-right

@include b(input-number) {
  position: relative;
  display: inline-block;
  width: 100%;
  display: flex;

  .el-input {
    display: block;

    &__inner {
      -webkit-appearance: none;
    }
  }
  &:not(.is-disabled):hover {
    .el-input__suffix {
      display: none;
    }
  }
  
  .input-border {
    border-color: $--color-text-placeholder !important;
  }
  .el-input--suffix:hover .el-input__inner,
  .el-input--suffix .el-input__inner:focus {
    padding-right: 12px!important;
  }

  @include when(readable) {
    &.is-controls-right{
      &:hover{
        .el-input-number__increase,.el-input-number__decrease{
          display: none;
        }
      }
    }
    &.is-controls-outside {
      .el-input-number__increase,.el-input-number__decrease{
        &:active {
          background-color: transparent;
        }
      }
      
    }
  }

  @include when(disabled) {
    .el-input .el-input__wrap .el-input__inner{
      & + .el-input__suffix * {
        color: $--color-text-4;
      }
      & + .el-input__prefix * { 
        color: $--color-text-4;
      }
      color: $--color-text-4;
    }

    &:hover {
      .el-input__icon {
        // display: block;
      }
    }
    &.is-controls-right{
      &:hover{
        .el-input-number__increase,.el-input-number__decrease{
          display: none;
        }
      }
    }
    @include e((increase, decrease)) {
      border-color: $--disabled-border-base;
      color: $--color-border-4;

      &:hover {
        color: $--disabled-border-base;
        cursor: not-allowed;
      }

      .el-input__inner{
        border-color: $--color-border-3 !important;
      }
    }

    // .el-input-number__increase,
    // .el-input-number__decrease {
    //   color: $--color-secondary-active;
    //   cursor: not-allowed;
    //   background-color: transparent;
    //   &:hover{
    //     background-color: transparent;
    //   }
    // }
    // .el-input-number__btn-increase,
    // .el-input-number__btn-decrease {
    //   color: $--color-disabled-border;
    //   background-color: $--color-secondary-disabled-background;
    //   cursor: not-allowed;
    //   &:hover {
    //     border-color: #E5E6EB;
    //   }
    // }
  }

  .is-icon-disabled {
    &.el-input-number__increase,
    &.el-input-number__decrease {
      // color: $--color-secondary-active;
      cursor: not-allowed;
      color: $--color-border-4;
      &:hover {
        color: $--color-border-4;
      }
    }
    &.el-input-number__btn-increase,
    &.el-input-number__btn-decrease {
      color: $--color-secondary-active;
      background-color: $--color-fill-2;
      cursor: not-allowed;
      &:hover {
        border-color: $--color-border-3;
      }
    }
    &.el-input-number__btn-increase{
      &:hover{
        border-left-color: transparent;
      }
    }
    &.el-input-number__btn-decrease{
      &:hover{
        border-right-color: transparent;
      }
    }
  }

  @include when(controls-right) {
    @include e(increase) {
      right: 4px;
      z-index: 1;
      // border-radius: 2px 2px 0px 0px;
      border-radius: $--border-radius-small $--border-radius-small $--border-radius-none $--border-radius-none;
    }

    @include e(decrease) {
      right: 4px;
      z-index: 1;
      // border-radius: 0 0 2px 2px;
      border-radius: $--border-radius-none $--border-radius-none $--border-radius-small $--border-radius-small;
    }
  }

  @include when(controls-outside) {
    @include e(increase) {
      right: -22px;
      z-index: 1;
      // border-radius: 2px 2px 0px 0px;
      border-radius: $--border-radius-small $--border-radius-small $--border-radius-none $--border-radius-none;
    }

    @include e(decrease) {
      right: -22px;
      z-index: 1;
      // border-radius: 0 0 2px 2px;
      border-radius: $--border-radius-none $--border-radius-none $--border-radius-small $--border-radius-small;
    }
  }

  @include m(large) {
    line-height: 35px;
    .el-input-number__btn-increase,
    .el-input-number__btn-decrease {
      height: $--input-large-height;
    }
    .el-input-number__increase {
      top: 6px;
    }
    .el-input-number__decrease {
      bottom: 6px;
    }
    .el-input__wrap .el-input--prefix .el-input__text{
      height: $--input-large-height;
      line-height: $--input-large-height;
    }

  }

  @include m(medium) {
    // line-height: 31px;

    .el-input-number__btn-increase,
    .el-input-number__btn-decrease {
      height: $--input-medium-height;
      width: $--input-medium-height;
    }
    .el-input-number__btn-increase{
      right: 8px;
    }
    .el-input-number__increase {
      top: 4px;
    }
    .el-input-number__decrease {
      bottom: 4px;
    }
    .el-input--prefix .el-input__text{
      height: $--input-medium-height;
      line-height: $--input-medium-height;
    }
  }

  @include m(small) {
    // line-height: 27px;

    .el-input-number__btn-increase,
    .el-input-number__btn-decrease {
      height: $--input-small-height;
      width: $--input-small-height;
    }
    .el-input-number__btn-increase{
      right: 16px;
    }
    .el-input-number__increase {
      top: 2px;
    }
    .el-input-number__decrease {
      bottom: 2px;
    }
    .el-input--prefix .el-input__text{
      height: $--input-small-height;
      line-height: $--input-small-height;
    }
  }

  @include e((increase, decrease)) {
    position: absolute;
    width: 18px;
    height: 12px;
    line-height: 12px;
    background-color: $--color-white;
    color: $--color-text-secondary;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    i {
      font-size: $--font-size-body-1;
    }

    &:hover {
      &:not(.is-disabled):not(.is-icon-disabled):not(.is-readable) {
        background-color: $--color-secondary;
      }
      &:not(.is-disabled) ~ .el-input .el-input__inner:not(.is-disabled):not(.is-readable) {
        border-color: $--color-primary !important;
      }

    }

    &:not(.is-icon-disabled):active {
      background-color: $--color-text-active;
    }

    &.is-disabled {
      color: $--disabled-color-base;
      cursor: not-allowed;
    }
  }

  @include e((btn-decrease, btn-increase)) {
    width: 36px;
    height: auto;
    background: $--color-white;
    border: $--border-1 solid $--color-border-3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: $--color-text-secondary;
    cursor: pointer;

    ~ .el-input{
      width: calc(100% - 72px);
      .el-input__inner{
        // border-radius: 0;
        border-radius: $--border-radius-none;
        padding-right: 12px;
      }
    }

    &:not(.is-disabled):hover {
      .el-input__suffix {
        display: none;
      }
    }
    &:not(.is-readable):hover {
      .el-input__suffix {
        display: none;
      }
    }

    &:not(.is-disabled):hover {
      border: $--border-1 solid $--color-text-placeholder;
    }

    &:active {
      border: $--border-1 solid $--color-text-placeholder;
      background-color: $--color-secondary;
    }

    i {
      font-size: $--font-size-title-1;
      padding: 10px;
    }

    &.is-disabled {
      color: $--color-secondary-active;
      cursor: not-allowed;
      background-color: $--color-fill-3;
    }
  }

  @include e(btn-decrease) {
    // border-radius: 4px 0px 0px 4px;
    border-radius: $--border-radius-medium $--border-radius-none $--border-radius-none $--border-radius-medium;
    // left: 1px;
    border-right-color: transparent;
  }

  @include e(btn-increase) {
    position: absolute;
    // border-radius: 0 4px 4px 0;
    border-radius: $--border-radius-none $--border-radius-medium $--border-radius-medium $--border-radius-none;
    right: 0px;
    border-left-color: transparent;
  }

  @include when(btn) {
    .el-input {
      // input {
      //   border-left: 0;
      //   border-right: 0;
      //   border-radius: 0;
      // }
      .el-input__inner {
        text-align: center;
      }
    }
    .el-input__inner:hover {
      border-right: $--border-1 solid $--color-info-semi;
      border-left: $--border-1 solid $--color-info-semi;
    }
    .el-input.is-focus > .el-input__wrap > .el-input__inner {
      border-right: $--border-1 solid $--color-primary;
      border-left: $--border-1 solid $--color-primary;
    }

    &.is-disabled{
      .el-input__inner:hover {
        border-right-color: $--color-disabled-border;
        border-left-color: $--color-disabled-border;
      }
    }
  }

.el-input--large .el-input__icon,
.el-input--large .el-input-group__append {
  font-size: $--font-size-title-1;
}

.el-input--prefix {
  .el-input__inner{
    padding-left: 30px;
  }
}

}
.is-btn{
  width: 200px;
}
