$textarea-padding: var(--control-padding-horizontal, #{$control-padding-horizontal}) !default
$textarea-max-height: 40em !default
$textarea-min-height: 8em !default

$textarea-colors: $form-colors !default

%input-textarea
  @extend %input
  box-shadow: var(--input-shadow, #{$input-shadow})
  max-width: 100%
  width: 100%
  &[readonly]
    box-shadow: none
  // Colors
  @each $name, $pair in $textarea-colors
    $color: nth($pair, 1)
    &.is-#{$name}
      --focus-box-shadow-color-hsla: hsla(var(--#{$name}-h), var(--#{$name}-s), var(--#{$name}-l), 0.25)
      --focus-box-shadow-color: var(--focus-box-shadow-color-hsla, #{bulmaRgba($color, 0.25)})
      border-color: var(--#{$name}, #{$color})
      &:focus,
      &.is-focused,
      &:active,
      &.is-active
        box-shadow: var(--input-focus-box-shadow-size, #{$input-focus-box-shadow-size}) var(--focus-box-shadow-color)
  // Sizes
  &.is-small
    +control-small
  &.is-medium
    +control-medium
  &.is-large
    +control-large
  // Modifiers
  &.is-fullwidth
    display: block
    width: 100%
  &.is-inline
    display: inline
    width: auto

.input
  @extend %input-textarea
  &.is-rounded
    border-radius: var(--radius-rounded, #{$radius-rounded})
    padding-left: calc(#{var(--control-padding-horizontal, #{$control-padding-horizontal})} + 0.375em)
    padding-right: calc(#{var(--control-padding-horizontal, #{$control-padding-horizontal})} + 0.375em)
  &.is-static
    background-color: transparent
    border-color: transparent
    box-shadow: none
    padding-left: 0
    padding-right: 0

.textarea
  --textarea-padding: #{$textarea-padding}
  --textarea-max-height: #{$textarea-max-height}
  --textarea-min-height: #{$textarea-min-height}
  @extend %input-textarea
  display: block
  max-width: 100%
  min-width: 100%
  padding: var(--textarea-padding)
  resize: vertical
  &:not([rows])
    max-height: var(--textarea-max-height)
    min-height: var(--textarea-min-height)
  &[rows]
    height: initial
  // Modifiers
  &.has-fixed-size
    resize: none
