$text-area-bg: #fff !default;

.text-area {
  background-color: $text-area-bg;
  width: 100%;
  min-width: 10rem;
  min-height: 40px;
  padding: $input-btn-padding-y 1rem;
  color: $dark-gray-1;
  order: 3;
  resize: vertical;
  border: none;
  border: 1px solid $light-gray-2;
  border-radius: $border-radius;
  transition: outline ease .2s, background-color ease .2s, box-shadow ease .2s;

  & ~ .form__helper-text {
    margin-top: 0;
    order: 2;
    font-style: italic;
  }

  & ~ .form-requirement {
    order: 4;
    color: $danger;
    font-weight: 400;
    margin-top: $spacing-2xs;

    &::before {
      display: none;
    }
  }
}

.text-area:focus,
.text-area:active {
  border-color: $primary;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba($primary,.25);
}

.text-area::placeholder {
  color: $light-gray-1;
}

.text-area--invalid, .text-area--valid {
  padding-right: 2rem;
}

.text-area__wrapper {
  position: relative;
  display: flex;
}

.text-area__invalid-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  fill: $danger;
}

.text-area__valid-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  fill: $success;
}

//-----------------------------
// Disabled
//-----------------------------
.text-area:disabled {
  cursor: not-allowed;
  outline: none;
  background-color: $light-gray-2;
  border: 1px solid $light-gray-1;
  color: $dark-gray-3;
}

.text-area:disabled::placeholder {
  opacity: 1;
  color: lighten($light-gray-1, .1); //TODO
}

// Skeleton State
.text-area.skeleton {
  @include skeleton;
  height: 100px;

  &::placeholder {
    color: transparent;
  }
}

//-----------------------------
// Error
//-----------------------------
.text-area--invalid {
  box-shadow: none;
  border-color: $danger;
  padding-right: 2rem;

  &:active, &:focus {
    border-color: $danger;
  }

  &:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba($danger,.25);
  }
}

//-----------------------------
// Valid
//-----------------------------
.text-area--valid {
  box-shadow: none;
  border-color: $success;
  padding-right: 2rem;

  &:active, &:focus {
    border-color: $success;
  }

  &:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba($success,.25);
  }
}
