@use './_theme';

$breakpoint-linear-form: theme.$sm;

.form-field {
  @media (width > $breakpoint-linear-form) {
    align-items: center;
    column-gap: 15px;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }
}

.form-field-label {
  color: var(--text-color-ultra-dark);
  font-size: var(--text-size-label);
}

.form-field-required .form-field-label::after {
  color: var(--color-error);
  content: '*';
}

.form-field-input {
  border: 1px solid var(--color-line);
  border-radius: var(--form-input-border-radius);
  color: var(--text-color-dark);
  font-size: var(--text-size-regular);
  height: 40px;
  padding: 0 15px;


  &:focus {
    outline: 2px auto var(--text-color-ultra-dark) !important;
  }

  @media (width <= $breakpoint-linear-form) {
    display: block;
    margin: 10px 0 0;
    width: 100%;
  }
}

.form-field-select-wrapper {
  position: relative;

  select.form-field-input {
    appearance: none;
    padding-right: 36px;
    width: 100%;
  }

  .form-field-select-arrow {
    pointer-events: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
  }
}

.form-field-date-wrapper {
  position: relative;

  input.form-field-input {
    padding-right: 36px;
    width: 100%;

    &::-webkit-calendar-picker-indicator {
      opacity: 0;
      position: absolute;
      right: 0;
      top: 0;
      width: 100%;
      height: 100%;
      cursor: pointer;
    }
  }

  .form-field-date-icon {
    pointer-events: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
  }
}

.form-field-invalid .form-field-input {
  border-color: var(--color-error);
}

.form-field-error {
  color: var(--color-error);
  font-size: var(--text-size-fineprint);
  grid-column: 2;
  margin: 6px 0 0;
}
