/* ============================================================
   Component: forms (alanlar, inputlar) — uygulama geneli
   ============================================================ */
.field { margin-bottom: var(--space-4); }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
}
.input, .select, .textarea {
  width: 100%; padding: 10px var(--space-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--fs-base); transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.input::placeholder { color: var(--text-faint); }
.input:disabled { background: var(--bg); color: var(--text-muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); }
.form-grid .field--full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); cursor: pointer; padding: 6px 0; }
.check input { width: 16px; height: 16px; }

/* ────────────────────────────────────────────────────
   Custom select — native <select> yerine sistem-stilli buton + popup.
   Native select gizli (cs-native) DOM'da kalır. JS: customSelect.js.
──────────────────────────────────────────────────── */
.cs-wrap { position: relative; width: 100%; }
.cs-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.cs-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px var(--space-3); min-height: 42px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: var(--fs-base);
  cursor: pointer; text-align: left; box-sizing: border-box;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cs-btn:hover { border-color: var(--brand-light); }
.cs-wrap.cs-open .cs-btn,
.cs-btn:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.cs-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-label.cs-placeholder { color: var(--text-faint); }
.cs-chev { flex-shrink: 0; color: var(--text-muted); transition: transform .2s ease, color .12s; }
.cs-wrap.cs-open .cs-chev { transform: rotate(180deg); color: var(--brand); }
.cs-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 280px; overflow-y: auto; z-index: 800; padding: 6px;
}
.cs-wrap.cs-open .cs-menu { display: block; animation: csIn .15s ease; }
@keyframes csIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.cs-group-label {
  font-size: var(--fs-xs); font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px 5px; pointer-events: none;
}
.cs-group-label:not(:first-child) { border-top: 1px solid var(--border); margin-top: 4px; }
.cs-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text); cursor: pointer;
  transition: background .12s, color .12s;
}
.cs-item:hover { background: var(--surface-alt); color: var(--brand); }
.cs-item.cs-selected { background: var(--brand-glow); color: var(--brand); font-weight: 700; }
.cs-item[data-disabled="1"] { color: var(--text-muted); cursor: not-allowed; pointer-events: none; opacity: .6; }
.cs-item-check { margin-left: auto; display: inline-flex; opacity: 0; color: var(--brand); }
.cs-item.cs-selected .cs-item-check { opacity: 1; }
.cs-wrap.cs-disabled .cs-btn { opacity: .55; cursor: not-allowed; }
.cs-wrap.cs-disabled .cs-menu { display: none !important; }
.cs-empty { padding: 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); text-align: center; }

/* ────────────────────────────────────────────────────
   GLOBAL BASELINE — native checkbox + radio'yu sistem stiline çevir.
   Element+attribute seçici (0,1,1) bilinçli tercih: Tailwind Play CDN
   preflight'ı `*` (0,0,0) ile border-width:0 + border-color:#e5e7eb
   dayatıyor; `:where()` (0,0,0) buna kaynak-sırasında yenilirdi. Bu
   seçici onu güvenle geçer. Segmented gizli radio (.segmented-option
   input, 0,2,1) ve sizing kuralları daha spesifik olduğundan korunur.
──────────────────────────────────────────────────── */
input[type="checkbox"],
input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; flex-shrink: 0; position: relative; vertical-align: middle;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
input[type="checkbox"] { border-radius: 4px; }
input[type="radio"]    { border-radius: 50%; }
input[type="checkbox"]:hover,
input[type="radio"]:hover { border-color: var(--brand); }
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
input[type="checkbox"]:checked,
input[type="radio"]:checked { border-color: var(--brand); background: var(--brand); }
/* Checked checkmark — beyaz tick (SVG/font yok) */
input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* Checked radio dot — beyaz iç daire */
input[type="radio"]:checked::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%);
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }

/* ────────────────────────────────────────────────────
   Segmented radio group — "N seçenekten biri" için ikonlu butonlar.
   Native <input type=radio> sr-only olarak DOM'da kalır (form +
   erişilebilirlik korunur); görünür pill :has(input:checked) ile
   turuncuya boyanır. Markup:
     <div class="segmented-group">
       <label class="segmented-option">
         <input type="radio" name="X" value="a">
         <span class="seg-content"><svg…/> Etiket</span>
       </label> …
     </div>
──────────────────────────────────────────────────── */
.segmented-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--space-2); }
.segmented-option {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; user-select: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.segmented-option:hover { border-color: var(--brand-light); }
.segmented-option input[type="radio"] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.seg-content {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted);
  transition: color .12s;
}
.seg-content svg { flex: 0 0 auto; color: var(--text-muted); transition: color .12s; }
.segmented-option:has(input:checked) {
  border-color: var(--brand); background: var(--brand-glow);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.segmented-option:has(input:checked) .seg-content,
.segmented-option:has(input:checked) .seg-content svg { color: var(--brand); }
.segmented-option:has(input:focus-visible) {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
