/* ui-forms.css: ui.css sonrasında yüklenir. Yalnız belirteçleri (--accent, --panel, --line ...) kullanın, sabit renk yazmayın.
   Pencereler (dialog), formlar, sihirbaz, seçim kartları. */

/* ---------- Pencere kabuğu: ortalı yumuşak kart ---------- */
dialog {
  border-radius: 28px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog .grid2 { align-items: end; }
dialog::backdrop {
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2);
}
dialog header {
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 22px 26px 16px; align-items: flex-start; gap: 12px;
}
dialog h2 { font-size: 20px; font-weight: 750; letter-spacing: -.03em; line-height: 1.25; }
dialog .sub { color: var(--muted); font-size: 13.5px; font-weight: 500; margin-top: 4px; line-height: 1.45; }
dialog .body { padding: 22px 26px; gap: 16px; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
dialog form > .body, dialog .dlgwrap > .body { flex: 1 1 auto; min-height: 0; }
dialog form > header, dialog form > footer { flex: none; }
dialog footer {
  background: var(--panel); border-top: 1px solid var(--line); padding: 16px 26px; gap: 10px; align-items: center;
}
dialog footer .btn { min-width: 96px; min-height: 44px; justify-content: center; }
dialog header .x {
  flex: none; align-self: flex-start; margin-top: -4px; display: grid; place-items: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  color: var(--muted); background: transparent; transition: background-color .15s, color .15s;
}
dialog header .x:hover { background: var(--accent-soft); color: var(--accent-text); }
dialog header .x:focus-visible { box-shadow: var(--focus); }
#dlg-wiz .body, #dlg-har .body, #dlg-kredi .body { padding: 20px 26px; gap: 14px; }
#dlg-har header, #dlg-kredi header, #dlg-wiz header { padding: 20px 26px 14px; }
#dlg-har footer, #dlg-kredi footer, #dlg-wiz footer { padding: 14px 26px; }

/* Onay penceresi: küçük ve sakin */
dialog#dlg-onay { width: min(420px, calc(100vw - 24px)); }
dialog#dlg-onay .body { color: var(--text2); line-height: 1.6; }

/* ---------- Etiketler, alanlar, ipucu ve hata ---------- */
dialog label { color: var(--text2); font-size: 13px; font-weight: 600; letter-spacing: -.005em; }
dialog input, dialog select, dialog textarea {
  background: var(--field); border: 1px solid var(--line2); border-radius: 12px; color: var(--text);
  padding: 10px 12px; margin-top: 6px;
}
dialog input::placeholder, dialog textarea::placeholder { color: var(--muted); opacity: .75; }
dialog input:focus, dialog select:focus, dialog textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
dialog input[aria-invalid="true"], dialog select[aria-invalid="true"] {
  border-color: var(--bad) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent);
}
dialog input:disabled, dialog select:disabled { opacity: .55; cursor: not-allowed; }
dialog .hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 5px; font-weight: 400; }
dialog .err { color: var(--bad); font-size: 12.5px; font-weight: 600; line-height: 1.4; margin-top: 5px; }
dialog .opt { color: var(--muted); font-weight: 400; }

/* Onay kutusu ve radyo: iris vurgu */
dialog input[type="checkbox"], dialog input[type="radio"] { accent-color: var(--accent); margin-top: 0; }

/* ---------- Grup çerçeveleri ---------- */
.fgrp {
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel2);
  padding: 6px 16px 16px; margin: 0;
}
.fgrp + .fgrp { margin-top: 12px; }
.fgrp > legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 0 8px; margin-left: -2px;
}
.fg { gap: 12px 14px; }
.fg > label { font-size: 12.5px; color: var(--text2); }
.fg input[type], .fg select { height: 44px; min-height: 44px; font-size: 14.5px; padding: 8px 12px; margin-top: 6px; background: var(--field); }
.fg .hint { font-size: 12px; } .fg .err { font-size: 12px; }

/* ---------- Seçenek satırı (.seg) ---------- */
.seg { gap: 8px; margin: 4px 0 8px; }
.seg label {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--line2); border-radius: 999px; background: var(--field); color: var(--text2); font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s;
}
.seg label:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--line2)); }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.seg label:has(input:focus-visible) { box-shadow: var(--focus); }

/* ---------- Sihirbaz ---------- */
.wizprog { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.wizprog i { background: linear-gradient(90deg, var(--accent), var(--spark), var(--gold)); border-radius: 999px; }
.wizq h3 { font-size: 21px; font-weight: 750; letter-spacing: -.03em; line-height: 1.3; margin: 4px 0 6px; }
#dlg-wiz .wizq h3 { font-size: 19px; margin: 0 0 4px; }
.wizq .hint, #dlg-wiz .wizq .hint { font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.wizq input[type="text"], .wizq input[type="number"], .wizq input[type="date"], .wizq select { font-size: 17px; padding: 12px 14px; border-radius: 14px; }
.wizsum td { border-bottom-color: var(--line); }
.wizsum td:last-child { color: var(--text); }
.bigresult b { color: var(--accent-text); letter-spacing: -.03em; }
#dlg-wiz .live.top { background: var(--accent-soft2); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: 14px; }

/* ---------- Sihirbaz Kartları (.wiz-cards) ---------- */
.wiz-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px; margin: 4px 0;
}
.wiz-card {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 18px; border-radius: 20px; min-height: 122px; text-align: left;
  border: 1.5px solid var(--line2); background: var(--panel); box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2, .85, .3, 1), border-color .18s, background-color .18s, box-shadow .2s;
}
.wiz-card-ic, .wiz-card .ic {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-size: 22px;
}
.wiz-card-ic .i, .wiz-card .ic .i { width: 24px; height: 24px; vertical-align: 0; }
.wiz-card b { font-size: 16px; font-weight: 750; letter-spacing: -.015em; color: var(--text); }
.wiz-card small { font-size: 13px; color: var(--muted); line-height: 1.45; }
.wiz-card:hover, .wiz-card[aria-pressed="true"], .wiz-card.is-on, .wiz-card:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft2);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
  transform: translateY(-2px);
}
.wiz-card:active { transform: scale(.97); }
.wiz-card:focus-visible { box-shadow: var(--focus); }

/* ---------- Seçim kartları ---------- */
.bigchoices { gap: 10px; }
.bigchoice {
  border: 1px solid var(--line2); border-radius: 20px; background: var(--panel); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.bigchoice:hover, .bigchoice:focus-visible {
  border-color: var(--accent); background: var(--accent-soft2); box-shadow: 0 0 0 1px var(--accent);
}
.bigchoice:focus-visible { box-shadow: var(--focus); }
.bigchoice b { font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; color: var(--text); }
.bigchoice small { color: var(--muted); }
.choices { gap: 8px; }
.choice { border: 1px solid var(--line2); border-radius: 16px; background: var(--field); padding: 14px 16px; min-height: 44px; }
.choice:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--line2)); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft2); box-shadow: 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice b { font-weight: 650; }

/* ---------- Bilgi / uyarı kutuları ---------- */
.issue { border-radius: 14px; padding: 10px 14px; }
.issue.hata { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.issue.uyari { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--warn); }
.impitem { border-color: var(--line); border-radius: 16px; background: var(--panel2); }
.impbox { border-color: var(--line2); border-radius: 16px; background: var(--panel2); }
dialog .live { border-radius: 14px; }

/* ---------- Hareket: yalnızca azaltma istenmediyse ---------- */
@keyframes kese-form-in { from { opacity: 0; transform: translateY(16px) scale(.975); } to { opacity: 1; transform: none; } }
@keyframes kese-form-sheet { from { opacity: .5; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: kese-form-in .3s cubic-bezier(.2, .8, .25, 1); }
  .wizprog i { transition: width .35s cubic-bezier(.2, .8, .25, 1); }
  .wizq { animation: kese-fade .25s ease-out; }
  .choice, .bigchoice, .seg label { transition: background-color .15s, border-color .15s, box-shadow .2s, transform .15s; }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop, .wizq { animation: none !important; }
  .wizprog i, .choice, .bigchoice, .seg label, .wiz-card, dialog header .x { transition: none !important; }
  .wiz-card:hover, .wiz-card:active { transform: none !important; }
}

/* ---------- Mobil: alttan açılan tam ekran sayfa ---------- */
@media (max-width: 860px) {
  dialog, dialog#dlg-wiz, dialog#dlg-har, dialog#dlg-kredi, dialog#dlg-cal, dialog#dlg-inst, dialog.wide {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none;
  }
  dialog#dlg-onay {
    width: calc(100vw - 24px); max-width: 420px; height: auto; max-height: calc(100dvh - 24px);
    margin: auto auto calc(12px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg);
  }
  dialog header, #dlg-har header, #dlg-kredi header, #dlg-wiz header {
    padding: calc(16px + env(safe-area-inset-top)) 18px 14px; position: relative;
  }
  dialog:not(#dlg-onay) header::before {
    content: ""; position: absolute; top: calc(6px + env(safe-area-inset-top)); left: 50%; width: 40px; height: 4px;
    margin-left: -20px; border-radius: 999px; background: var(--line2);
  }
  dialog h2 { font-size: 19px; }
  dialog .body, #dlg-wiz .body, #dlg-har .body, #dlg-kredi .body { padding: 18px; gap: 14px; }
  dialog footer, #dlg-wiz footer, #dlg-har footer, #dlg-kredi footer {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px color-mix(in srgb, var(--panel) 80%, transparent);
  }
  dialog footer .btn { flex: 1 1 auto; min-height: 48px; }
  dialog header .x { width: 44px; height: 44px; }
  .fg input[type], .fg select { height: 46px; font-size: 16px; }
  dialog input, dialog select, dialog textarea { font-size: 16px; }
  .fgrp { padding: 4px 14px 14px; border-radius: 16px; }
  .wizq h3 { font-size: 20px; }
  .wiz-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: kese-form-sheet .32s cubic-bezier(.2, .8, .25, 1); }
  dialog#dlg-onay[open] { animation: kese-form-in .28s cubic-bezier(.2, .8, .25, 1); }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  dialog[open], dialog#dlg-onay[open] { animation: none !important; }
}
