@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";

@include b(form) {
  @include m(label-left) {
    & .el-form-item__label {
      text-align: left;
    }
  }
  @include m(label-top) {
    & .el-form-item__label {
      float: none;
      display: inline-block;
      text-align: left;
      padding: 0 0 10px 0;
    }
  }
  @include m(inline) {
    & .el-form-item {
      display: inline-block;
      margin-right: 10px;
      vertical-align: top;
    }
    & .el-form-item__label {
      float: none;
      display: inline-block;
    }
    & .el-form-item__content {
      display: inline-block;
      vertical-align: top;
    }
    &.el-form--label-top .el-form-item__content {
      display: block;
    }
  }
}
@include b(form-item) {
  margin-bottom: 22px;
  @include utils-clearfix;

  & .el-form-item {
    margin-bottom: 0;
  }

  & .el-input__validateIcon {
    display: none;
  }

  @include m(medium) {
    .el-form-item__label {
      line-height: 36px;
    }
    .el-form-item__content {
      line-height: 36px;
    }
  }
  @include m(small) {
    .el-form-item__label {
      line-height: 32px;
    }
    .el-form-item__content {
      line-height: 32px;
    }
    &.el-form-item {
      margin-bottom: 18px;
    }
    .el-form-item__error {
      padding-top: 2px;
    }
  }
  @include m(mini) {
    .el-form-item__label {
      line-height: 28px;
    }
    .el-form-item__content {
      line-height: 28px;
    }
    &.el-form-item {
      margin-bottom: 18px;
    }
    .el-form-item__error {
      padding-top: 1px;
    }
  }

  @include e(label) {
    text-align: right;
    vertical-align: middle;
    float: left;
    font-size: 14px;
    color: $--color-text-regular;
    line-height: 40px;
    padding: 0 12px 0 0;
    box-sizing: border-box;
  }
  @include e(content) {
    line-height: 40px;
    position: relative;
    font-size: 14px;
    @include utils-clearfix;

    .el-input-group {
      vertical-align: middle;
    }
  }
  @include e(error) {
    color: $--color-danger;
    font-size: 12px;
    line-height: 1;
    position: absolute;
    white-space: nowrap;
    top: 100%;
    left: 5px;
    z-index: 11;
    padding: 5px;
    border:1px solid $--color-white;
    background: $--color-white;
    box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.12), 0 0 10px 1px rgba(0, 0, 0, 0.08);
    margin-top: 5px;
    &:before{
      position: absolute;
      top: -7px;
      left: 5px;
      content:'';
      display: inline-block;
      border: 4px solid transparent;
      border-left-width: 0;
      border-right-color: $--color-white;
      border-right-width: 5px;
      transform:rotate(90deg);
      z-index: 12;
    }
    &:after{
      position: absolute;
      top: -9px;
      left: 5px;
      content:'';
      display: inline-block;
      border: 5px solid transparent;
      border-left-width: 0;
      border-right-color: $--border-color-base;
      border-right-width: 6px;
      transform:rotate(90deg);
      z-index: 11;
    }

    @include m(inline) {
      position: relative;
      top: auto;
      left: auto;
      display: inline-block;
      margin-left: 10px;
    }
  }

  @include when(required) {
    .el-form-item__label:before {
      content: '*';
      color: $--color-danger;
      margin-right: 4px;
    }
  }

  @include when(error) {
    & .el-input__inner,
    & .el-textarea__inner {
      &, &:focus {
        border-color: $--color-danger;
      }
    }
    & .el-input-group__append,
    & .el-input-group__prepend {
      & .el-input__inner {
        border-color: transparent;
      }
    }
    .el-input__validateIcon {
      color: $--color-danger;
    }
  }
  @include when(success) {
    & .el-input__inner,
    & .el-textarea__inner {
      &, &:focus {
        border-color: $--color-success;
      }
    }
    & .el-input-group__append,
    & .el-input-group__prepend {
      & .el-input__inner {
        border-color: transparent;
      }
    }
    .el-input__validateIcon {
      color: $--color-success;
    }
  }
  @include m(feedback) {
    .el-input__validateIcon {
      display: inline-block;
    }
  }
}
