/* Switch atom: current shadcn/ui neutral sizing and states. */
.switch-stage {
  align-items: stretch;
  padding: clamp(24px, 5vw, 48px);
}

.switch-showcase {
  width: min(100%, 540px);
  margin: auto;
  display: grid;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--background);
  box-shadow: var(--shadow-xs);
}

.switch-example {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.switch-example + .switch-example {
  border-top: 1px solid var(--border);
}

.switch-example-title {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.switch-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.switch-field,
.switch-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.switch-field-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}

.switch-label {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

label.switch-label,
.switch-card {
  cursor: pointer;
}

.switch-description {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.4;
}

.switch-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border-radius: 9999px;
  cursor: pointer;
}

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

.switch-input:focus-visible {
  outline: none;
}

.switch-track {
  position: relative;
  width: 32px;
  height: 18.4px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: var(--input);
  transition: background-color 150ms cubic-bezier(.4, 0, .2, 1),
              border-color 150ms cubic-bezier(.4, 0, .2, 1),
              box-shadow 150ms cubic-bezier(.4, 0, .2, 1);
}

.switch-track::after {
  content: "";
  position: absolute;
  inset: -8px -12px;
  border-radius: inherit;
}

.switch-thumb {
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
  background: var(--background);
  pointer-events: none;
  transform: translateX(0);
  transition: transform 150ms cubic-bezier(.4, 0, .2, 1);
}

.switch-input:checked + .switch-track {
  background: var(--primary);
}

.switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(14px);
}

.switch-input:focus-visible + .switch-track {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}

.switch-input[aria-invalid="true"] + .switch-track {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 20%, transparent);
}

.switch-input:disabled + .switch-track {
  cursor: not-allowed;
  opacity: 0.5;
}

.switch-disabled .switch-label {
  color: var(--muted-foreground);
  cursor: not-allowed;
  opacity: 0.7;
}

.switch-control-sm .switch-track {
  width: 24px;
  height: 14px;
}

.switch-control-sm .switch-thumb {
  width: 12px;
  height: 12px;
}

.switch-control-sm .switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(10px);
}

[dir="rtl"] .switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(-14px);
}

.switch-card-list {
  display: grid;
  gap: 8px;
}

.switch-card {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.switch-card:hover {
  background: var(--accent);
}

.switch-card:has(.switch-input:focus-visible) {
  border-color: var(--ring);
}

.switch-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
}

.switch-error {
  display: block;
  margin-top: 2px;
  color: var(--destructive);
  font-size: 11px;
  line-height: 1.3;
}

.switch-invalid .switch-label {
  color: var(--destructive);
}

@media (prefers-color-scheme: dark) {
  .switch-input:not(:checked) + .switch-track {
    background: color-mix(in srgb, var(--input) 80%, transparent);
  }

  .switch-input:not(:checked) + .switch-track .switch-thumb {
    background: var(--foreground);
  }

  .switch-input:checked + .switch-track .switch-thumb {
    background: var(--primary-foreground);
  }

  .switch-input[aria-invalid="true"] + .switch-track {
    border-color: color-mix(in srgb, var(--destructive) 50%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 40%, transparent);
  }
}

@media (max-width: 540px) {
  .switch-stage {
    padding: 16px;
  }

  .switch-example {
    padding: 18px 16px;
  }

  .switch-state-grid {
    grid-template-columns: 1fr;
  }
}
