/* Personal saved redaction lists (Pro) — the "Lists" control in the Find & Redact
 * panel head + the Save / Manage modals. Reuses the shared .modal / .modal-card
 * chrome (main.css) and the menuIn / modalIn / modalOut keyframes; everything here
 * is the feature-specific skin. Tokens only, both themes. Finite entrances inherit
 * the global reduced-motion gate; the one transform end-state (chip leave) gets a
 * local block at the foot of this file. */

/* ── head actions group (Lists control + ⓘ help live here, right of the title) ── */
.redact-terms-head-actions { display: flex; align-items: center; gap: 6px; }

/* ── the "Lists" dropdown trigger ── */
.rl-control { position: relative; display: inline-flex; }
.rl-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 7px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text-soft); cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.rl-trigger:hover { border-color: var(--primary); color: var(--text); }
.rl-trigger[aria-expanded="true"] { border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rl-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rl-trigger svg { flex: 0 0 auto; }
.rl-trigger-label { white-space: nowrap; }

/* ── the dropdown menu (portaled to <body> by PF.bindMenu; menuIn on open) ── */
.rl-menu {
  min-width: 230px; max-width: 300px; padding: 5px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  animation: menuIn .15s cubic-bezier(.2, .7, .3, 1);
}
.rl-menu[hidden] { display: none; }
/* The control lives inside the z-1000 editor overlay. PF.placeMenu portals the menu
   to <body> and hardcodes an inline z-index:900 (right for page-level menus, but
   below the editor here, so the stage would eat the clicks). Lift it above the
   overlay — author !important beats placeMenu's non-important inline style and
   survives its scroll/resize reflows. The menu always closes before a Save/Manage
   modal (z-1000, appended later) opens, so it never needs to sit under one. */
.rl-menu { z-index: 1050 !important; }
.rl-menu-sec { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); padding: 6px 8px 4px; }
.rl-menu-hint { font-size: 12px; color: var(--text-soft); padding: 8px 9px; line-height: 1.45; }
.rl-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text); font-size: 13px; text-align: left; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.rl-menu-item:hover { background: var(--bg-soft); }
.rl-menu-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rl-menu-item svg { flex: 0 0 auto; color: var(--text-soft); }
.rl-menu-item:hover svg { color: var(--primary); }
.rl-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-menu-meta { flex: 0 0 auto; font-size: 11px; color: var(--text-soft); }
.rl-menu-star { flex: 0 0 auto; width: 14px; height: 14px; display: inline-flex; color: var(--primary); }
.rl-menu-star-empty { color: transparent; }
.rl-menu-action { color: var(--text); font-weight: 500; }
.rl-menu-divider { height: 1px; background: var(--border); margin: 5px 4px; }

/* ── modals (Save + Manage) — chrome from main.css; this is the body skin ── */
/* These modals are summoned from INSIDE the redact editor overlay (z-index:1000),
   so — like #upgrade-modal (z-2000) — they must beat it; the base .modal is only
   z-200 and would open underneath (correct DOM, painted under — caught by pixel,
   not DOM, verification). Above the editor + the z-1050 Lists menu, below the
   z-2000 upgrade modal. */
.redact-lists-modal { z-index: 1100; }
.redact-lists-modal .rl-card { max-width: 480px; }
.redact-lists-modal .rl-card-wide { max-width: 560px; }
.rl-body { display: flex; flex-direction: column; gap: 14px; }
.rl-sub { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; margin: 0; }
.rl-input {
  width: 100%; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.rl-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.rl-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); line-height: 1.4; cursor: pointer; }
.rl-check input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--primary); }
.rl-actions-split { justify-content: space-between; }
/* The .rl-body flex column already separates its children with gap:14px, so the
   canonical .modal-actions margin-top (meant for block-body modals) would double
   up. Drop it here and let the gap own the vertical rhythm. */
.rl-body > .modal-actions { margin-top: 0; }

/* preview chips in the Save dialog (static, non-interactive) */
.rl-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-chip-static { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.rl-more { font-size: 12px; color: var(--text-soft); align-self: center; }

/* ── manager: the list of saved lists ── */
.rl-rows { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.rl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); animation: kpRise .26s cubic-bezier(.2, .7, .3, 1) both;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rl-row:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.rl-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.rl-row-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-row-meta { font-size: 12px; color: var(--text-soft); }
.rl-default-tag { color: var(--primary); font-weight: 600; }
.rl-row-star { flex: 0 0 auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); cursor: pointer; transition: background-color .12s, color .12s, transform .12s; }
.rl-row-star:hover { background: var(--bg-soft); color: var(--primary); }
.rl-row-star.is-on { color: var(--primary); }
.rl-row-star:active { transform: scale(.9); }
.rl-row-apply { flex: 0 0 auto; }
.rl-icon-btn { flex: 0 0 auto; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text-soft); cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.rl-icon-btn:hover { border-color: var(--primary); color: var(--text); }
.rl-icon-btn.rl-danger:hover { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.rl-icon-btn:focus-visible, .rl-row-star:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.rl-empty { text-align: center; padding: 14px 6px 6px; }
.rl-empty p { font-size: 13.5px; color: var(--text-soft); line-height: 1.55; margin: 0 0 16px; }

/* ── manager: single-list editor ── */
.rl-back { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; font-size: 13px; font-weight: 500; color: var(--text-soft); background: transparent; border: 0; padding: 4px 6px 4px 2px; border-radius: 6px; cursor: pointer; transition: color .12s; }
.rl-back:hover { color: var(--primary); }
.rl-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rl-section { display: flex; flex-direction: column; gap: 6px; }
.rl-section-head { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-soft); }
.rl-section-sub { font-size: 12px; color: var(--text-soft); line-height: 1.45; }
.rl-danger-btn { color: var(--danger); }
.rl-danger-btn:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text); }

/* ── reusable chips editor (Always-redact / Never-flag) ── */
.rl-chips { display: flex; flex-direction: column; gap: 8px; }
.rl-chips-add { display: flex; gap: 6px; }
.rl-chips-input { flex: 1; min-width: 0; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.rl-chips-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rl-chips-addbtn { flex: 0 0 auto; }
.rl-chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text); max-width: 100%;
  animation: kpRise .2s cubic-bezier(.2, .7, .3, 1) both;
}
.rl-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-chip-fuzzy { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); color: var(--text-soft); font-weight: 700; cursor: pointer; transition: border-color .12s, color .12s, background-color .12s; }
.rl-chip-fuzzy:hover { border-color: var(--primary); color: var(--text); }
.rl-chip-fuzzy.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rl-chip-fuzzy:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rl-chip-x { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-soft); cursor: pointer; transition: background-color .12s, color .12s; }
.rl-chip-x:hover { background: var(--bg); color: var(--danger); }
.rl-chip-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rl-chip.is-leaving { animation: rlChipOut .16s ease-in forwards; }
.rl-chip.is-pulse { animation: rlChipPulse .45s ease; }

@keyframes rlChipOut { to { opacity: 0; transform: scale(.85); } }
@keyframes rlChipPulse { 0%, 100% { transform: none; } 30% { transform: scale(1.08); border-color: var(--primary); } }

/* ── sync: the entry button on the list view ── */
.rl-sync-entry {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 13px; margin-top: 4px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rl-sync-entry:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.rl-sync-entry:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rl-sync-entry > svg { flex: 0 0 auto; color: var(--primary); }
.rl-sync-entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rl-sync-entry-title { font-size: 13.5px; font-weight: 600; }
.rl-sync-entry-sub { font-size: 12px; color: var(--text-soft); }
.rl-sync-entry-arrow { flex: 0 0 auto; font-size: 20px; color: var(--text-soft); line-height: 1; }

/* ── sync: the inline view ── */
.rl-sync-head { display: flex; align-items: center; gap: 8px; }
.rl-sync-head svg { color: var(--primary); }
.rl-sync-head h3 { margin: 0; font-size: 16px; }
.rl-code-row { display: flex; align-items: center; gap: 8px; }
.rl-code {
  flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px; letter-spacing: 0.04em; padding: 9px 11px; border-radius: 8px;
  background: var(--bg); border: 1px dashed var(--border); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all;
}
.rl-link { align-self: flex-start; font-size: 12.5px; color: var(--primary); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.rl-link:hover { text-decoration: underline; }
.rl-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.muted { color: var(--text-soft); font-weight: 400; }
.rl-synced { display: flex; align-items: center; gap: 7px; }
.rl-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; flex: 0 0 auto; box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 22%, transparent); }
.rl-sync-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.rl-err { font-size: 12.5px; color: var(--danger); }
.rl-rotate { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; animation: kpRise .2s cubic-bezier(.2,.7,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  .rl-sync-entry:hover { transform: none; }
  .rl-rotate { animation: none; }
}

@media (max-width: 560px) {
  .rl-trigger-label { display: none; }
  .redact-lists-modal .rl-card, .redact-lists-modal .rl-card-wide { max-width: none; }
  .rl-row { flex-wrap: wrap; }
  .rl-row-main { flex-basis: 100%; order: -1; }
}

/* JS-driven / transform-residue motion the global gate can't fully tame. */
@media (prefers-reduced-motion: reduce) {
  .rl-row, .rl-chip, .rl-menu { animation: none; }
  .rl-chip.is-leaving, .rl-chip.is-pulse { animation: none; }
  .rl-row:hover { transform: none; }
}
