/* ══════════════════════════════════════════════════════════════════
   DUPLICATE DETECTION — topbar button + inline screen
   ──────────────────────────────────────────────────────────────────
   Scoped with a `dup-` prefix throughout. Colors/radii/spacing reuse the
   existing design tokens (--teal, --amber, --red, --border, --r-card,
   etc. — see :root in literature-review.css); no new visual language.

   Rendered as a full-width screen swapped into .proj-body — same
   "swap what's showing without leaving the page" pattern the Quarantine
   view uses — rather than a floating modal, so the criteria form and the
   paired results actually have room to breathe. toggleDuplicatesView()
   (duplicates.js) adds `.dup-active` to .proj-body to hide
   .left-panel/.right-panel and reveal #duplicatesScreen in their place.
══════════════════════════════════════════════════════════════════ */

/* ── Topbar toggle button — mirrors #quarantineToggleBtn's own override,
   including its pressed/active state while the screen is open ── */
#duplicatesBtn.duplicates-toggle-btn {
  width: auto;
  gap: 6px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}
#duplicatesBtn.duplicates-toggle-btn.active {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

/* ── Centre workflow trigger while the duplicates screen is showing ─────
   Duplicates isn't a workflow stage, so the dots + caret (which imply a
   clickable stage-pipeline dropdown) are hidden and the label reads
   plainly as "Duplicates" (text swapped in _dupSyncScreenUI()). The
   click/keydown guards in projects.html check for this class and skip
   toggleProjStageMenu() while it's present — same treatment
   #quarantineToggleBtn's `.qv-locked` gets. ── */
.proj-stage-trigger.dv-locked { cursor: default; }
.proj-stage-trigger.dv-locked .proj-stage-dots,
.proj-stage-trigger.dv-locked .proj-stage-caret { display: none; }

/* ── Screen shell — fills .proj-body full width, hiding the normal
   list/detail panels while it's open. Mirrors the PDF split-view's
   "inject into .proj-body" approach (projects-split-screen.css) rather
   than the Quarantine view's "reuse the same two panels" approach, since
   duplicate results need their own two-row layout, not a pub list. ── */
.dup-screen { display: none; }
.proj-body.dup-active .left-panel,
.proj-body.dup-active .right-panel {
  display: none !important;
}
.proj-body.dup-active .dup-screen {
  display: flex;
  grid-column: 1 / -1;
  min-height: 0;
  height: 100%;
}

.dup-screen-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 20px 18px;
}

/* ══════════════════════════════════════════════════════════════════
   ROW 1 — criteria
══════════════════════════════════════════════════════════════════ */
.dup-criteria-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.dup-criteria-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 160px;
}

.dup-criteria-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Field checkboxes */
.dup-field-checks { display: flex; gap: 12px; flex-wrap: wrap; }
.dup-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--ink-soft); cursor: pointer; user-select: none;
}
.dup-checkbox input { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }
.dup-criteria-hint {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.7rem; color: var(--ink-muted); line-height: 1.4;
}

/* Run button — pushed to the far right of the criteria row, same job the
   now-removed publication-count text used to share with it. */
.dup-run-btn {
  align-self: center;
  white-space: nowrap;
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Status line under row 1 */
.dup-status-line {
  font-size: 0.78rem;
  color: var(--ink-soft);
  min-height: 1.2em;
  margin-bottom: 10px;
}
.dup-status-line.dup-status--error { color: var(--red); }

/* ══════════════════════════════════════════════════════════════════
   ROW 2 — results
══════════════════════════════════════════════════════════════════ */
.dup-results-row {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dup-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  flex-shrink: 0;
}
.dup-toolbar-select {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--ink-soft);
}
.dup-bulk-input {
  width: 56px; text-align: center;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-family: inherit; font-size: 0.8rem; color: var(--ink);
}
.dup-bulk-input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--teal-glow); }

/* Results list — scrollable */
.dup-results-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 4px 2px 2px;
}
.dup-results-list::-webkit-scrollbar { width: 5px; }
.dup-results-list::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

/* Empty / idle state */
.dup-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--ink-muted);
}
.dup-empty-icon { font-size: 2.2rem; opacity: 0.35; }
.dup-empty-title { font-size: 0.92rem; font-weight: 700; color: var(--ink-soft); }
.dup-empty-note { font-size: 0.78rem; max-width: 340px; line-height: 1.5; }

/* Pair card */
.dup-pair-card {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-page);
  padding: 12px 14px 14px;
  transition: opacity 0.2s;
}

.dup-pair-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dup-badge {
  font-size: 0.7rem; font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.dup-badge--high { background: var(--red-soft);   color: var(--red); }
.dup-badge--med  { background: var(--amber-soft); color: var(--amber); }
.dup-badge--low  { background: var(--bg-elevated); color: var(--ink-muted); }

.dup-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.dup-chip {
  font-size: 0.66rem; font-weight: 700;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--teal-soft); color: var(--teal-dim);
  white-space: nowrap;
}
.dup-chip--muted { background: var(--bg-elevated); color: var(--ink-muted); }

/* Pair body — two columns + divider */
.dup-pair-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
}

.dup-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-width: 0;
  transition: background 0.14s, border-color 0.14s;
  opacity: 60%;
}

/* Column head is now the radio control itself — clicking anywhere in it
   (UID label included) marks that side as the one to quarantine. The hint
   text only appears on hover/selection so the row reads as plain metadata
   the rest of the time. */
.dup-col-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.03em;
  color: var(--ink-muted); text-transform: uppercase;
  cursor: pointer; user-select: none;
}
.dup-col-head input[type="radio"] {
  width: 14px; height: 14px; flex-shrink: 0;
  accent-color: var(--red); cursor: pointer;
}
.dup-col-uid { color: var(--ink-soft); font-weight: 800; letter-spacing: 0.02em; }
.dup-col-select-hint {
  margin-left: auto;
  font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--ink-muted);
  opacity: 0;
  transition: opacity 0.14s;
}
.dup-col:hover .dup-col-select-hint { opacity: 1; }

.dup-col-title {
  font-size: 0.84rem; font-weight: 700; color: var(--ink);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.dup-col-meta {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.74rem; color: var(--ink-soft);
}
.dup-col-meta span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dup-col-abstract {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--ink-soft);
  padding-top: 6px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Selected side — the one queued for quarantine. Kept on the neutral
   --bg-page surface (not a red fill) so the card stays calm to read; the
   red border/label is enough to mark which side will move, matching the
   footer action button below. */
.dup-col--selected {
  background: var(--bg-surface);
  opacity: 100%;
}

.dup-vs {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted); font-size: 1rem;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .dup-screen-card { padding: 14px 14px 16px; }
  .dup-criteria-row { gap: 16px; }
  .dup-run-btn { align-self: stretch; justify-content: center; width: 100%; margin-left: 0; }
  .dup-pair-body { grid-template-columns: 1fr; }
  .dup-vs { display: none; }
  .dup-col-select-hint { opacity: 1; }
}