/* =========================================================
   OVERLAYS — modal, toast, cookie banner, tweaks panel, push notification
   ========================================================= */

/* ── Dialog (HTML5 <dialog>) ─────────────────────────── */
.kz-dialog {
  border: 0; padding: 0;
  background: transparent;
  max-width: min(560px, 92vw);
  border-radius: var(--r-xl);
  color: var(--text);
}
.kz-dialog::backdrop {
  background: color-mix(in oklch, black 50%, transparent);
  backdrop-filter: blur(6px);
}
.kz-dialog[open] { animation: kz-dialog-in .25s var(--ease-out); }
@keyframes kz-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.kz-dialog__panel {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.kz-dialog__head {
  padding: 22px 24px 6px;
  display: flex; align-items: flex-start; gap: 16px;
}
.kz-dialog__icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--verdict-spam-bg); color: var(--verdict-spam);
  flex: none;
}
.kz-dialog[data-tone="info"]    .kz-dialog__icon { background: var(--brand-50); color: var(--brand-700); }
.kz-dialog[data-tone="warn"]    .kz-dialog__icon { background: var(--verdict-warn-bg); color: var(--verdict-warn-ink); }
.kz-dialog[data-tone="success"] .kz-dialog__icon { background: var(--verdict-safe-bg); color: var(--verdict-safe); }
.kz-dialog__title { font-size: 18px; font-weight: 800; margin: 0; }
.kz-dialog__close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-3);
}
.kz-dialog__close:hover { background: var(--surface-2); color: var(--text); }
.kz-dialog__body {
  padding: 16px 24px 8px;
  font-size: 14px; color: var(--text-2); line-height: 1.55;
}
.kz-dialog__body > * + * { margin-top: 12px; }
.kz-dialog__foot {
  padding: 16px 24px 22px;
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

/* ── Toasts ──────────────────────────────────────────── */
.kz-toasts {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
.kz-toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px 14px 14px;
  display: grid; grid-template-columns: 32px 1fr auto; gap: 10px;
  align-items: start;
  animation: kz-toast-in .25s var(--ease-out);
}
@keyframes kz-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}
.kz-toast__icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700);
}
.kz-toast[data-tone="warn"]    .kz-toast__icon { background: var(--verdict-warn-bg); color: var(--verdict-warn-ink); }
.kz-toast[data-tone="danger"]  .kz-toast__icon { background: var(--verdict-spam-bg); color: var(--verdict-spam); }
.kz-toast[data-tone="success"] .kz-toast__icon { background: var(--verdict-safe-bg); color: var(--verdict-safe); }
.kz-toast__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kz-toast__title { font-size: 14px; font-weight: 700; color: var(--text); }
.kz-toast__msg { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.kz-toast__close {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
}
.kz-toast__close:hover { background: var(--surface-2); color: var(--text); }
.kz-toast[data-leaving="true"] {
  animation: kz-toast-out .2s var(--ease-out) forwards;
}
@keyframes kz-toast-out { to { opacity: 0; transform: translateX(20px); } }

/* Trending number push (special toast style) */
.kz-toast--trend {
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border-color: color-mix(in oklch, var(--brand-500) 25%, var(--border));
}

/* ── Cookie banner (bottom sheet) ─────────────────────── */
.kz-cookie {
  position: fixed; left: 20px; right: 20px; bottom: 20px;
  z-index: 250;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1fr auto; gap: 16px;
  align-items: center;
  animation: appear .35s var(--ease-out);
}
.kz-cookie h4 { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.kz-cookie p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.5; max-width: 60ch; }
.kz-cookie__actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 720px) {
  .kz-cookie { grid-template-columns: 1fr; }
  .kz-cookie__actions { width: 100%; }
  .kz-cookie__actions .kz-btn { flex: 1; }
}

/* ── Tweaks panel ────────────────────────────────────── */
.kz-tweaks {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 150;
}
.kz-tweaks__fab {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
  color: var(--text-2);
  transition: transform .15s, color .15s;
}
.kz-tweaks__fab:hover { color: var(--text); transform: rotate(90deg); }
.kz-tweaks__panel {
  display: none;
  position: absolute; bottom: 60px; right: 0;
  width: 320px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px;
  animation: appear .25s var(--ease-out);
}
.kz-tweaks[data-open="true"] .kz-tweaks__panel { display: block; }
.kz-tweaks__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.kz-tweaks__head h4 { margin: 0; font-size: 15px; font-weight: 800; }
.kz-tweaks__section { padding: 12px 0; border-top: 1px solid var(--border); }
.kz-tweaks__section:first-of-type { border-top: 0; padding-top: 0; }
.kz-tweaks__row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px;
}
.kz-tweaks__label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kz-tweaks__swatches { display: flex; gap: 6px; }
.kz-tweaks__swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid var(--border);
  transition: transform .15s, border-color .15s;
}
.kz-tweaks__swatch[aria-pressed="true"] { border-color: var(--text); transform: scale(1.05); }

/* ── Floating action button (back-to-top) ──────────── */
.kz-fab {
  position: fixed; bottom: 84px; right: 20px;
  z-index: 100;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .15s, color .15s;
  transform: translateY(8px);
}
.kz-fab[data-visible="true"] { opacity: 1; pointer-events: auto; transform: none; }
.kz-fab:hover { color: var(--text); }
