@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../input/style/mixin";

@input-number-prefix-cls: ~"@{dt-prefix}-input-number";

.@{input-number-prefix-cls} {
  .reset-component;
  .input;
  margin: 0;
  padding: 0;
  display: inline-block;
  vertical-align: middle;
  border: @border-width-base @border-style-base @border-color-base;
  border-radius: @border-radius-base;
  width: 100px;
  overflow: hidden;

  &-handler {
    text-align: center;
    line-height: 0;
    height: 100%;
    overflow: hidden;
    color: @text-color-secondary;
    position: absolute;
    transition: all 0.1s linear;
    display: block;
    width: 18px;
    font-weight: bold;
    &:active {
      background: #f4f4f4;
    }
    &:hover &-up-inner,
    &:hover &-down-inner {
      color: @primary-5;
    }
  }

  &-handler-up-inner,
  &-handler-down-inner {
    .iconfont-mixin();
    line-height: 12px;
    user-select: none;
    position: absolute;
    width: 12px;
    height: 12px;
    .iconfont-size-under-12px(9px);
    left: 2px;
    color: #666;
  }

  &:hover {
    .hover();
  }

  &-focused {
    .active();
  }

  &-disabled {
    .disabled();

    .@{input-number-prefix-cls}-input {
      cursor: not-allowed;
      background-color: @disabled-bg;
    }
    .@{input-number-prefix-cls}-handler-wrap {
      //display: none;
      cursor: not-allowed;
      pointer-events: none;
    }
  }

  &-input {
    width: 100%;
    text-align: center;
    outline: 0;
    -moz-appearance: textfield;
    height: @input-height-base - 2px;
    transition: all 0.3s linear;
    color: @input-color;
    background-color: @input-bg;
    border: 0;
    border-radius: @border-radius-base;

    display: block;
    z-index: 3;
    position: absolute;
    .placeholder();

    &[disabled] {
      .disabled();
    }
  }

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

    input {
      height: @input-height-lg - 2px;
    }
    &-handler {
      height: 10px;
    }
  }

  &-sm {
    padding: 0;

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

  &-input-wrap {
    margin: 0 @control-padding-horizontal + 9px;
    height: 100%;
    position: relative;
  }

  &-handler-wrap {
    //border-left: @border-width-base @border-style-base @border-color-base;
    width: 100%;
    height: 100%;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    //border-radius: 0 @border-radius-base @border-radius-base 0;
    transition: opacity 0.24s linear 0.1s;
    z-index: 2; // https://github.com/dt-design/dt-design/issues/6289
  }

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

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

  &-handler-up {
    border-left: @border-width-base @border-style-base @border-color-base;
    cursor: pointer;
    top: 0;
    right: 0;
    &-inner {
      top: 50%;
      margin-top: -6px;
      font-size: 20px;
      &:before {
        text-align: center;
        content: @icon-plus;
      }
    }
    //&:hover {
    //  border-left: @border-width-base @border-style-base @primary-5;
    //}
  }

  &-handler-down {
    border-right: @border-width-base @border-style-base @border-color-base;
    top: 0;
    left: 0;
    cursor: pointer;
    &-inner {
      top: 50%;
      margin-top: -6px;
      font-size: 20px;
      &:before {
        text-align: center;
        content: @icon-minus;
      }
    }
    //&:hover {
    //  border-right: @border-width-base @border-style-base @primary-5;
    //}
  }

  &-handler-up-disabled,
  &-handler-down-disabled {
    cursor: not-allowed;
    background-color: @disabled-bg;
    span {
      color: #ccc;
    }
  }

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