:host {
  /**
   * @prop --background: Background of the textarea
   *
   * @prop --color: Color of the textarea text
   *
   * @prop --padding-top: Top padding of the textarea
   * @prop --padding-end: Right padding if direction is left-to-right, and left padding
   *                      if direction is right-to-left of the textarea
   * @prop --padding-bottom: Bottom padding of the textarea
   * @prop --padding-start: Left padding if direction is left-to-right, and right padding
   *                        if direction is right-to-left of the textarea
   *
   * @prop --placeholder-color: Color of the textarea placeholder text
   * @prop --placeholder-font-style: Font style of the textarea placeholder text
   * @prop --placeholder-font-weight: Font weight of the textarea placeholder text
   * @prop --placeholder-opacity: Opacity of the textarea placeholder text
   * @prop --placeholder-transition-delay: Transition delay of the textarea placeholder text
   */
  --placeholder-color: initial;
  --placeholder-font-style: initial;
  --placeholder-font-weight: initial;
  --padding-top: 10px;
  --padding-end: calc(var(--bkkr-spacer, 16px) * 0.5);
  --padding-bottom: 10px;
  --padding-start: 0;
  --background: transparent;
  --color: initial;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: flex;
  position: relative;
  flex: 1;
  width: 100%;
  background: var(--background);
  color: var(--color);
  font-family: var(--bkkr-font-family);
  white-space: pre-wrap;
  touch-action: manipulation;
  z-index: 2;
  box-sizing: border-box;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  :host {
    padding-left: unset;
    padding-right: unset;
    -webkit-padding-start: 0 !important;
    padding-inline-start: 0 !important;
    -webkit-padding-end: 0 !important;
    padding-inline-end: 0 !important;
  }
}

:host-context(bkkr-item) {
  align-self: baseline;
}

:host-context(bkkr-item:not(.item-label)) {
  --padding-start: 0px;
}

.textarea-wrapper {
  display: grid;
  width: 100%;
  min-width: inherit;
  max-width: inherit;
  min-height: inherit;
  max-height: inherit;
}
.textarea-wrapper::after {
  white-space: pre-wrap;
  content: attr(data-replicated-value) " ";
  visibility: hidden;
}

.textarea-wrapper::after,
.native-textarea {
  padding-left: var(--padding-start);
  padding-right: var(--padding-end);
  padding-top: var(--padding-top);
  padding-bottom: var(--padding-bottom);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-style: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-decoration: inherit;
  text-indent: inherit;
  text-overflow: inherit;
  text-transform: inherit;
  white-space: inherit;
  grid-area: 1/1/2/2;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  .textarea-wrapper::after,
.native-textarea {
    padding-left: unset;
    padding-right: unset;
    -webkit-padding-start: var(--padding-start);
    padding-inline-start: var(--padding-start);
    -webkit-padding-end: var(--padding-end);
    padding-inline-end: var(--padding-end);
  }
}

.native-textarea {
  margin-left: 0;
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  box-sizing: border-box;
  resize: none;
  appearance: none;
}
.native-textarea::placeholder {
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  padding-bottom: 0;
  transition: opacity 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  transition-delay: var(--placeholder-transition-delay, none);
  color: var(--placeholder-color);
  font-family: inherit;
  font-style: var(--placeholder-font-style);
  font-weight: var(--placeholder-font-weight);
  opacity: var(--placeholder-opacity, 0.5);
}

.native-textarea[disabled]:not(.cloned-input) {
  cursor: initial;
  opacity: 0.3;
  user-select: none;
  pointer-events: none;
}

.cloned-input {
  left: 0;
  top: 0;
  position: absolute;
  pointer-events: none;
}
[dir=rtl] .cloned-input, :host-context([dir=rtl]) .cloned-input {
  left: unset;
  right: unset;
  right: 0;
}

/**
 * The cloned input needs to be disabled on
 * Android otherwise the viewport will still
 * shift when running scroll assist.
 */
.cloned-input:disabled {
  opacity: 1;
}

:host([auto-grow=true]) .cloned-input {
  height: 100%;
}

:host([auto-grow=true]) .native-textarea {
  overflow: hidden;
}