:host {
  display: inline-block;
}

.app-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: var(--radius-full, 999px);
  border: 1px solid var(--border-color, #d3dad9);
  background: var(--bg-secondary, #e4e4e7);
  cursor: pointer;
  padding: 0;
  transition: background-color var(--transition-fast, 120ms ease),
    border-color var(--transition-fast, 120ms ease);

  &:hover:not(:disabled) {
    border-color: var(--primary-color, #2f6e5d);
  }

  &:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color, #2f6e5d) 25%, transparent);
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }
}

.app-toggle--sm {
  width: 34px;
  height: 20px;
}

.app-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-fast, 120ms ease);
}

.app-toggle--sm .app-toggle-thumb {
  width: 14px;
  height: 14px;
}

.app-toggle--checked {
  background: var(--primary-color, #2f6e5d);
  border-color: var(--primary-color, #2f6e5d);
}

.app-toggle--checked .app-toggle-thumb {
  transform: translateX(18px);
}

.app-toggle--sm.app-toggle--checked .app-toggle-thumb {
  transform: translateX(14px);
}

@media (prefers-reduced-motion: reduce) {
  .app-toggle,
  .app-toggle-thumb {
    transition: none;
  }
}
