/* Legacy-parity text rendering: the old Creditas site sets
 * -webkit-font-smoothing: antialiased globally, which renders type
 * lighter/thinner on macOS. Webflow Code Components live in isolated
 * shadow roots, so this must be declared per-component on :host to
 * inherit into the shadow tree (the property does not cross the
 * shadow boundary). Without it, Blink defaults to subpixel smoothing
 * and identical 400-weight text looks heavier than the old site. */
:host {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/**
 * CheckboxGroupField — multi-select checkbox group. Same design tokens as
 * CheckboxField/RadioField (Primary/color-40 #8EDB00, Neutral #292929, Error
 * #e53935). Box visuals mirror CheckboxField; layout mirrors RadioField options.
 * Class naming: no BEM `__`; elements nested under `.checkbox-group-field`.
 */
:host,
.checkbox-group-field {
  display: block;
}

.checkbox-group-field,
.checkbox-group-field *,
.checkbox-group-field *::before,
.checkbox-group-field *::after {
  box-sizing: border-box;
}

.checkbox-group-field {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;

  .legend {
    padding: 0;
    margin-bottom: 12px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.3px;
    color: #292929;
  }

  .required {
    color: #e53935;
  }

  .options {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
  }

  /* Hide native checkbox */
  .input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;

    &:checked ~ .box {
      background-color: #8edb00;
      border-color: #8edb00;
    }

    &:checked ~ .box::after {
      display: block;
    }

    &:focus-visible ~ .box {
      outline: 2px solid #292929;
      outline-offset: 2px;
    }
  }

  /* Custom box */
  .box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid #d6dcd9;
    background-color: #f1f3f2;
    position: relative;
    transition: border-color 0.15s ease, background-color 0.15s ease;

    /* Checkmark via ::after */
    &::after {
      content: '';
      position: absolute;
      display: none;
      left: 5px;
      top: 2px;
      width: 6px;
      height: 10px;
      border: 2px solid #292929;
      border-top: none;
      border-left: none;
      transform: rotate(45deg);
    }
  }

  .text {
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.3px;
    color: #292929;
  }

  .error {
    display: block;
    margin-top: 8px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 12px;
    line-height: 16px;
    color: #e53935;
  }

  &.error .box {
    border-color: #e53935;
  }

  &.disabled .option {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

