@import "../base/helpers";

som-checkbox-group,
som-radio-button-group {
  fieldset {
    margin-bottom: 1rem;
  }

  legend {
    font-size: $font-size-base;
    margin-bottom: 0.25rem;

    .text-optional {
      @include text-optional;
    }

    &.indeterminate-group {
      som-checkbox .form-group {
        margin-bottom: 0;
      }
    }
  }

  .grouped-content {
    padding: 0.5rem 0.5rem 0.5rem 0;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s;

    &.is-invalid {
      border-color: $red;
      padding-left: 0.5rem;
    }

    &.grouped-content-inline {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;

      > * {
        margin-right: 1.25rem;

        &:last-child {
          margin-left: 0;
        }
      }
      som-checkbox {
        .custom-checkbox {
          margin-bottom: 0;
        }
      }
      som-radio-button {
        .custom-radio {
          margin-bottom: 0;
        }
      }
    }
    som-checkbox {
      .custom-checkbox {
        margin-bottom: 0.5rem;
      }
      &:last-of-type {
        .custom-checkbox {
          margin-bottom: 0;
        }
      }
    }
    som-radio-button {
      .custom-radio {
        margin-bottom: 0.5rem;
      }
      &:last-of-type {
        .custom-radio {
          margin-bottom: 0;
        }
      }
    }
  }

  .text-error {
    color: $red;
  }
}
