/* ToggleSwitch — sliding toggle with accessible checkbox */

.wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  user-select: none;
}

.wrapper[data-disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.label {
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

/* Track (pill shape) */
.track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--color-border);
  transition: background 200ms ease;
  flex-shrink: 0;
}

.track[data-checked] {
  background: var(--color-accent);
}

/* Visually hidden native checkbox */
.input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sliding thumb */
.thumb {
  position: absolute;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-text-primary);
  transition: transform 200ms ease;
  pointer-events: none;
}

.track[data-checked] .thumb {
  transform: translateX(18px);
}

/* Focus ring on the track when input is focused */
.input:focus-visible ~ .thumb {
  box-shadow: 0 0 0 2px var(--color-accent-focus);
}
