@use "sass:color";

*,
.context,
.ad.hoc {
  &.container {
    display: inline-flex;
    flex-wrap: wrap;
    margin: 0.1em;
    position: relative;
  }

  &.label {
    margin: 0 0.3em;
  }

  &.textarea {
    background: white;
    border: 1px solid gray;
    border-radius: 0.3em;
    box-sizing: border-box;
    font: inherit;
    height: 0;
    outline: none;
    overflow: hidden;
    padding: 0.3em 0.3em calc(0.3em + 1px);
    resize: none;
    width: 100%;

    &:focus {
      border-color: blue;
      box-shadow: 0 0 3px 1px lightblue;
    }

    &::placeholder {
      color: gray;
    }

    &:disabled {
      border-color: color.adjust($color: gray, $alpha: -0.66);
      cursor: not-allowed;
      color: color.adjust($color: gray, $alpha: -0.66);
      user-select: none;
    }
  }

  &.error &.textarea {
    border-color: red;

    &:focus { box-shadow: 0 0 3px 1px orangered }
  }

  &.errorMessage {
    color: red;
    font-size: 0.8em;
    font-style: italic;
    padding-right: 0.6em;
    text-align: right;
    width: 100%;
  }

  &.hidden {
    // NOTE: We hide it this way, as setting "display: none" will interfere
    // with measurements, making the hidden input height zero.
    opacity: 0;
    position: absolute;
  }
}
