/* Rovify shared feedback system — toasts + confirm/alert/prompt modal.
 *
 * Loaded site-wide via web_include_css (see hooks.py), AFTER rovify_theme.css
 * — whose tokens this file consumes exclusively (--card/--line/--text/
 * --accent/--on-accent/--ghost/--ring/--shadow/--rose/--amber). rovify_theme.css
 * guarantees every one of those tokens is defined unconditionally (its base
 * :root has no data-theme gate), so no literal hex fallback is needed here —
 * that would just be a second, driftable copy of the same values.
 *
 * Companion script: public/js/rovify_feedback.js (window.Rovify). Pure
 * CSS + vanilla JS, no build step — hooks.py stamps ?v=<mtime> automatically.
 */

/* ── Toasts ───────────────────────────────────────────────────────────── */
.rvf-fb-toasts {
  position: fixed; z-index: 100020;
  right: 18px; bottom: 18px;
  display: flex; flex-direction: column-reverse; gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
@media (max-width: 640px) {
  .rvf-fb-toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
.rvf-fb-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .28s ease;
  max-width: 100%;
}
@media (max-width: 640px) {
  .rvf-fb-toast { transform: translateY(calc(100% + 24px)); }
}
.rvf-fb-toast.in { transform: none; opacity: 1; }
.rvf-fb-toast.out { opacity: 0; transform: scale(.96); transition: transform .18s ease, opacity .18s ease; }
.rvf-fb-toast__icon {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ghost); color: var(--text-2);
  margin-top: 1px;
}
.rvf-fb-toast__icon svg { width: 12.5px; height: 12.5px; }
.rvf-fb-toast--success .rvf-fb-toast__icon { color: var(--text); background: var(--accent-soft); }
.rvf-fb-toast--error .rvf-fb-toast__icon { color: var(--rose); background: var(--rose-soft); }
.rvf-fb-toast--warn .rvf-fb-toast__icon { color: var(--amber); background: var(--amber-soft); }
.rvf-fb-toast--info .rvf-fb-toast__icon { color: var(--text-2); }
.rvf-fb-toast--error { border-color: var(--rose); }
.rvf-fb-toast--warn { border-color: var(--amber); }
.rvf-fb-toast__body { min-width: 0; flex: 1; }
.rvf-fb-toast__title { display: block; font-size: 13.5px; font-weight: 660; letter-spacing: -0.005em; margin: 0 0 2px; color: var(--text); }
.rvf-fb-toast__msg { display: block; font-size: 13px; line-height: 1.45; color: var(--text-2); word-break: break-word; }
.rvf-fb-toast__close {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 999px; border: none;
  background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; margin: -2px -2px 0 0;
  transition: background .14s, color .14s;
}
.rvf-fb-toast__close:hover { background: var(--surface); color: var(--text); }
.rvf-fb-toast__close svg { width: 12px; height: 12px; }

/* ── Modal (confirm / alert / prompt) ────────────────────────────────── */
.rvf-fb-scrim {
  position: fixed; inset: 0; z-index: 100010;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
/* `.rvf-fb-scrim`'s own `display:flex` above has the same specificity (0,1,0)
   as the UA stylesheet's `[hidden]{display:none}`, and author rules always
   beat UA rules on a tie regardless of source order — so without this rule,
   setting the `hidden` IDL property from JS would silently do nothing and
   the closed dialog would stay in the tab order + a11y tree. This selector's
   extra specificity (0,2,0) is what actually makes `hidden` take effect. */
.rvf-fb-scrim[hidden] { display: none; }
.rvf-fb-scrim.open { opacity: 1; pointer-events: auto; }
.rvf-fb-modal {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  transform: scale(.95) translateY(10px); opacity: 0;
  transition: transform .26s cubic-bezier(.22,.61,.36,1), opacity .2s ease;
}
.rvf-fb-scrim.open .rvf-fb-modal { transform: none; opacity: 1; }
.rvf-fb-modal__icon {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ghost); color: var(--text);
}
.rvf-fb-modal--danger .rvf-fb-modal__icon { color: var(--rose); background: var(--rose-soft); }
.rvf-fb-modal__icon svg { width: 20px; height: 20px; }
.rvf-fb-modal__title { font-size: 17px; font-weight: 680; letter-spacing: -0.015em; margin: 0 0 8px; color: var(--text); }
.rvf-fb-modal__msg { font-size: 13.5px; line-height: 1.55; color: var(--text-2); margin: 0 0 4px; white-space: pre-line; }
.rvf-fb-modal__input-wrap { margin-top: 14px; }
.rvf-fb-modal__input {
  width: 100%; padding: 12px 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; font-size: 14px;
  transition: border-color .14s, box-shadow .14s;
}
.rvf-fb-modal__input:focus { outline: none; border-color: var(--text-2); box-shadow: 0 0 0 3px var(--ring); }
.rvf-fb-modal__copy-wrap { display: flex; gap: 8px; margin-top: 14px; }
.rvf-fb-modal__copy-wrap .rvf-fb-modal__input { flex: 1; min-width: 0; }
.rvf-fb-modal__copy-btn {
  flex-shrink: 0; border: 1px solid var(--line-2); background: transparent;
  color: var(--text); border-radius: 10px; padding: 0 14px; font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background .14s, border-color .14s;
}
.rvf-fb-modal__copy-btn:hover { background: var(--surface); }
.rvf-fb-modal__actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.rvf-fb-btn {
  border: none; border-radius: 999px; font-family: inherit; font-weight: 620; font-size: 13.5px;
  cursor: pointer; padding: 10px 18px; transition: opacity .14s, transform .14s, background .14s, border-color .14s;
}
.rvf-fb-btn:hover { transform: translateY(-1px); }
.rvf-fb-btn:active { transform: none; }
.rvf-fb-btn--primary { background: var(--accent); color: var(--on-accent); }
.rvf-fb-btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line-2); }
.rvf-fb-btn--ghost:hover { color: var(--text); background: var(--surface); }
.rvf-fb-btn--danger { background: var(--rose); color: #fff /* theme-ok: white on the always-rose danger button, never a light surface in either theme */; }
.rvf-fb-btn--danger:hover { opacity: .9; }
.rvf-fb-modal:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .rvf-fb-toast, .rvf-fb-scrim, .rvf-fb-modal { transition-duration: .01ms !important; }
}
