/* bfcs · Checkbox · Radio · Switch
   Checkbox + Radio: B · Daire (iOS Anımsatıcılar / Cash App) — 24px daire.
   Switch:           A · iOS tarzı — 48×28, basılı tutunca topuz uzar.
   Hepsi gerçek <input> üzerine kurulu: klavye, ekran okuyucu ve formlar kendiliğinden çalışır.
   İşaretli renk = --accent (bfcs'te krem; uygulamada o uygulamanın rengi).

   Kullanım:
     <label class="check"><input type="checkbox" class="check-input"> Kampanyalardan haberdar et</label>
     <label class="check"><input type="radio" name="kargo" class="check-input"> Kargo ile</label>
     <label class="check check-end">Bildirimler <input type="checkbox" role="switch" class="switch"></label>

   Açıklamalı satır:
     <label class="check"><input type="checkbox" class="check-input">
       <span class="check-text">Haftalık rapor<small>Her pazartesi e-posta ile</small></span></label>
*/

/* satır */
.check {
  display: flex;
  align-items: center;
  gap: var(--check-label-gap);
  min-height: 44px;                 /* dokunma alanı */
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.check-end { justify-content: space-between; }
.check-text { display: flex; flex-direction: column; min-width: 0; }
.check-text small { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.check:has(:disabled) { opacity: var(--button-disabled-opacity); cursor: not-allowed; }

/* checkbox + radio */
.check-input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  position: relative;
  width: var(--check-size);
  height: var(--check-size);
  margin: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 var(--check-ring-width) var(--control-ring);
  cursor: inherit;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-spring) var(--ease-spring),
    transform var(--dur-spring) var(--ease-spring);
}
.check-input:hover:not(:disabled):not(:checked) { box-shadow: inset 0 0 0 var(--check-ring-width) var(--text-secondary); }
.check-input:active:not(:disabled) { transform: scale(0.9); }
.check-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* checkbox: dolgu + tik (Tabler "check" çizgisi, maske ile) */
.check-input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--on-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9'/%3E%3C/svg%3E") center / 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9'/%3E%3C/svg%3E") center / 100% no-repeat;
  transform: scale(0);
  transition: transform var(--dur-spring) var(--ease-spring);
}
.check-input[type="checkbox"]:checked,
.check-input[type="checkbox"]:indeterminate { background: var(--accent); box-shadow: none; }
.check-input[type="checkbox"]:checked::after { transform: scale(1); }
/* kısmen seçili (tablo başlığında "hepsini seç") */
.check-input[type="checkbox"]:indeterminate::after {
  -webkit-mask: none; mask: none;
  inset: auto; left: 7px; right: 7px; top: calc(50% - 1.25px); height: 2.5px; border-radius: 2px;
  transform: scale(1);
}

/* radio: işaretliyken kalın halka + orta nokta */
.check-input[type="radio"]:checked { box-shadow: inset 0 0 0 var(--check-radio-dot) var(--accent); }

/* switch */
.switch {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  position: relative;
  width: var(--switch-width);
  height: var(--switch-height);
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--control-track);
  cursor: inherit;
  transition: background-color var(--dur-base) var(--ease-standard);
}
.switch::before {
  --_gap: calc((var(--switch-height) - var(--switch-knob)) / 2);
  content: "";
  position: absolute;
  top: var(--_gap);
  left: var(--_gap);
  width: var(--switch-knob);
  height: var(--switch-knob);
  border-radius: var(--radius-pill);
  background: var(--control-knob);
  box-shadow: var(--shadow-overlay, none);
  transition:
    left var(--dur-spring) var(--ease-spring),
    width var(--dur-fast) var(--ease-standard),
    background-color var(--dur-base) var(--ease-standard);
}
.switch:checked { background: var(--accent); }
.switch:checked::before { left: calc(100% - var(--switch-knob) - var(--_gap)); background: var(--on-accent); }
/* basılı tutunca uzar (iOS) */
.switch:active:not(:disabled)::before { width: var(--switch-knob-pressed); }
.switch:checked:active:not(:disabled)::before { left: calc(100% - var(--switch-knob-pressed) - var(--_gap)); }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[data-theme="light"] .switch::before { box-shadow: 0 1px 3px rgba(12, 11, 10, 0.2); }

/* liste içinde satırlar arası çizgi */
.check-list > .check + .check { border-top: var(--border-hairline) solid var(--border-subtle); }

@media (prefers-reduced-motion: reduce) {
  .check-input, .check-input::after, .switch, .switch::before { transition-duration: 0ms; }
}
