/* form-toggle-2 — 設定画面で使うトグルスイッチのバリエーション */

.tg2-wrapper {
  width: 100%;
  max-width: 560px;
}

.tg2-settings {
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(35, 61, 88, 0.06);
}

.tg2-heading {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--color-border);
}

.tg2-heading h3 {
  margin: 0;
  font-size: 18px;
}

.tg2-status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.tg2-status.is-success { color: #16803d; }
.tg2-status.is-error { color: #c24141; }

.tg2-group { padding: 8px 20px; }
.tg2-group + .tg2-group { border-top: 1px solid var(--color-border); }

.tg2-group-title {
  margin: 10px 0 2px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.tg2-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.tg2-row + .tg2-row { border-top: 1px solid #edf1f5; }

.tg2-copy { min-width: 0; }

.tg2-label {
  display: block;
  color: var(--color-text);
  font-size: 15px;
  font-weight: 700;
}

.tg2-help {
  display: block;
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
}

.tg2-row.is-saving { background: #f7fbff; }
.tg2-row.is-saving .tg2-help::after { content: ' 保存中…'; color: var(--color-accent); }

.tg2-row-compact {
  justify-content: flex-start;
  gap: 10px;
  min-height: 56px;
}

.tg2-row-compact .tg2-label { font-size: 14px; }
.tg2-row-disabled { opacity: 0.58; }

.tg2-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 52px;
  align-items: center;
  width: 52px;
  min-height: 44px;
  cursor: pointer;
}

.tg2-input {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.tg2-track {
  position: relative;
  display: block;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: #aab6c3;
  transition: background 0.2s ease;
}

.tg2-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(25, 44, 63, 0.28);
  transition: transform 0.2s ease;
}

.tg2-input:checked + .tg2-track { background: var(--color-accent); }
.tg2-input:checked + .tg2-track .tg2-thumb { transform: translateX(24px); }
.tg2-input:focus-visible + .tg2-track { outline: 3px solid rgba(43, 127, 232, 0.35); outline-offset: 3px; }

.tg2-input:disabled + .tg2-track { background: #d2dae3; }
.tg2-input:disabled + .tg2-track .tg2-thumb { box-shadow: none; }
.tg2-switch:has(.tg2-input:disabled) { cursor: not-allowed; }

.tg2-switch-compact {
  flex-basis: 44px;
  width: 44px;
}

.tg2-switch-compact .tg2-track { width: 40px; height: 22px; }
.tg2-switch-compact .tg2-thumb { top: 3px; left: 3px; width: 16px; height: 16px; }
.tg2-switch-compact .tg2-input:checked + .tg2-track .tg2-thumb { transform: translateX(18px); }

/* リセットボタン */
.demo-controls { margin-top: 12px; }

.reset-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  color: #5a6a7a;
  background: #fff;
  font-family: sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.reset-btn:hover:not(:disabled) { border-color: #9aa5b4; background: #f4f6f9; }
.reset-btn:disabled { cursor: not-allowed; opacity: 0.55; }

.tg2-pattern-list { margin: 0; padding-left: 20px; }
.tg2-pattern-list li + li { margin-top: 6px; }

@media (max-width: 480px) {
  .tg2-heading,
  .tg2-group { padding-right: 16px; padding-left: 16px; }
  .tg2-row { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .tg2-track,
  .tg2-thumb,
  .reset-btn { transition: none; }
}
