// Copyright 2018-Present Okta, Inc.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

.text-input {
  display: block;
  position: relative;
  width: 100%;
  max-width: $max-line-length;
  margin: 0;
  padding: $small-spacing;
  transition-property: border-color, background-color, box-shadow;
  transition-duration: $base-duration;
  transition-timing-function: $base-timing;
  border: 1px solid $base-border-color;
  border-radius: $base-border-radius;
  background-color: $white;
  box-shadow: 0 0 0 0 fauxpacity(cv('action', 'base'));
  color: $text-body;
  font-family: $body-font-family;
  font-size: ms(0);
  line-height: $heading-line-height;

  &:hover,
  &:focus {
    border-color: cv('action');
  }

  &:focus {
    outline: 0;
    box-shadow: 0 0 0 4px fauxpacity(cv('action', 'base'));
  }

  &:disabled {
    opacity: 1;
    color: $text-sub;
    cursor: not-allowed;
  }

  &:disabled,
  &[readonly] {
    border-color: cv('gray', '200');
    background: cv('gray', '000');

    &:hover {
      border-color: cv('gray', '200');
    }
  }

  &[data-invalid] {
    border-color: cv('danger');

    &:focus {
      box-shadow: 0 0 0 4px fauxpacity(cv('danger', 'base'));
    }
  }

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

.text-area {
  min-width: $base-spacing;
  max-width: $max-line-length;
  min-height: $base-spacing * 2;
}
