/*
 * Shared Route choice-control surface.
 *
 * This layer owns only visual appearance and interaction states. Every screen
 * keeps its existing checkbox, radio and switch dimensions and layout.
 */
:root {
  --route-choice-surface: var(--panel, #ffffff);
  --route-choice-border: var(--line-strong, #aeb9c7);
  --route-choice-border-hover: var(--accent, #147a6f);
  --route-choice-accent: var(--accent, #147a6f);
  --route-choice-accent-rgb: var(--accent-rgb, 20, 122, 111);
  --route-choice-focus-ring: rgba(var(--route-choice-accent-rgb), .22);
  --route-choice-error: #cf625a;
  --route-choice-error-surface: #fffafa;
  --route-choice-disabled-surface: #f1f3f6;
  --route-choice-disabled-mark: #aeb7c2;
}

:where(input[type="checkbox"], input[type="radio"]) {
  width: 13px;
  height: 13px;
  min-width: 13px;
  min-height: 13px;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  padding: 0 !important;
  border: 1px solid var(--route-choice-border);
  background-color: var(--route-choice-surface);
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: none !important;
  color: #fff;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    outline-color 140ms ease;
}

input[type="checkbox"] {
  border-radius: var(--radius);
}

input[type="radio"] {
  border-radius: var(--radius-circle);
}

input[type="checkbox"]:hover:not(:disabled),
input[type="radio"]:hover:not(:disabled) {
  border-color: var(--route-choice-border-hover);
}

input[type="checkbox"]:checked {
  border-color: var(--route-choice-accent);
  background-color: var(--route-choice-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.25 8.15 6.4 11.3 12.8 4.9' fill='none' stroke='%23fff' stroke-width='2.1' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
  background-size: 78% 78%;
}

input[type="radio"]:checked {
  border-color: var(--route-choice-accent);
  background-color: var(--route-choice-accent);
  background-image: radial-gradient(circle at center, #fff 0 28%, transparent 34%);
}

input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus,
input[type="radio"]:focus-visible {
  border-color: var(--route-choice-accent);
  outline: 2px solid var(--route-choice-focus-ring) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

input[type="checkbox"][aria-invalid="true"],
input[type="checkbox"].is-invalid,
input[type="radio"][aria-invalid="true"],
input[type="radio"].is-invalid,
.has-error > input[type="checkbox"],
.has-error > input[type="radio"] {
  border-color: var(--route-choice-error) !important;
  background-color: var(--route-choice-error-surface);
  box-shadow: none !important;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  border-color: var(--route-field-border, var(--line, #d8dee7));
  background-color: var(--route-choice-disabled-surface);
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 1;
}

input[type="checkbox"]:disabled:checked,
input[type="radio"]:disabled:checked {
  border-color: var(--route-choice-disabled-mark);
  background-color: var(--route-choice-disabled-mark);
}

/* Existing proxy checkboxes inherit the same quiet outline states. */
.survey-acceptance-checkbox {
  border-color: var(--route-choice-border);
  border-radius: var(--radius);
  background: var(--route-choice-surface);
  box-shadow: none !important;
}

.survey-acceptance-reasons input:checked + .survey-acceptance-checkbox,
.survey-acceptance-repeat-visit > input:checked + .survey-acceptance-checkbox {
  border-color: var(--route-choice-accent);
  background: var(--route-choice-accent);
  color: #fff;
}

.survey-acceptance-reasons input:focus-visible + .survey-acceptance-checkbox,
.survey-acceptance-repeat-visit > input:focus-visible + .survey-acceptance-checkbox {
  border-color: var(--route-choice-accent);
  outline: 2px solid var(--route-choice-focus-ring);
  outline-offset: 2px;
  box-shadow: none;
}

/* Custom switch tracks retain local dimensions and movement distances. */
.accrual-option-track {
  border: 1px solid var(--route-choice-border);
  border-radius: var(--radius);
  background: var(--route-choice-surface);
  box-shadow: none !important;
}

.accrual-option-track::after {
  border-radius: var(--radius);
  background: #8d99a8;
  box-shadow: none !important;
}

.accrual-option-toggle input:checked ~ .accrual-option-track {
  border-color: var(--route-choice-accent);
  background: var(--route-choice-accent);
}

.accrual-option-toggle input:checked ~ .accrual-option-track::after {
  background: #fff;
}

.accrual-option-toggle input:focus-visible ~ .accrual-option-track {
  border-color: var(--route-choice-accent);
  outline: 2px solid var(--route-choice-focus-ring);
  outline-offset: 2px;
  box-shadow: none !important;
}

.accrual-option-toggle input:disabled ~ .accrual-option-track {
  border-color: var(--route-field-border, var(--line, #d8dee7));
  background: var(--route-choice-disabled-surface);
  opacity: 1;
}

.accrual-option-toggle input:disabled ~ .accrual-option-track::after {
  background: var(--route-choice-disabled-mark);
}

@media (forced-colors: active) {
  input[type="checkbox"],
  input[type="radio"],
  .survey-acceptance-checkbox,
  .accrual-option-track {
    forced-color-adjust: auto;
  }
}
