// 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.

@mixin is-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

@mixin input-baseline {
  display: block;
  position: relative;
  width: 100%;
  max-width: $max-line-length;
  margin: 0;
  padding: $small-spacing;
  transition-property: border-color, background-color;
  transition-duration: 250ms;
  transition-timing-function: ease-in-out;
  border: 1px solid $base-border-color;
  border-radius: $base-border-radius;
  background-color: $white;
  box-shadow: none;
  color: $text-body;
  font-family: $body-font-family;
  font-size: ms(0);
  line-height: $heading-line-height;

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

  &:disabled {
    opacity: $med-opaque;
    pointer-events: none;
  }

  &[readonly] {
    // Should transition to :read-only once we have AutoPrefixer setup
    padding-top: 0;
    padding-right: 0;
    padding-left: 0;
    border: 0;
    background-color: transparent;
  }

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

  &::placeholder {
    // ASA: https://github.com/okta/odyssey/pull/9
    opacity: 1;
    color: $text-sub;
  }
}
