@use 'pix-design-tokens/typography';
@use 'pix-design-tokens/breakpoints';
@use 'pix-design-tokens/fonts';
@use 'layout';

.form {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--pix-spacing-8x);

  &__field {
    display: flex;
    flex-direction: column;
    margin: var(--pix-spacing-4x) 0;

    @include breakpoints.device-is('desktop') {
      width: 500px;
    }

    &--wide input,
    select,
    textarea {
      width: 100%;
    }

    .form__radio-button:last-child {
      margin-bottom: 0;
    }
  }

  &__field-with-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-content: center;

    & > .form__field--wide {
      flex-grow: 1;
    }

    @include breakpoints.device-is('desktop') {
      max-width: 500px;
    }
  }

  &__field-info {
    display: flex;
    flex-direction: column;
    height: max-content;
    margin: var(--pix-spacing-4x) 0 0 0;
    padding: var(--pix-spacing-4x);
    color: var(--pix-neutral-500);
    color: var(--pix-neutral-500);
    font-size: 0.875rem;
    background: var(--pix-neutral-20);
    border-radius: 8px;

    @include breakpoints.device-is('desktop') {
      position: absolute;
      left: 100%;
      width: calc(100vw - 580px - #{layout.$app-sidebar-width} - 32px);
      margin: 0 0 0 var(--pix-spacing-4x);
    }

    &-icon {
      margin-right: var(--pix-spacing-2x);
      fill: var(--pix-primary-500);
    }

    &-title {
      @extend %pix-body-m;

      margin-bottom: var(--pix-spacing-2x);
      color: var(--pix-neutral-900);
      font-weight: 500;
    }

    &-message {
      @extend %pix-body-s;

      color: var(--pix-neutral-500);
    }
  }

  &__field-filters {
    margin-bottom: var(--pix-spacing-4x);
    padding: 0;
    border: 0;

    > legend {
      margin-bottom: 2px;
      color: var(--pix-neutral-20)0;
      font-size: 0.875rem;
    }

    .pix-selectable-tag {
      margin-top: var(--pix-spacing-2x);
      margin-inline-end: var(--pix-spacing-2x);
    }

    @include breakpoints.device-is('desktop') {
      max-width: 500px;
    }
  }

  &__validation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--pix-spacing-8x);

    @include breakpoints.device-is('desktop') {
      max-width: 500px;
    }
  }

  &__error {
    padding-top: var(--pix-spacing-1x);
  }

  &__information {
    margin-top: var(--pix-spacing-2x);
  }

  &__comment {
    font-weight: 400;
    font-style: italic;
  }

  &__mandatory-fields-information {
    margin: 0 0 var(--pix-spacing-8x) 0;
    color: var(--pix-neutral-800);
    font-size: 0.875rem;
  }

  abbr.mandatory-mark {
    padding-right: 5px;
    color: var(--pix-error-700);
    text-decoration: none;
    border: none;
    cursor: help;
  }
}

.input-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: var(--pix-spacing-6x);
}

.input {
  height: 36px;
  padding-left: var(--pix-spacing-4x);
  color: var(--pix-neutral-900);
  font-size: 0.875rem;
  border: 1px solid var(--pix-neutral-500);
  border-radius: 4px;
  outline: none;

  &:focus {
    border: 1px solid var(--pix-primary-500);
  }

  &--error {
    border: 1px solid var(--pix-error-700);
  }
}

.error-message {
  color: var(--pix-error-700);
  font-size: 0.75rem;
  font-family: fonts.$font-roboto;
}
