.form-group {
  display: grid;
  padding: var(--spacing-spa-sm);
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  border-radius: var(--radius-rad-alt);
  outline: 1px solid var(--surface-effect-overlay-lower);
  outline-offset: -1px;
  background: var(--surface-effect-overlay-inverse);
  transition: all 0.24s;
  gap: 4px;
  grid-template-columns: minmax(auto, 100%) minmax(auto, max-content);
  grid-template-areas: "a b"
        "c c";

  .form-control-infos {
    grid-area: b;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    grid-column-gap: 8px;
    line-height: 1;

    &.supplementary {
      grid-area: d;
    }
  }

  .form-control-label {
    grid-area: a;
    color: var(--text-content-main-alt);
    font-size: var(--typos-font-size-body-fs-sm);
    line-height: var(--typos-lineheight-body-lh-sm);
    display: flex;
    align-items: center;
    grid-column-gap: 8px;
    transition: all .24s ease;
  }

  .form-control-wrapper {
    grid-area: c;
    row-gap: 8px;

    .form-control {
      width: 100%;
      border: 0;
      outline: none;
      box-shadow: none;
      padding: 0;
      margin: 0;
      color: var(--text-content-main-alt);
      background: inherit;
      transition: all 0.24s;

      &::placeholder {
        font-style: italic;
        color: var(--text-content-complement);
      }
    }
  }

  &:not(.form-field-radios, .form-field-checkboxes, .form-field-checkbox) {
    &:after {
      content: "";
      position: absolute;
      width: 0;
      top: calc(100% - 1px);
      left: 50%;
      transform: translate(-50%, 0);
      height: 1px;
      background: transparent;
      transition: width 0.24s, background 0.24s;
    }

    &:hover {
      &:after {
        width: calc(100% - (2 * var(--radius-rad-alt)));
        background: #CD001A;
      }
    }
  }

  &:not(.form-field-radios, .form-field-checkboxes, .form-field-checkbox):not(:focus-within):hover {
    outline-color: var(--surface-effect-overlay-high) !important;
    background: var(--surface-zone-light-highest);
  }

  &:focus-within {
    outline: 2px solid var(--surface-zone-dark-highest);
    outline-offset: -2px;
    background: var(--surface-light-highest);
    box-shadow: 1px 1px 0 0 var(--surface-zone-dark-highest) inset, -1px -1px 0 0 var(--surface-zone-dark-highest) inset, 0 -1px 0 0 var(--surface-zone-dark-highest) inset, 0 1px 0 0 var(--surface-zone-dark-highest) inset, -1px 2px 0 0 var(--surface-zone-light-highest) inset, 2px -1px 0 0 var(--surface-zone-light-highest) inset, 2px 2px 0 0 var(--surface-zone-light-highest) inset, -2px -2px 0 0 var(--surface-zone-light-highest) inset;
  }

  &.form-group--has-button {
    grid-template-areas:
            "a b"
            "c d";
  }

  &.not-empty {
    outline: 2px solid var(--surface-zone-dark-highest);
    outline-offset: -2px;
    background: var(--surface-zone-light-highest);
  }

  &:has(.form-control:disabled) {
    pointer-events: none;
    background: var(--surface-effect-overlay-inverse-lower);
    outline-color: var(--surface-effect-overlay-lower);


    .form-control-label,
    .form-control-wrapper,
    .form-control-infos {
      opacity: 0.24;
    }
  }
}

.form-group-inline {
  width: 100%;

  &.form-group:not(.form-field-textarea) {
    align-items: center;
    grid-column-gap: 16px;
    grid-template-areas: inherit;
    grid-template-columns: minmax(auto, max-content) minmax(auto, auto) minmax(auto, max-content);
    padding: var(--dimensions-10px-1-25u-0-625rem) var(--spacing-spa-sm);

    .form-control-label,
    .form-control-wrapper,
    .form-control-infos {
      grid-area: inherit;
    }

    .form-control-label {
      font-size: var(--typos-font-size-body-fs-sm);
      line-height: var(--typos-lineheight-body-lh-sm);
    }

    .form-control-wrapper {
      .form-control {
        font-size: var(--typos-font-size-body-fs-sm);
        line-height: var(--typos-lineheight-body-lh-sm);
      }
    }

    &.form-field-password,
    &.form-field-date,
    &.form-field-file {
      grid-template-columns: minmax(auto, max-content) minmax(auto, auto) minmax(auto, max-content) minmax(auto, max-content);

      .form-control-infos {
        order: 2;

        &.supplementary {
          order: 1;
        }
      }
    }

    &.form-group--has-button {
      grid-template-columns: minmax(auto, max-content) minmax(auto, auto);

      .form-control-infos {
        order: 2;

        &.supplementary {
          order: 1;
        }
      }
    }

    &.form-field-file {
      .form-control-wrapper {
        .form-control {
          line-height: 1;
        }
      }
    }

    &.form-field-date {
      .form-control {
        position: relative;
        overflow: visible;
      }

      input[type="date"]::-webkit-inner-spin-button,
      input[type="date"]::-webkit-calendar-picker-indicator {
        right: 0;
        bottom: 0;
        top: 50%;
        transform: translate(calc(100% + 8px), -50%);
      }
    }
  }

  &.form-group.form-field-textarea {
    &.form-control-label {

      font-size: var(--typos-font-size-body-fs-sm);
      line-height: var(--typos-lineheight-body-lh-sm);
    }

  }
}

.checkbox {
  padding: var(--margins-padding-mp-3xs);
  display: flex;
  align-items: center;

  .checkbox__label {
    display: flex;
    align-items: center;
    color: var(--text-content-main);
    font-size: var(--typos-font-size-body-fs-sd);
    font-style: normal;
    font-weight: 400;
    line-height: var(--typos-lineheight-body-lh-lg);
    width: 100%;
    .checkbox__label-text {
      padding-left: 10px;
    }

    .icon-checkmark {
      border: 2px solid var(--text-content-main);
      border-radius: 0;
      width: 20px;
      height: 20px;
      min-width: 20px;
      background: var(--surface-effect-overlay-inverse-lower);
    }
  }

  input:checked {
    & + .checkbox__label {
      .icon-checkmark {
        background: var(--text-action-selected);
        border-color: var(--text-action-selected);
      }
    }
  }

  &:hover {
    background: var(--surface-effect-overlay-lowest);
    .checkbox__label {
      color: var(--text-content-main-alt);
      .icon-checkmark {
        background: var(--surface-effect-overlay-inverse);
        border-color: var(--surface-action-uno-hover);
      }
    }

    input:checked {
      & + .checkbox__label {
        color: var(--text-content-main-alt);
        .icon-checkmark {
          background: var(--text-action-selected);
          border-color: var(--text-action-selected);
        }
      }
    }
  }
  &.checkbox--disabled {
    pointer-events: none;
  }
}