/* ============================================================
   TOGGLE — switch control for binary preferences
   Used on Notifications, Communication, Privacy settings.
   Pure CSS, no JS — checkbox handles state.
   ============================================================ */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.toggle__input:checked ~ .toggle__track {
  background: var(--color-primary);
}

.toggle__input:checked ~ .toggle__track .toggle__thumb {
  transform: translateX(16px);
}

.toggle__input:focus-visible ~ .toggle__track {
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.toggle__input:disabled ~ .toggle__track {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Toggle row — used in settings lists */
.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-row__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.toggle-row__description {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-snug);
}
