// TODO-p2: combine with TextInput.scss

.dry-textarea {
  width: 100%;
  text-align: left;
  label {
    margin: 0;
    width: 100%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    font-style: normal;
    color: var(--gray-700);

    /** Dry typography automatically removes margin from the last child, so that container padding-bottom can be reliably applied without accounting for text margin. Override this so that the default label spacing matches the spec. */
    & > .dry-typography:last-child,
    /** If custom label used, ensure consistent spacing. */
    & > :only-child {
      margin-top: 0;
      margin-bottom: 6px;
    }
  }

  // .error {
  //   @extend %text-input-error;
  // }

  textarea {
    gap: 8px;
    width: 100%;
    height: 150px;
    display: flex;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    align-items: center;
    flex-direction: row;
    box-sizing: border-box;
    color: var(--gray-900);
    border: 1px solid var(--gray-300, #d0d5dd);
    background-color: var(--background);
    box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);

    // TODO: replace with dry transition
    transition-duration: 0.2s;
    transition-timing-function: ease-in;
    transition-property: border-color, box-shadow;

    &--size-sm {
      height: 40px;
      padding: 8px 12px;
    }

    &--size-md {
      height: 44px;
      padding: 10px 14px;
    }

    &::placeholder {
      font-size: 16px;
      font-style: normal;
      font-weight: 400;
      line-height: 24px;
      color: var(--gray-500, #667085);
    }

    &:focus {
      /* Remove default browser focus styles */
      outline: none;

      border: 1px solid var(--primary-300);
      box-shadow: 0px 0px 0px 4px var(--primary-100),
        0px 1px 2px 0px rgba(16, 24, 40, 0.05);

      transition-duration: 0.2s;
      transition-timing-function: ease-out;
      transition-property: border-color, box-shadow;
    }

    &--error {
      border: 1px solid var(--error-300, #fda29b);
    }

    &--error:focus {
      /* Remove default browser focus styles */
      outline: none;

      border: 1px solid var(--error-300, #fda29b);
      box-shadow: 0px 0px 0px 4px #fee4e2,
        0px 1px 2px 0px rgba(16, 24, 40, 0.05);

      transition-duration: 0.2s;
      transition-timing-function: ease-out;
      transition-property: border-color, box-shadow;
    }

    &--disabled {
      cursor: not-allowed;
      transition-duration: 0.2s;
      color: var(--gray-500, #667085);
      transition-timing-function: ease-out;
      background-color: var(--gray-50, #f9fafb);
      transition-property: background-color, color;
    }
  }

  /* Relative context for absolutely positioned input adornments */
  &__adornmentContext {
    position: relative;
    margin-bottom: 16px;
  }

  &__hintText,
  &__errorMessage {
    margin-top: -10px;
  }
}
