/* ==========================================
   Formio Custom Component Styles
   ========================================== */

/* ==========================================
   1. Custom Radio Buttons
   Opt-in: add "custom-radio" to the Custom CSS Class setting (Display tab) of a
   Radio component, or of a Panel / Container / Fieldset to style every radio inside it.
   Change the variables below to restyle.
   ========================================== */
.custom-radio {
  --radio-size: 1.25rem;
  --radio-border-color: #adb5bd;
  --radio-accent: #0d6efd;
  --radio-bg: #fff;
  --radio-error: #dc3545;
  --radio-gap: .5rem;
}

/* Undo Bootstrap's absolutely positioned input so the input and its label line up */
.custom-radio.formio-component-radio .form-check,
.custom-radio .formio-component-radio .form-check {
  padding-left: 0;
  margin-bottom: .5rem;
}

.custom-radio.formio-component-radio .form-check-inline,
.custom-radio .formio-component-radio .form-check-inline {
  margin-right: 1.25rem;
}

.custom-radio.formio-component-radio .form-check-label,
.custom-radio .formio-component-radio .form-check-label {
  display: inline-flex;
  align-items: center;
  gap: var(--radio-gap);
  cursor: pointer;
}

.custom-radio.formio-component-radio .form-check-input[type="radio"],
.custom-radio .formio-component-radio .form-check-input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  position: static;
  flex-shrink: 0;
  width: var(--radio-size);
  height: var(--radio-size);
  margin: 0;
  border: 2px solid var(--radio-border-color);
  border-radius: 50%;
  background-color: var(--radio-bg);
  background-image: none;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}

.custom-radio.formio-component-radio .form-check-input[type="radio"]:hover,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:hover {
  border-color: var(--radio-accent);
}

/* Selected: filled dot with an inner ring */
.custom-radio.formio-component-radio .form-check-input[type="radio"]:checked,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:checked {
  border-color: var(--radio-accent);
  background-color: var(--radio-accent);
  background-image: none;
  box-shadow: inset 0 0 0 3px var(--radio-bg);
}

.custom-radio.formio-component-radio .form-check-input[type="radio"]:focus,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:focus {
  box-shadow: none;
}

.custom-radio.formio-component-radio .form-check-input[type="radio"]:checked:focus,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:checked:focus {
  box-shadow: inset 0 0 0 3px var(--radio-bg);
}

.custom-radio.formio-component-radio .form-check-input[type="radio"]:focus-visible,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--radio-accent) 40%, transparent);
  outline-offset: 2px;
}

/* Form.io adds .radio-selected to the chosen option's wrapper */
.custom-radio.formio-component-radio .radio-selected .form-check-label,
.custom-radio .formio-component-radio .radio-selected .form-check-label {
  font-weight: 600;
}

/* Disabled / read-only */
.custom-radio.formio-component-radio .form-check-input[type="radio"]:disabled,
.custom-radio.formio-component-radio .form-check-input[type="radio"]:disabled + span,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:disabled,
.custom-radio .formio-component-radio .form-check-input[type="radio"]:disabled + span {
  cursor: not-allowed;
  opacity: .6;
}

/* Validation error */
.custom-radio.formio-component-radio.has-error .form-check-input[type="radio"],
.custom-radio.formio-component-radio .form-check-input[type="radio"].is-invalid,
.custom-radio .formio-component-radio.has-error .form-check-input[type="radio"],
.custom-radio .formio-component-radio .form-check-input[type="radio"].is-invalid {
  border-color: var(--radio-error);
}

/* ==========================================
   2. Custom Checkboxes
   Opt-in: add "custom-checkbox" to the Custom CSS Class setting (Display tab) of a
   Checkbox component, or of a Panel / Container / Fieldset to style every checkbox inside it.
   ========================================== */
.custom-checkbox.formio-component-checkbox .form-check-input[type="checkbox"],
.custom-checkbox .formio-component-checkbox .form-check-input[type="checkbox"] {
  border-color: black;
  transform: scale(1.5);
}
