/* ============================================================
   Onboarding v2 — two-column seed page (desktop).
   Gated to ONBOARDING_V2_EMAILS; inherits the existing design
   tokens (tokens.css). Mobile is handled later.
   ============================================================ */

/* Import sources row (GS CSV · ORCID · Zotero) */
.v2-import { margin-bottom: 14px; }
.v2-import-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
}
.v2-import-item { display: flex; flex-direction: column; gap: 4px; }
.v2-import-item .hint { font-size: 0.74rem; }
.v2-import-item input[type="file"] { font-size: 0.8rem; color: var(--fg-2); max-width: 240px; }
.v2-import-status { margin-top: 8px; font-size: 0.78rem; min-height: 1em; color: var(--fg-2); }

/* Optional profile (name / institution) row */
.v2-profile-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.v2-profile-row .seed-input { flex: 1 1 200px; }

/* Two disjoint columns */
.v2-columns { display: flex; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.v2-col {
  position: relative;            /* anchor for the busy overlay/glow (#2) */
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-sm);
  background: var(--ink-800, rgba(0,0,0,0.12));
  padding: 10px;
}
.v2-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 0.82rem; font-weight: 600;
  color: var(--fg-2);
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--border-hair);
  margin-bottom: 8px;
}
.v2-col-head .count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-3); }

/* Independent scroll, no visible scrollbar */
.v2-list {
  display: flex; flex-direction: column; gap: 8px;
  height: 360px; overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: none;            /* Firefox */
  -ms-overflow-style: none;         /* old Edge */
}
.v2-list::-webkit-scrollbar { width: 0; height: 0; display: none; } /* WebKit */

.v2-empty {
  color: var(--fg-3); font-size: 0.82rem; line-height: 1.5;
  padding: 16px 8px; text-align: center;
}

/* Paper block — no id line; two-line title; year under the checkbox */
.v2-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-sm);
  background: var(--ink-700);
  cursor: pointer;
  transition: border-color var(--dur-1, .15s) var(--ease-out, ease);
}
.v2-card:hover { border-color: var(--border-soft); }
.v2-card.selected { border-color: var(--signal-violet); background: rgba(167, 139, 250, 0.05); }

/* Checkbox + year stacked, year left-aligned to the checkbox box */
.v2-card__check-col {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  flex-shrink: 0;
}
.v2-card__check {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1px solid var(--border-soft);
  display: inline-flex; align-items: center; justify-content: center;
}
.v2-card.selected .v2-card__check {
  background: var(--signal-violet); border-color: var(--signal-violet); color: var(--ink-900);
}
.v2-card__check svg { width: 12px; height: 12px; }
.v2-card__year { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); line-height: 1; }

.v2-card__title {
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; color: var(--fg-1); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* Search mode toggle (one active at a time) */
.v2-mode-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.v2-mode-btn {
  font-family: var(--font-sans);
  font-size: 0.78rem; padding: 0.3rem 0.8rem;
  border: 1px solid var(--border-soft); border-radius: 999px;
  background: transparent; color: var(--fg-2); cursor: pointer;
  transition: all var(--dur-1, .15s) var(--ease-out, ease);
}
.v2-mode-btn:hover { border-color: var(--signal-violet); color: var(--fg-1); }
.v2-mode-btn.active {
  background: var(--signal-violet); border-color: var(--signal-violet); color: var(--ink-900);
}

/* The describe-search dropdown reuses .paper-search-dropdown / .paper-search-result */

/* ---------- Import bar (tidy grid, #7) ---------- */
.v2-import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px 16px;
  align-items: end;
}
.v2-imp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.v2-imp-label {
  font-family: var(--font-sans);
  font-size: 0.72rem; font-weight: 600; letter-spacing: .02em;
  color: var(--fg-3); text-transform: uppercase;
}
.v2-imp-inline { display: flex; gap: 6px; }
.v2-imp-inline .seed-input { flex: 1 1 auto; min-width: 0; }
.v2-imp-btn { flex: 0 0 auto; font-size: 0.76rem; padding: 0.34rem 0.7rem; white-space: nowrap; }
.v2-imp-file { font-size: 0.78rem; color: var(--fg-2); }

/* ---------- Card body + source badge (#6) ---------- */
.v2-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.v2-card__src {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 9px; line-height: 1.4; letter-spacing: .03em;
  padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--border-soft); color: var(--fg-3);
}
.v2-src-arxiv  { border-color: rgba(179, 27, 27, 0.55);  color: #e0857f; }
.v2-src-GS     { border-color: rgba(66, 133, 244, 0.55); color: #8ab4f8; }
.v2-src-ORCID  { border-color: rgba(166, 206, 57, 0.55); color: #b6d957; }
.v2-src-library{ border-color: rgba(167, 139, 250, 0.55); color: var(--signal-violet); }

/* ---------- "Add selected" buttons (#3/#4) ---------- */
.v2-add-btn {
  font-family: var(--font-sans);
  font-size: 0.74rem; padding: 0.28rem 0.75rem;
  border-radius: 6px; cursor: pointer;
  border: 1px solid var(--signal-violet);
  background: var(--signal-violet); color: var(--ink-900);
  transition: filter var(--dur-1, .15s) var(--ease-out, ease);
}
.v2-add-btn:hover { filter: brightness(1.08); }

/* ---------- In-progress glow + overlay (#2/#4, magenta) ---------- */
.v2-list-wrap { position: relative; }
.v2-busy-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: none; align-items: center; justify-content: center;
  text-align: center; padding: 12px;
  background: rgba(10, 8, 16, 0.55);
  border-radius: var(--r-sm);
}
.v2-busy-overlay.active { display: flex; }
.v2-busy-overlay span {
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600;
  color: #f5b8ec;
}
.v2-busy {
  border-color: #d946ef !important;
  box-shadow: 0 0 0 1.5px #d946ef, 0 0 16px rgba(217, 70, 239, 0.55) !important;
}
.v2-search-msg {
  margin-top: 0.5rem; font-size: 0.82rem; font-weight: 600; color: #f0a6e6;
}

/* ---------- Dropdown multi-select (#4) ---------- */
.paper-search-result.selected {
  border-color: var(--signal-violet);
  background: rgba(167, 139, 250, 0.08);
}
.paper-search-result .psr-check { color: var(--signal-violet); font-weight: 700; }

/* ---------- History date-range browser (#3 — dedicated page) ---------- */
.history-range-bar { margin: 14px 0 0; }
#view-range .range-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  position: relative; z-index: 60; margin-bottom: 14px;   /* #2/#4: above the list */
}
.range-cal-btn { display: inline-flex; align-items: center; gap: 6px; }
#rangeCalDrop { position: absolute; top: 100%; margin-top: 6px; z-index: 80; }
/* keep the paper list below the controls so the calendar paints on top */
#view-range .range-list { position: relative; z-index: 1; }

/* #5: History week calendar must sit above the day-jump buttons */
#historyCalDrop { z-index: 120; }
.history-jump-btns { z-index: 5; }

/* single-day grid, reusing the History calendar's cal-* look */
.cal-day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
button.cal-day {
  background: transparent; border: 1px solid transparent; cursor: pointer;
  padding: 6px 0; border-radius: 6px; color: var(--fg-2); font: inherit;
}
button.cal-day:hover { border-color: var(--signal-violet); color: var(--fg-1); }
button.cal-day.cal-day--out { opacity: .4; }
button.cal-day.cal-day--today { font-weight: 700; color: var(--fg-1); }
button.cal-day.cal-day--sel { background: var(--signal-violet); border-color: var(--signal-violet); color: var(--ink-900); }

.range-list {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; padding-right: 4px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.range-list::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* Cards keep their natural height; the list scrolls instead of squashing them
   (flex children default to flex-shrink:1, which compressed cards as the count grew). */
.range-list > .history-item { flex-shrink: 0; }

/* Desktop: lock the page so the header + date controls stay put and only the
   paper list scrolls (no redundant whole-page scroll). #content is the scroll
   container at 100vh; the view fills it as a flex column. */
@media (min-width: 769px) {
  #view-range.active { height: 100%; display: flex; flex-direction: column; }
  #view-range .view-head,
  #view-range .range-controls { flex-shrink: 0; }
  #view-range .range-list { flex: 1 1 auto; min-height: 0; }
}
.range-card { padding: 14px 16px; }
.range-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.range-card-titlewrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-card-title { font-family: var(--font-sans); font-weight: 600; color: var(--fg-1); text-decoration: none; }
.range-card-title:hover { text-decoration: underline; color: var(--signal-violet); }
.range-card-date { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); white-space: nowrap; }
.range-card-meta { font-size: 0.8rem; color: var(--fg-3); margin-top: 4px; }
.range-card-abstract { font-size: 0.9rem; color: var(--fg-2); line-height: 1.55; margin: 10px 0; }
.range-score { display: flex; gap: 8px; margin: 8px 0; }
.history-badge.neutral { color: var(--fg-3); }

/* ---------- "Build your interests" how-to overlay (#1) ----------
   Prominent on entry (covers the screen, forcing a read); the dismiss/(?)
   "warps" it to/from the (?) next to the title via a scale-from-corner. */
.seed-howto-head { display: flex; align-items: center; flex-wrap: wrap; }
.seed-howto-dot { font-weight: 600; }
.seed-howto-dot[aria-expanded="true"] { opacity: 1; }
.v2-howto-overlay {
  position: fixed; inset: 0; z-index: 300;      /* above the mobile shell (210) */
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--scrim-strong, rgba(6, 5, 12, 0.72));
  opacity: 0; visibility: hidden;
  transition: opacity .28s var(--ease-out, ease), visibility .28s var(--ease-out, ease);
}
.v2-howto-overlay.open { opacity: 1; visibility: visible; }
.v2-howto-card {
  max-width: 520px; width: 100%; margin: 0;
  transform: translateY(-44px) scale(0.04); opacity: 0;
  transform-origin: 28% 0%;                     /* warp to/from the (?) by the title */
  transition: transform .4s var(--ease-out, ease), opacity .3s var(--ease-out, ease);
}
.v2-howto-overlay.open .v2-howto-card { transform: none; opacity: 1; }
.v2-howto-card h3 { margin: 0 0 0.5rem; }
.v2-howto-card .comp-intro-list { margin: 0.5rem 0 1rem; }
.v2-howto-card .comp-intro-list li { margin: 0.3rem 0; }
