@use "../base";
@use "../functions" as *;
@use "./Input";

$text-color: Input.$text-color !default;
$background-color: Input.$background-color !default;
$border-color: Input.$border-color !default;
$border-radius: Input.$border-radius !default;

.TextArea {
  position: relative;
  display: inline-block;
  border: base.em(1px) solid $border-color;
  border: base.em(1px) solid rgba($border-color, 0.75);
  border-radius: $border-radius;
  background-color: $background-color;
  margin-right: base.em(2px);
  line-height: base.em(17px);
  box-sizing: border-box;
  width: 100%;
}

.TextArea--fluid {
  display: block;
  width: auto;
  height: auto;
}

.TextArea--noborder {
  border: 0px;
}

.TextArea__textarea.TextArea__textarea--scrollable {
  overflow: auto;
  overflow-x: hidden;
  overflow-y: scroll;
}

.TextArea__textarea {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border: 0;
  outline: 0;
  width: 100%;
  height: 100%;
  font-size: 1em;
  line-height: base.em(17px);
  min-height: base.em(17px);
  margin: 0;
  padding: 0 0.5em;
  font-family: inherit;
  background-color: transparent;
  color: inherit;
  box-sizing: border-box;
  // Make sure the div and the textarea wrap words in the same way
  word-wrap: break-word;
  overflow: hidden;

  &:-ms-input-placeholder {
    font-style: italic;
    color: hsl(0, 0%, 46.7%);
    color: hsla(0, 0%, 100%, 0.45);
  }
}

.TextArea__textarea_custom {
  overflow: visible;
  white-space: pre-wrap;
}

.TextArea__nowrap {
  white-space: nowrap;
  overflow-wrap: normal;
  overflow-x: scroll;
}
