@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@yee-input-number-prefix-cls: ~'@{yee-prefix}-input-number';

.@{yee-input-number-prefix-cls} {
  .yee-reset-component;
  .yee-input;

  display: inline-block;
  width: 90px;
  margin: 0;
  padding: 0;
  border: @yee-border-width-base @yee-border-style-base @yee-border-color-base;
  border-radius: @yee-border-radius-base;

  &-handler {
    position: relative;
    display: block;
    width: 100%;
    height: 50%;
    overflow: hidden;
    color: @yee-text-color-secondary;
    font-weight: bold;
    line-height: 0;
    text-align: center;
    transition: all 0.1s linear;
    &:active {
      background: @yee-input-number-handler-active-bg;
    }
    &:hover &-up-inner,
    &:hover &-down-inner {
      color: @yee-input-number-handler-hover-bg;
    }
  }

  &-handler-up-inner,
  &-handler-down-inner {
    .yee-iconfont-mixin();

    position: absolute;
    right: 4px;
    width: 12px;
    height: 12px;
    color: @yee-text-color-secondary;
    line-height: 12px;
    transition: all 0.1s linear;
    user-select: none;
  }

  &:hover {
    .yee-hover(@yee-input-number-hover-border-color);
  }

  &-focused {
    .yee-active();
  }

  &-disabled {
    .yee-disabled();
    .@{yee-input-number-prefix-cls}-input {
      cursor: not-allowed;
    }
    .@{yee-input-number-prefix-cls}-handler-wrap {
      display: none;
    }
  }

  &-input {
    width: 100%;
    height: @yee-input-height-base - 2px;
    padding: 0 @yee-control-padding-horizontal - 1px;
    text-align: left;
    background-color: transparent;
    border: 0;
    border-radius: @yee-border-radius-base;
    outline: 0;
    transition: all 0.3s linear;
    -moz-appearance: textfield !important;
    .yee-placeholder();

    &[type='number']::-webkit-inner-spin-button,
    &[type='number']::-webkit-outer-spin-button {
      margin: 0;
      -webkit-appearance: none;
    }
  }

  &-lg {
    padding: 0;
    font-size: @yee-font-size-lg;

    input {
      height: @yee-input-height-lg - 2px;
    }
  }

  &-sm {
    padding: 0;

    input {
      height: @yee-input-height-sm - 2px;
      padding: 0 @yee-control-padding-horizontal-sm - 1px;
    }
  }

  &-handler-wrap {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 100%;
    background: @yee-input-number-handler-bg;
    border-left: @yee-border-width-base @yee-border-style-base @yee-input-number-handler-border-color;
    border-radius: 0 @yee-border-radius-base @yee-border-radius-base 0;
    opacity: 0;
    transition: opacity 0.24s linear 0.1s;

    // Fix input number inside Menu makes icon too large
    // We arise the selector priority by nest selector here
    // https://github.com/ant-design/ant-design/issues/14367
    .@{yee-input-number-prefix-cls}-handler {
      .@{yee-input-number-prefix-cls}-handler-up-inner,
      .@{yee-input-number-prefix-cls}-handler-down-inner {
        .yee-iconfont-size-under-12px(7px);

        min-width: auto;
        margin-right: 0;
      }
    }
  }

  &-handler-wrap:hover &-handler {
    height: 40%;
  }

  &:hover &-handler-wrap {
    opacity: 1;
  }

  &-handler-up {
    border-top-right-radius: @yee-border-radius-base;
    cursor: pointer;
    &-inner {
      top: 50%;
      margin-top: -5px;
      text-align: center;
    }
    &:hover {
      height: 60% !important;
    }
  }

  &-handler-down {
    top: 0;
    border-top: @yee-border-width-base @yee-border-style-base @yee-border-color-base;
    border-bottom-right-radius: @yee-border-radius-base;
    cursor: pointer;
    &-inner {
      top: 50%;
      margin-top: -6px;
      text-align: center;
    }
    &:hover {
      height: 60% !important;
    }
  }

  &-handler-up-disabled,
  &-handler-down-disabled {
    cursor: not-allowed;
  }

  &-handler-up-disabled:hover &-handler-up-inner,
  &-handler-down-disabled:hover &-handler-down-inner {
    color: @yee-disabled-color;
  }
}
