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

$inputPrefixCls: #{$vender-prefix}-input;
$inputPasswordPrefixCls: #{$vender-prefix}-input-password;
$textareaPrefixCls: #{$vender-prefix}-textarea;
$groupPrefixCls: #{$vender-prefix}-input-group;

// $inputColor: $primary-color;
$inputColor: var(--primary-color);

.#{$inputPrefixCls} {
  @include reset-component2;

  height: $ipt-height;
  padding: 0 0.6em;
  color: inherit; // transition: border-color 0.1s ease;
  vertical-align: middle;
  background-color: white;
  border: 1px solid $border-color-split;
  border-top-color: $border-color-base;
  border-radius: $border-radius-sm;
  transition: $transition-all;
  -webkit-appearance: none;

  &:not([disabled]):focus {
    border-color: $inputColor; // box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
    border-width: 1px;
    outline: none;
    box-shadow: $focus-shadow;
  }

  &:not([disabled]):hover {
    border-color: $inputColor;
    border-width: 1px;
  }

  &[disabled] {
    color: $ipt-disabled-color;
    cursor: not-allowed;
    background-color: $ipt-disabled-bg-color;
  }

  &::placeholder {
    color: $placeholder-color;
  }

  // Reset height for `textarea`s
  &.#{$textareaPrefixCls} {
    height: auto;
    max-width: 100%; // prevent textearea resize from coming out of its container
    vertical-align: bottom;
  }

  // Reset webkit-autofill
  &:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px white inset;
    box-shadow: 0 0 0 1000px white inset;
    -webkit-text-fill-color: #333;
  }
}

.#{$inputPrefixCls}-sm {
  height: $ipt-height-sm;
  padding: 0 0.3em;
}

.#{$inputPrefixCls}-lg {
  height: $ipt-height-lg;
  padding: 0 1em;
}

// emove IE clearfield
.#{$inputPrefixCls}::-ms-clear {
  display: none;
}

// textarea
.#{$textareaPrefixCls} {
  padding: 0.5em 0.6em;
}

// password
// ---

.#{$inputPasswordPrefixCls} {
  position: relative;

  .eye-content {
    position: absolute;
    top: 0;
    right: 10px;
    font-size: 12px;
    line-height: $ipt-height;
    color: #ccc;
    cursor: pointer;

    &.eye-active {
      .aficon {
        color: black;
      }
    }
  }

  &.#{$inputPasswordPrefixCls}-sm {
    .eye-content {
      line-height: $ipt-height-sm;
    }
  }

  &.#{$inputPasswordPrefixCls}-lg {
    .eye-content {
      line-height: $ipt-height-lg;
    }
  }
}

// group
// ---
.#{$groupPrefixCls} {
  position: relative;
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;

  &.#{$groupPrefixCls}-tight {
    display: block;

    & > * {
      display: inline-block;
      float: none;
      vertical-align: top;
      border-right-width: 0;
      border-radius: 0;
    }

    .#{$inputPrefixCls} {
      z-index: auto;
      float: none;
    }

    & > :last-child {
      border-right-width: 1px;
    }

    &::after,
    &::before {
      display: table;
      content: ' ';
    }

    &::after {
      height: 0;
      clear: both;
      font-size: 0;
      visibility: hidden;
    }
  }
}
