/* Checkbox
   Native checkbox styled with a custom box and tick. Pair with a label inside
   .dp-check. All colour, radius and type come from tokens.css. */

.dp-check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--dp-space-3);
  font-size: var(--dp-text-base);
  color: var(--dp-navy);
  cursor: pointer;
}

.dp-checkbox {
  appearance: none;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  background: var(--dp-white);
  border: 1px solid var(--dp-border-neutral);
  border-radius: var(--dp-radius-xs);
  cursor: pointer;
  transition: background-color var(--dp-transition),
    border-color var(--dp-transition), box-shadow var(--dp-transition);
}

.dp-checkbox:hover {
  border-color: var(--dp-blue-400);
}

.dp-checkbox:checked,
.dp-checkbox:indeterminate {
  background-color: var(--dp-primary-bg);
  border-color: var(--dp-primary-bg);
  background-repeat: no-repeat;
  background-position: center;
}

.dp-checkbox:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.dp-checkbox:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}

.dp-checkbox:focus-visible {
  outline: none;
  box-shadow: var(--dp-shadow-focus);
}

.dp-checkbox:disabled {
  background-color: var(--dp-neutral-200);
  border-color: var(--dp-neutral-400);
  cursor: not-allowed;
}

.dp-check:has(.dp-checkbox:disabled) {
  color: var(--dp-text-subtle);
  cursor: not-allowed;
}

/* Optional helper text under the label */
.dp-check-text {
  display: block;
  font-size: var(--dp-text-sm);
  color: var(--dp-text-muted);
}
