/* =========================================================
   CORE.CSS - THE NAKED SKELETON
   No colors, no backgrounds, no decorative borders.
   ========================================================= */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- 1. THE UNIVERSAL BUTTON --- */
.bv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s ease;

  /* The Skeleton listens to the Theme Variables */
  background: var(--btn-bg, transparent);
  color: var(--btn-text, inherit);
  border: var(--btn-border-width, 0) var(--btn-border-style, solid) var(--btn-border-color, transparent);
  border-radius: var(--btn-radius, 0);
  padding: var(--btn-padding, 8px 16px);
  font-family: var(--btn-font, var(--font-ui));
  font-weight: var(--btn-weight, normal);
  font-size: var(--btn-size, 13px);
  box-shadow: var(--btn-shadow, none);
  text-transform: var(--btn-transform, none);
}

.bv-btn:hover {
  background: var(--btn-hover-bg, var(--btn-bg));
  color: var(--btn-hover-text, var(--btn-text));
  border-color: var(--btn-hover-border, var(--btn-border-color));
  transform: var(--btn-hover-transform, none);
  box-shadow: var(--btn-hover-shadow, var(--btn-shadow));
}

/* --- 2. BUTTON PLACEMENT CONFIGURATORS --- */
/* Wrap your buttons in a div with these classes to easily move them around */
.bv-action-bar { 
  display: flex; 
  gap: var(--action-gap, 12px); 
  align-items: center; 
  width: 100%; 
}
.bv-align-left { justify-content: flex-start; }
.bv-align-center { justify-content: center; }
.bv-align-right { justify-content: flex-end; }
.bv-align-split { justify-content: space-between; }

/* --- 3. VIEWER STAGE & FRAMES --- */
.viewer-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center; /* Center the PDF vertically */
  padding: 20px;
  overflow: hidden; /* Hide scrollbars unless zooming */
  background: var(--stage-bg, #f4f1ea);
  /* 🛡️ This prevents the viewer from expanding past the screen height */
  height: calc(100vh - 180px); 
}

#pdfCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}

.book-frame {
  position: relative;
  display: block;
  width: fit-content;
  margin: 0 auto;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#canvasContainer {
  position: relative;
  width: fit-content;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#pdfCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
  margin: 0;
  transition: filter 0.4s ease;
}
/* --- SCROLL READER STYLES --- */
#scrollReaderShell {
    scroll-behavior: smooth;
    /* Webkit scrollbar matching your existing style */
}

#scrollReaderShell::-webkit-scrollbar {
    width: 12px;
}
#scrollReaderShell::-webkit-scrollbar-track {
    background: #333;
}
#scrollReaderShell::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 6px;
    border: 3px solid #333;
}

.page-wrapper {
    background: white;
    margin-bottom: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    width: 85%;
    max-width: 900px;
    min-height: 1100px; /* Approximate A4 ratio */
    position: relative;
    transition: transform 0.2s ease;
}

.page-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.page-wrapper.active-scroll-page {
    outline: 3px solid var(--bv-accent-primary, #38bdf8);
}

.page-number-label {
    padding: 10px;
    background: #f1f1f1;
    color: #444;
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    text-align: center;
    border-top: 1px solid #ddd;
}
.viewer-topline-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.viewer-topline-meta .reader-mode-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.viewer-topline-meta .reader-mode-label {
  margin: 0;
  font-size: 12px;
  opacity: 0.75;
}

.viewer-topline-meta .bv-input {
  margin: 0;
  min-height: 40px;
}

#readerModeSelect {
  width: 145px;
}

#viewStyleSelect {
  width: 135px;
}

#viewerZoomSelect {
  width: 90px;
}
.bv-scroll-page-pulse {
  outline: 5px solid rgba(255, 174, 0, 0.95) !important;
  box-shadow:
    0 0 0 7px rgba(255, 174, 0, 0.25),
    0 0 32px rgba(255, 174, 0, 0.45) !important;
  border-radius: 10px;
}

.bv-scroll-page-pulse::before {
  content: "SEARCH HIT";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 174, 0, 0.95);
  color: #111;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.is-active-search-page {
  outline: 6px solid rgba(0, 180, 255, 1) !important;
  box-shadow:
    0 0 0 8px rgba(0, 180, 255, 0.25),
    0 0 36px rgba(0, 180, 255, 0.60) !important;
}

.claim-evidence-tray {
  margin: 28px 0 32px;
  padding: 20px;
  border: 1px solid var(--bv-border-color);
  background: rgba(255,255,255,0.72);
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}

.claim-tray-header h3 {
  margin: 0;
  font-family: var(--bv-font-heading);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.claim-tray-header p {
  margin: 6px 0 0;
  color: var(--bv-text-subtle);
  font-size: 13px;
}

.claim-tray-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.claim-tray-search-row input {
  flex: 1;
}

.claim-tray-results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  max-height: 360px;
  overflow: auto;
}

.claim-tray-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--bv-border-color);
  background: var(--bv-bg-card);
}

.claim-tray-result-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.claim-tray-result-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.claim-tray-result-text {
  color: var(--bv-text-main);
  font-size: 13px;
  line-height: 1.45;
}

.claim-tray-result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.claim-unsorted-zone {
  margin: 28px 0 42px;
  padding: 18px;
  border: 1px dashed var(--bv-border-color);
  background: rgba(255,255,255,0.45);
}

.claim-tray-card {
  margin-top: 14px;
}
/* =========================================================
   CLAIM DOSSIER — VISUAL EVIDENCE TRAY / MASONRY CARDS
========================================================= */

.claim-evidence-tray {
  margin: 28px 0 32px;
  padding: 22px;
  border: 1px solid var(--bv-border-color);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}

.claim-tray-header h3 {
  margin: 0;
  font-family: var(--bv-font-heading);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.claim-tray-header p {
  margin: 6px 0 0;
  color: var(--bv-text-subtle);
  font-size: 13px;
  line-height: 1.45;
}

.claim-tray-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.claim-tray-search-row input {
  flex: 1;
}

.claim-tray-results {
  margin-top: 18px;
  max-height: 620px;
  overflow: auto;
  padding-right: 8px;
}

/* Masonry-like responsive card grid */
.claim-tray-card-grid {
  column-width: 230px;
  column-gap: 16px;
}

.claim-tray-thumb-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  break-inside: avoid;
  border: 1px solid var(--bv-border-color);
  background: var(--bv-bg-card, #fff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.claim-tray-card-thumb {
  width: 100%;
  min-height: 150px;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--bv-border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.claim-tray-card-thumb-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.claim-tray-card-thumb-empty {
  padding: 28px 10px;
  color: var(--bv-text-subtle);
  font-family: var(--bv-font-mono, monospace);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.claim-tray-card-body {
  padding: 12px;
}

.claim-tray-card-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.claim-tray-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.claim-tray-card-preview {
  font-size: 12px;
  line-height: 1.45;
  color: var(--bv-text-main);
  opacity: 0.88;
}

.claim-tray-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-top: 1px dashed var(--bv-border-color);
  background: rgba(0, 0, 0, 0.025);
}

.claim-tray-card-actions .bv-btn {
  width: 100%;
  justify-content: center;
}

/* Permanent unsorted pile */
.claim-unsorted-zone {
  margin: 28px 0 42px;
  padding: 18px;
  border: 1px dashed var(--bv-border-color);
  background: rgba(255, 255, 255, 0.45);
}

.claim-tray-card {
  margin-top: 14px;
}
/* =========================================================
   CLAIM DOSSIER — VISUAL EVIDENCE INBOX + UNSORTED SHELF
   Additive only: does not replace existing theme CSS.
========================================================= */

.claim-evidence-tray {
  margin: 28px 0 34px;
  padding: 22px;
  border: 1px solid var(--bv-border-color);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}

.claim-tray-header h3 {
  margin: 0;
  font-family: var(--bv-font-heading);
  font-size: 19px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.claim-tray-header p {
  margin: 7px 0 0;
  color: var(--bv-text-subtle);
  font-size: 13px;
  line-height: 1.45;
}

.claim-tray-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.claim-tray-search-row input {
  flex: 1;
}

.claim-tray-results {
  margin-top: 18px;
  max-height: 620px;
  overflow: auto;
  padding-right: 8px;
}

/* Search results: masonry thumbnail picker */
.claim-tray-card-grid {
  column-width: 230px;
  column-gap: 16px;
}

.claim-tray-thumb-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  break-inside: avoid;
  border: 1px solid var(--bv-border-color);
  background: var(--bv-bg-card, #fff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.claim-tray-card-thumb {
  width: 100%;
  min-height: 150px;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--bv-border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.claim-tray-card-thumb-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.claim-tray-card-thumb-empty {
  padding: 30px 10px;
  color: var(--bv-text-subtle);
  font-family: var(--bv-font-mono, monospace);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.claim-tray-card-body {
  padding: 12px;
}

.claim-tray-card-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.claim-tray-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.claim-tray-card-preview {
  font-size: 12px;
  line-height: 1.45;
  color: var(--bv-text-main);
  opacity: 0.88;
}

.claim-tray-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-top: 1px dashed var(--bv-border-color);
  background: rgba(0, 0, 0, 0.025);
}

.claim-tray-card-actions .bv-btn {
  width: 100%;
  justify-content: center;
}

/* Unsorted tray: horizontal shelf */
.claim-unsorted-zone {
  margin: 30px 0 42px;
  padding: 18px;
  border: 1px dashed var(--bv-border-color);
  background: rgba(255, 255, 255, 0.45);
}

.claim-zone-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.claim-zone-subtitle {
  margin-top: 5px;
  color: var(--bv-text-subtle);
  font-size: 12px;
}

.claim-zone-count {
  white-space: nowrap;
  color: var(--bv-text-subtle);
  font-family: var(--bv-font-mono, monospace);
  font-size: 11px;
  text-transform: uppercase;
}

.claim-unsorted-shelf {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 12px;
  scroll-snap-type: x proximity;
}

.claim-unsorted-card {
  flex: 0 0 230px;
  scroll-snap-align: start;
  background: var(--bv-bg-card, #fff);
  border: 1px solid var(--bv-border-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.claim-unsorted-card .card-thought {
  padding: 12px;
}

.claim-unsorted-title {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.3;
  color: var(--bv-text-main);
}

.claim-unsorted-card .card-evidence-attachment {
  padding: 12px;
  background: rgba(0, 0, 0, 0.025);
}

.claim-unsorted-card .quote-text {
  max-height: 92px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
}

.claim-unsorted-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px dashed var(--bv-border-color);
  padding-top: 12px;
  margin-top: 12px;
}

.claim-unsorted-actions .bv-btn {
  width: 100%;
  justify-content: center;
}

/* Keep argument board visually stronger than the tray */
.dossier-board {
  margin-top: 34px;
}

/* AI/document maker should remain its own workplace */
.ai-engine-zone {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px dashed var(--bv-border-color);
  clear: both;
}

@media (max-width: 900px) {
  .claim-tray-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .claim-zone-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .claim-unsorted-card {
    flex-basis: 210px;
  }
}
/* Fix: allow unsorted tray cards to expand their quote/notes area */
.claim-unsorted-card .card-evidence-attachment {
  display: none;
}

.claim-unsorted-card.is-expanded .card-evidence-attachment {
  display: block;
}
/* Tray shelf cards should show a compact visual preview */
.claim-unsorted-card .claim-tray-card-thumb {
  min-height: 120px;
  max-height: 150px;
  overflow: hidden;
}

.claim-unsorted-card .claim-tray-card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* =========================================================
   CLAIM DOSSIER — BUTTON CLARITY PASS
========================================================= */

.claim-evidence-actions {
  display: flex;
  gap: 10px;
  border-top: 1px dashed var(--bv-border-color);
  padding-top: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.claim-evidence-actions .bv-btn {
  letter-spacing: 0.06em;
}

/* Main movement action */
.claim-btn-return {
  background: var(--bv-accent-primary, #5b7cfa);
  color: #fff;
  border-color: var(--bv-accent-primary, #5b7cfa);
}

/* Source/navigation actions */
.claim-btn-source {
  background: rgba(255, 255, 255, 0.7);
  color: var(--bv-text-main);
}

/* Utility action */
.claim-btn-utility {
  opacity: 0.78;
}

/* Destructive action */
.claim-btn-remove {
  color: #a33a32;
  border-color: rgba(163, 58, 50, 0.35);
  background: rgba(163, 58, 50, 0.06);
}

.claim-btn-remove:hover {
  background: rgba(163, 58, 50, 0.12);
}
/* =========================================================
   CLAIM DOSSIER — FORCE BUTTON HIERARCHY OVERRIDE
   Put this at the very bottom of the last-loaded CSS file.
========================================================= */

.claim-evidence-actions {
  display: flex !important;
  gap: 10px !important;
  border-top: 1px dashed var(--bv-border-color) !important;
  padding-top: 14px !important;
  margin-top: 16px !important;
  flex-wrap: wrap !important;
}

/* Main movement action */
.claim-evidence-actions .bv-btn.claim-btn-return {
  background: var(--bv-accent-primary, #5b7cfa) !important;
  color: #fff !important;
  border: 1px solid var(--bv-accent-primary, #5b7cfa) !important;
  opacity: 1 !important;
}

/* Source/navigation actions */
.claim-evidence-actions .bv-btn.claim-btn-source {
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--bv-text-main) !important;
  border: 1px solid var(--bv-border-color) !important;
  opacity: 1 !important;
}

/* Utility action */
.claim-evidence-actions .bv-btn.claim-btn-utility {
  background: rgba(255, 255, 255, 0.45) !important;
  color: var(--bv-text-subtle, var(--bv-text-main)) !important;
  border: 1px solid rgba(120, 120, 120, 0.22) !important;
  opacity: 0.72 !important;
}

/* Destructive action */
.claim-evidence-actions .bv-btn.claim-btn-remove {
  background: rgba(163, 58, 50, 0.08) !important;
  color: #a33a32 !important;
  border: 1px solid rgba(163, 58, 50, 0.38) !important;
  opacity: 1 !important;
}

.claim-evidence-actions .bv-btn.claim-btn-remove:hover {
  background: rgba(163, 58, 50, 0.16) !important;
}
/* =========================================================
   BOOKVAULT CLOUD WAKE NOTICE
========================================================= */

.bv-coldstart-notice {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(147, 197, 253, 0.22), transparent 38%),
    rgba(248, 250, 252, 0.74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bv-coldstart-notice[hidden] {
  display: none !important;
}

.bv-coldstart-card {
  width: min(360px, calc(100vw - 40px));
  padding: 22px 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  text-align: center;
  color: #0f172a;
}

.bv-coldstart-title {
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.bv-coldstart-text {
  font-size: 13px;
  line-height: 1.45;
  color: #475569;
}

.bv-coldstart-card::before {
  content: "";
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 14px;
  border-radius: 999px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  animation: bvColdStartSpin 0.9s linear infinite;
}

@keyframes bvColdStartSpin {
  to {
    transform: rotate(360deg);
  }
}