.clearfix() {
  &::after {
    content: "";
    display: block;
    clear: both;
  }
}

.absolute() {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  top: 0;
}

.li-hover() {
  cursor: pointer;
  &:hover {
    background-color: @hover-background-color;
  }

  &.disabled{
    cursor: default;
    &:hover {
      background-color: transparent;
    }
  }
}

.text-hover() {
  cursor: pointer;
  transition: color @transition-time ease;
  &:hover, .@{pop-ref-prefix} &{
    color: darken(@link-color, 10%) !important;
  }
  &[disabled] {
    color: @disabled-color;
    cursor: default;
  }
}

.tag-span-func() {
  margin-bottom: 2px;
  display: inline-block;
  border-radius: @border-radius;
  transition: all linear @transition-time;
  margin-right: 5px;

  color: @tag-color;
  border: 1px solid @white-color;
  background-color: @tag-background-color;
  font-size: @font-size-input-tag;
  padding: 0px 8px;
  line-height: @input-height - 8px;
  >.@{select-close-prefix} {
    .text-hover();
    margin-left: 5px;
  }
}


.border-input() {
  cursor: default;
  background-color: @white-color;
  border-radius: @border-radius;
  border: @border;
  vertical-align: top;
  transition: all linear @transition-time;
  padding: 2px 2px 0px 2px;
  font-size: @font-size-mini;
  position: relative;
  box-sizing: border-box;
  &:hover {
    border-color: lighten(@primary-color, 10%);
  }
  &.@{pop-ref-prefix}, &.focusing {
    border-color: @primary-color;
    box-shadow: 0 0 0 2px fade(@primary-color, 20%);
  }

  .@{prefix}form-item-valid-error &{
    border-color: @red-color;
    &:focus, &.focusing{
      box-shadow: 0 0 0 2px fade(@red-color, 20%);
    }
  }
}


.border-input-inside-input() {
  flex: 1;
  min-width: 80px;
  width: auto;
  max-width: 100%;
  border-color: transparent !important;
  line-height: @font-size-input;
  font-size: @font-size-input;
  height: @input-height - 6px;
  margin-bottom: 2px;
  padding-left: 5px;
  &:focus{
    box-shadow: none !important;
  }
}

.plugin-input(@css-prefix) {
  .@{css-prefix}{
    display: inline-block;
    box-sizing: border-box;
    vertical-align: middle;
    &-placeholder {
      color: @gray-color;
    }
    &-value-single,
    &-placeholder {
      line-height: @input-height - 6px;
      height: @input-height - 6px;
      padding-left: 5px;
      .text-ellipsis;
    }
    &-show {
      padding-right: 25px !important;
      .rotate-icon-down();
      position: relative;
      .text-hover();
      cursor: default;
      line-height: @line-height;
    }
    &-multiple-tags {
      display: flex;
      flex-wrap: wrap;
      >span {
        .tag-span-func();
      }
    }
    &-input-border {
      .@{css-prefix}{
        &-show {
          min-height: @input-height;
          .border-input();
          .@{prefix}form-item-valid-error & {
            border-color: @red-color;
            &.@{pop-ref-prefix} {
              box-shadow: 0 0 0 2px fade(@red-color, 20%);
            }
          }
        }
        &-value-single,
        &-placeholder {
          margin-bottom: 2px;
        }
      }
    }
    &-no-autosize {
      display: block;
    }
    &-disabled &-show {
      .border-input-disabled();
    }
  }
}

.border-input-disabled() {
  background-color: @disabled-background-color;
  color: @disabled-color !important;
  border-color: @disabled-border-color;
  &:hover {
    border-color: @disabled-border-color;
    color: @disabled-color !important;
  }
  .h-icon-down {
    color: @disabled-color !important;
  }
}

.middle() {
  position: absolute;
  top: 50%;
  transform: translate(0%, -50%);
}

.middle-center() {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.middle-right() {
  position: absolute;
  top: 50%;
  right: 0;
  top: 50%;
  transform: translate(0%, -50%);
}



.rotate-icon-down(@hasColor: true){
  >.h-icon-down {
    position: absolute;
    right: 8px;
    top: 50%;
    height: 10px;
    line-height: 12px;
    transform: translate(0, -50%);
    transition: all @transition-time;
  }
  &:hover when (@hasColor){
    >.h-icon-down {
      color: @primary-color;
    }
  }
  &.@{pop-ref-prefix}>.h-icon-down {
    transform: rotate(-180deg) translate(0, 50%);

    & when (@hasColor){
      color: @primary-color;
    }
  }
}


.h-tag-color(@color){
  color: darken(@color, 10%);
  background: lighten(average(@color, #FFF), 10%);
  border-color: lighten(average(@color, #FFF), 10%);
}

.h-tag-bg-color(@color){
  color: @white-color;
  background: lighten(@color, 3%);
  border-color: lighten(@color, 3%);
}