/*
 * dialogs.css — Panelin pencere sistemi. Kabuk: koyu perde (bulanıklık yok),
 * #141013 yüzey, Clash başlık, sabit alt işlem çubuğu. Bileşenler: seçenek
 * kartı, süre çipi, alan, not, anahtar, özet, yükleniyor. Döngü yok; giriş
 * 200 ms solma + .97 ölçek (merkezden). Tasarım: docs/design-system.md §7.35
 */

/* ============================================================
   [KABUK] eski pencereler de bu yüzeyi alır
   ============================================================ */
.modal-back { background: rgba(5, 3, 4, 0.74); }
.modal-back.on { animation: dlg-fade 160ms ease both; }
.modal {
  width: min(480px, 92vw);
  background: #141013;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95);
  animation: dlg-in 200ms var(--wf-ease-out) both;
}
.modal::before,
.modal .topbar-glow { display: none; }
.modal.wide { width: min(680px, 94vw); }
.modal.xl { width: min(1040px, 96vw); }
.modal h3 { font-family: var(--wf-font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: 0.005em; }
.modal-body:has(> .dlg) { padding: 0; max-height: none; overflow: visible; }

@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-in { from { opacity: 0; transform: scale(0.97); } }
@keyframes dlg-spin { to { transform: rotate(360deg); } }

/* ============================================================
   [YAPI] başlık · içerik (kayar) · alt işlem çubuğu
   ============================================================ */
.dlg {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 860px);
  font-family: var(--wf-font-text);
  color: var(--wf-text-1);
}
.dlg-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding: 20px 60px 16px 22px;
}
.dlg-ico,
.dlg-ava {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
}
.dlg-ico { background: color-mix(in srgb, var(--c, #f4ecea) 13%, transparent); color: var(--c, #f4ecea); }
.dlg-ico svg { width: 20px; height: 20px; }
.dlg-ava { background: rgba(255, 255, 255, 0.07); font-size: 0.9rem; font-weight: 700; color: var(--wf-text-2); }
.dlg-ava img { width: 100%; height: 100%; object-fit: cover; }
.dlg-titles { min-width: 0; }
.dlg-titles h3 {
  margin: 0;
  font-family: var(--wf-font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--wf-text-1);
}
.dlg-titles p {
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--wf-text-3);
}
.dlg-x {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--wf-text-3);
  cursor: pointer;
  transition: color var(--wf-dur-hover) ease, background-color var(--wf-dur-hover) ease;
}
.dlg-x svg { width: 17px; height: 17px; }
.dlg-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 22px 20px;
  scrollbar-width: auto;
  scrollbar-color: auto;
}
.dlg-body::-webkit-scrollbar { width: 12px; }
.dlg-body::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.dlg-body::-webkit-scrollbar-thumb {
  border: 4px solid transparent;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1) padding-box;
}
.dlg-sec + .dlg-sec { margin-top: 20px; }
.dlg-sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 9px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wf-text-3);
}
.dlg-sec-title em { font-style: normal; font-weight: 500; color: var(--wf-text-4); }
.dlg-sec-title .dlg-btn { margin-left: auto; }
.dlg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}
.dlg-foot-note { margin-right: auto; font-size: 0.8rem; color: var(--wf-text-4); }
.dlg-spacer { margin-right: auto; }

/* ============================================================
   [DÜĞME] ghost · birincil (fildişi) · tehlike · sessiz
   ============================================================ */
.dlg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wf-text-1);
  cursor: pointer;
  transition:
    background-color var(--wf-dur-hover) ease,
    color var(--wf-dur-hover) ease,
    opacity var(--wf-dur-state) ease,
    transform var(--wf-dur-press) var(--wf-ease-out);
}
.dlg-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.dlg-btn.sm { height: 32px; padding: 0 11px; border-radius: 9px; font-size: 0.8rem; }
.dlg-btn.sm svg { width: 14px; height: 14px; }
.dlg-btn.is-primary { background: #f4ecea; box-shadow: none; color: #160d11; }
.dlg-btn.is-danger { background: #d9434f; box-shadow: none; color: #ffffff; }
.dlg-btn.is-danger-ghost { background: transparent; box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.32); color: #fda4af; }
.dlg-btn.is-ok-ghost { background: transparent; box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35); color: #86efac; }
.dlg-btn.is-quiet { background: transparent; box-shadow: none; color: var(--wf-text-3); }
.dlg-btn:disabled { opacity: 0.45; cursor: default; }
.dlg-btn:active:not(:disabled) { transform: scale(0.97); }
.dlg-spin {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  opacity: 0.8;
  animation: dlg-spin 700ms linear infinite;
}

/* ============================================================
   [SEÇENEK KARTI] erişim rolleri, panel rolleri (radyo)
   ============================================================ */
.dlg-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dlg-opts.is-list { grid-template-columns: minmax(0, 1fr); }
.dlg-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 42px 10px 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  font: inherit;
  text-align: left;
  color: var(--wf-text-1);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease, box-shadow var(--wf-dur-hover) ease;
}
.dlg-opt::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22);
  transition: box-shadow var(--wf-dur-state) var(--wf-ease-out);
}
.dlg-opt-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--c);
}
.dlg-opt-ico svg { width: 18px; height: 18px; }
.dlg-opt-ico .ri-img { width: 22px; height: 22px; object-fit: contain; }
.dlg-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dlg-opt-text b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}
.dlg-opt-text span { font-size: 0.78rem; font-weight: 500; line-height: 1.4; color: var(--wf-text-4); }
.dlg-opt-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: 1px;
  color: var(--wf-text-2);
}
.dlg-opt.is-sel {
  background: color-mix(in srgb, var(--c) 9%, rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 65%, transparent);
}
.dlg-opt.is-sel::after { box-shadow: inset 0 0 0 5px var(--c); }
.dlg-opt:disabled { opacity: 0.45; cursor: default; }

/* ============================================================
   [ÇİP] süre seçimi (tek seçim)
   ============================================================ */
.dlg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dlg-chip {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wf-text-2);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease, color var(--wf-dur-hover) ease, box-shadow var(--wf-dur-hover) ease;
}
.dlg-chip.is-sel { background: rgba(244, 236, 234, 0.12); box-shadow: inset 0 0 0 1px rgba(244, 236, 234, 0.55); color: var(--wf-text-1); }
.dlg-chip:disabled { opacity: 0.4; cursor: default; }
.dlg-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.dlg-custom[hidden] { display: none; }
.dlg .dlg-custom .dlg-input { width: 110px; text-align: center; }
.dlg-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.dlg-seg button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wf-text-3);
  cursor: pointer;
}
.dlg-seg button.is-sel { background: rgba(255, 255, 255, 0.1); color: var(--wf-text-1); }

/* ============================================================
   [ALAN]
   ============================================================ */
.dlg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dlg-field + .dlg-field { margin-top: 14px; }
.dlg-label { font-size: 0.8rem; font-weight: 600; color: var(--wf-text-3); }
:is(.dlg, .rl, .ops-form) .dlg-input {
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--wf-text-1);
  outline: none;
  transition: border-color var(--wf-dur-hover) ease, box-shadow var(--wf-dur-hover) ease, background-color var(--wf-dur-hover) ease;
}
.dlg textarea.dlg-input { height: auto; min-height: 74px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
:is(.dlg, .rl, .ops-form) .dlg-input::placeholder { color: var(--wf-text-4); }
:is(.dlg, .rl, .ops-form) .dlg-input:focus {
  border-color: rgba(244, 236, 234, 0.5);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 3px rgba(244, 236, 234, 0.08);
}
:is(.dlg, .rl, .ops-form) .dlg-input[readonly] { color: var(--wf-text-3); }
.dlg-input::-webkit-inner-spin-button,
.dlg-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dlg input[type='number'].dlg-input { -moz-appearance: textfield; }
.dlg input[type='datetime-local'].dlg-input { color-scheme: dark; }
.dlg-field.has-error .dlg-input { border-color: rgba(251, 113, 133, 0.7); }
.dlg-hint { font-size: 0.76rem; line-height: 1.45; color: var(--wf-text-4); }
.dlg-field-msg { font-size: 0.76rem; font-weight: 500; color: #fda4af; }
.dlg-field-msg:empty { display: none; }

/* ============================================================
   [NOT] tek satır açıklama / uyarı / sonuç özeti
   ============================================================ */
.dlg-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--wf-text-2);
}
.dlg-note > svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--wf-text-3); }
.dlg-note b { font-weight: 600; color: var(--wf-text-1); }
.dlg-note.is-warn { background: rgba(251, 191, 36, 0.07); color: #fde68a; }
.dlg-note.is-warn > svg { color: var(--wf-warning); }
.dlg-note.is-warn b { color: #fef3c7; }
.dlg-note.is-danger { background: rgba(251, 113, 133, 0.08); color: #fecdd3; }
.dlg-note.is-danger > svg { color: var(--wf-danger); }
.dlg-note.is-danger b { color: #ffe4e6; }
.dlg-note.is-ok { background: rgba(52, 211, 153, 0.07); color: #bbf7d0; }
.dlg-note.is-ok > svg { color: var(--wf-success); }
.dlg-note + .dlg-sec,
.dlg-sec + .dlg-note { margin-top: 16px; }

/* ============================================================
   [ANAHTAR] sayfa erişimleri
   ============================================================ */
.dlg-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dlg-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font: inherit;
  text-align: left;
  color: var(--wf-text-1);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease;
}
.dlg-toggle-ico { display: grid; flex-shrink: 0; color: var(--wf-text-4); transition: color var(--wf-dur-state) ease; }
.dlg-toggle-ico svg { width: 17px; height: 17px; }
.dlg-toggle-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dlg-toggle-text b { font-size: 0.86rem; font-weight: 600; line-height: 1.35; }
.dlg-toggle-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--wf-text-4);
}
.dlg-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
  margin-left: auto;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  transition: background-color var(--wf-dur-state) ease;
}
.dlg-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform var(--wf-dur-state) var(--wf-ease-out);
}
.dlg-toggle.is-on .dlg-switch { background: var(--wf-success); }
.dlg-toggle.is-on .dlg-switch::after { transform: translateX(14px); }
.dlg-toggle.is-on .dlg-toggle-ico { color: var(--wf-success); }
.dlg-toggle:disabled { cursor: default; }

/* ============================================================
   [ÖZET] onay pencerelerinde etkilenecek sayılar
   ============================================================ */
.dlg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dlg-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 11px; background: rgba(255, 255, 255, 0.03); }
.dlg-stat b { font-family: var(--wf-font-display); font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.dlg-stat span { font-size: 0.76rem; font-weight: 500; color: var(--wf-text-4); }
/* .dlg önekli: eski .modal p / p b kurallarını ezer */
.dlg .dlg-lead { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.6; color: var(--wf-text-2); }
.dlg .dlg-lead b { font-weight: 600; color: var(--wf-text-1); }

/* ============================================================
   [YÜKLENİYOR] son düzene benzeyen durağan iskelet (sıçrama yok)
   ============================================================ */
.dlg-skel { border-radius: 10px; background: rgba(255, 255, 255, 0.045); }
.dlg-loading .dlg-head .dlg-skel:first-child { width: 42px; height: 42px; border-radius: 12px; }
.dlg-loading-lines { display: flex; flex-direction: column; gap: 8px; flex: 1; }

/* ============================================================
   [HOVER]
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .dlg-x:hover { background: rgba(255, 255, 255, 0.07); color: var(--wf-text-1); }
  .dlg-btn:not(:disabled):hover { background: rgba(255, 255, 255, 0.09); }
  .dlg-btn.is-primary:not(:disabled):hover { background: #ffffff; }
  .dlg-btn.is-danger:not(:disabled):hover { background: #e5525e; }
  .dlg-btn.is-danger-ghost:not(:disabled):hover { background: rgba(251, 113, 133, 0.1); }
  .dlg-btn.is-ok-ghost:not(:disabled):hover { background: rgba(52, 211, 153, 0.1); }
  .dlg-btn.is-quiet:not(:disabled):hover { background: rgba(255, 255, 255, 0.06); color: var(--wf-text-1); }
  .dlg-opt:not(.is-sel):not(:disabled):hover { background: rgba(255, 255, 255, 0.045); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
  .dlg-chip:not(.is-sel):not(:disabled):hover { background: rgba(255, 255, 255, 0.07); color: var(--wf-text-1); }
  .dlg-seg button:not(.is-sel):hover { color: var(--wf-text-1); }
  .dlg-toggle:not(:disabled):hover { background: rgba(255, 255, 255, 0.045); }
  .dlg .dlg-input:not(:focus):hover { border-color: rgba(255, 255, 255, 0.16); }
}
.dlg button:focus-visible {
  outline: 2px solid rgba(244, 236, 234, 0.6);
  outline-offset: 2px;
}

/* ============================================================
   [DUYARLI]
   ============================================================ */
@media (max-width: 640px) {
  .modal, .modal.wide, .modal.xl { width: calc(100vw - 20px); }
  .dlg { max-height: 92dvh; }
  .dlg-head { padding: 16px 56px 12px 16px; }
  .dlg-body { padding: 4px 16px 16px; }
  .dlg-foot { padding: 12px 16px; }
  .dlg-opts, .dlg-toggles { grid-template-columns: minmax(0, 1fr); }
  .dlg-foot .dlg-btn { flex: 1; }
  .dlg-foot-note { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation-name: dlg-fade; }
}
