/* =========================================================
   CREdocket — Litigation Value Estimator page styles
   ========================================================= */

.cv-field { margin-bottom: 16px; }
.cv-field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; }
.cv-field select, .cv-field input { width: 100%; padding: 9px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-primary); font-size: 14px; }

/* The single freeform "tell us about your case" bar -- styled like a
   modern AI chat input (one rounded box, generous padding, auto-growing)
   rather than the old per-category dropdown grid it replaces. Selector is
   deliberately over-specific (.cv-field textarea.cv-description-bar) so it
   reliably wins over the generic ".cv-field textarea" rule further down
   this file regardless of source order. */
.cv-field textarea.cv-description-bar {
  width: 100%;
  min-height: 96px;
  resize: none;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cv-description-bar::placeholder { color: var(--text-muted); }
.cv-field textarea.cv-description-bar:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* Lightweight two-button "your side" toggle -- replaces the old
   role-labeled <select>, since the category (and its role labels) is no
   longer known client-side. Either button can be clicked again to
   deselect back to "unknown side" rather than forcing a guess. */
.cv-side-toggle-wrap { margin: 4px 0 18px; }
.cv-side-toggle-label { display: block; font-size: 12.5px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 9px; }
.cv-side-toggle { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius-full); padding: 3px; gap: 3px; background: var(--bg-elevated); }
.cv-side-toggle-btn {
  border: none; background: transparent; padding: 9px 16px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.cv-side-toggle-btn:hover { color: var(--text-primary); }
.cv-side-toggle-btn.is-active { background: var(--accent); color: #fff; }

.cv-summary { padding: 24px; margin-bottom: 20px; text-align: center; }
/* This is the one number the entire tool exists to produce -- previously
   sized SMALLER than the page's own h2 (clamp(2rem,3.2vw,3rem) in
   styles.css), which meant nothing about it visually said "look here
   first." Enlarged well past body-copy scale and weighted heavier so it
   reads as the headline result it is. */
.cv-net { font-family: var(--font-display); font-size: clamp(2.75rem, 6vw, 4.5rem); font-weight: 700; line-height: 1.05; color: var(--accent-deep); margin: 6px 0; }

.cv-claims { display: grid; gap: 14px; }
.cv-claim-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; background: var(--bg-elevated); }
.cv-claim-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.cv-claim-top h4 { font-size: 15px; margin: 0; }
.cv-prob { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-deep); background: var(--accent-wash); padding: 3px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.cv-damages { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.cv-ev { font-size: 13.5px; color: var(--text-primary); margin-bottom: 8px; }
.cv-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.cv-citations { border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 6px; }
.cv-citations-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.cv-citation { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; }
.cv-citation a { color: var(--accent-deep); }

.cv-cost-section { border-top: 1px solid var(--border-soft); margin-top: 8px; padding-top: 20px; margin-bottom: 20px; }
.cv-cost-section #cv-cost-form-host { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; }

/* This trio is a generic litigate/settle/mixed recommendation, not tied
   to any litigation-taxonomy category or status -- was borrowing
   --status-ruling/--cat-construction/--status-pending as arbitrary
   swatches, which is exactly what the --ui-* tokens (styles.css) exist
   for instead. */
.cv-verdict { border-radius: var(--radius-md); padding: 12px 16px; font-size: 13px; font-weight: 600; text-align: center; }
.cv-verdict-litigate { background: color-mix(in srgb, var(--ui-success) 14%, transparent); color: var(--ui-success); }
.cv-verdict-settle { background: color-mix(in srgb, var(--ui-danger) 14%, transparent); color: var(--ui-danger); }
.cv-verdict-mixed { background: color-mix(in srgb, var(--ui-warning) 14%, transparent); color: var(--ui-warning); }

@media (max-width: 640px) {
  .cv-cost-section #cv-cost-form-host { grid-template-columns: 1fr; }
  /* The two side-toggle buttons stack full-width on narrow screens --
     switch the outer pill to a plain rounded rect so it doesn't read as
     one stretched-out stadium shape wrapping two stacked rows. */
  .cv-side-toggle { width: 100%; border-radius: var(--radius-md); }
  .cv-side-toggle-btn { flex: 1 1 auto; width: 100%; text-align: center; }
}

/* ---- AI Document Analysis ---- */
.cv-ai-balance { margin-bottom: 18px; }

.cv-ai-dropzone { position: relative; border: 1.5px dashed var(--border); border-radius: var(--radius-md); padding: 26px 20px; text-align: center; margin-bottom: 16px; transition: border-color 0.15s, background 0.15s; }
.cv-ai-dropzone.is-dragover { border-color: var(--accent); background: var(--accent-wash); }
.cv-ai-dropzone-inner { color: var(--text-secondary); }
.cv-ai-dropzone-inner svg { color: var(--text-muted); margin-bottom: 8px; }
.cv-ai-dropzone-inner p { font-size: 13.5px; margin: 4px 0; }
.cv-ai-filelist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.cv-ai-file-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent-deep); font-family: var(--font-mono); background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-full); padding: 5px 8px 5px 12px; }
.cv-ai-file-remove { background: none; border: none; color: var(--accent-deep); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.cv-ai-file-remove:hover { color: var(--status-filed); }

.cv-field textarea { width: 100%; padding: 9px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-primary); font-size: 13.5px; font-family: inherit; resize: vertical; }

.cv-ai-status { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; min-height: 16px; display: flex; align-items: center; gap: 8px; }
.cv-ai-status.is-error { color: var(--ui-danger); font-weight: 600; }

/* ---- "Add More Information" follow-up + preserved history ---- */
.cv-history-entry { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; background: var(--bg-elevated); overflow: hidden; }
.cv-history-entry summary { padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.cv-history-entry summary::before { content: "▸"; color: var(--text-muted); transition: transform 0.15s; }
.cv-history-entry[open] summary::before { transform: rotate(90deg); }
.cv-history-entry summary::-webkit-details-marker { display: none; }
.cv-history-body { padding: 4px 16px 16px; opacity: 0.85; }
.cv-followup-card { background: var(--bg-elevated); }

/* A real spinning indicator, not just text that changes every 25s -- a
   long-running analysis needs something moving on screen the whole time,
   or it reads as broken well before it actually is. currentColor-based so
   it works both on the button (white on accent) and in the muted status
   line (gray on transparent) without a separate color variant. */
.cv-spinner {
  display: inline-block; flex-shrink: 0;
  width: 15px; height: 15px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: cv-spin 0.75s linear infinite;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }

/* A result/gate card reporting an actual failure (extraction error, server
   error, expired session) needs to read as unmistakably different from the
   same card used for a calm loading/info/upsell state -- otherwise a real
   failure blends in and looks like nothing happened at all. */
.gate-card.is-error {
  border: 1px solid color-mix(in srgb, var(--ui-danger) 45%, transparent);
  background: color-mix(in srgb, var(--ui-danger) 7%, var(--surface));
}
.gate-card.is-error .eyebrow { color: var(--ui-danger); }

/* A SEPARATE, amber tier for benign, expected, self-correctable states
   that sit ALONGSIDE a real, successful result -- "can't estimate a
   dollar value yet" or "part of your document wasn't read" are not
   failures, they're routine and the fix is right there in the same
   card. Reusing .is-error's red for these trained users to either feel
   alarmed by a normal state or tune out a real one -- see the three
   call sites in js/case-valuation.js this was split out of. Genuine
   failures (session expired, rate limited, server error) that replace
   the whole result -- not just a note beside one -- correctly stay red. */
.gate-card.is-advisory {
  border: 1px solid color-mix(in srgb, var(--ui-warning) 45%, transparent);
  background: color-mix(in srgb, var(--ui-warning) 7%, var(--surface));
}
.gate-card.is-advisory .eyebrow { color: var(--ui-warning); }

.cv-ai-facts { border-top: 1px solid var(--border-soft); padding-top: 10px; margin: 10px 0; }
.cv-ai-facts .detail-tag { margin: 2px 4px 2px 0; }

/* At-a-glance damages/probability table -- the primary "quick look" view
   requested to sit above the prose narrative and per-claim cards, styled
   like the rest of the PDF report's plain, no-nonsense number layout. */
.cv-summary-table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); }
.cv-summary-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cv-summary-table th, .cv-summary-table td { padding: 11px 16px; text-align: right; white-space: nowrap; }
.cv-summary-table th:first-child, .cv-summary-table td:first-child { text-align: left; white-space: normal; }
.cv-summary-table thead th { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.cv-summary-table tbody tr:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.cv-summary-table-issue { color: var(--text-primary); font-weight: 500; }
.cv-summary-table td { color: var(--text-secondary); }
.cv-summary-table-total td { border-top: 1.5px solid var(--border); color: var(--text-primary); font-weight: 600; padding-top: 12px; }
.cv-summary-table-total td:first-child { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }

@media (max-width: 560px) {
  .cv-summary-table { font-size: 12px; }
  .cv-summary-table th, .cv-summary-table td { padding: 9px 10px; }
}

/* Comprehensive Analysis -- the AI's reasoning organizes itself into
   named sections (narrativeSections: [{heading, body}]), which used to
   all get flattened into one dense, single-spaced paragraph. Each section
   now reads as its own distinct block: an accent rule marking where a new
   line of reasoning starts, a real heading in the site's display face,
   and room to breathe between multi-paragraph bodies -- the visual
   structure a litigator's memo actually has, not a wall of text. */
.cv-narrative-section { padding-left: 18px; border-left: 3px solid var(--accent); margin-bottom: 26px; }
.cv-narrative-section:last-child { margin-bottom: 0; }
.cv-narrative-heading {
  font-family: var(--font-display); font-size: 1.08rem; font-weight: 600;
  color: var(--text-primary); margin-bottom: 8px; line-height: 1.3;
}
.cv-narrative-body { font-size: 13.5px; line-height: 1.75; color: var(--text-secondary); }
.cv-narrative-body p { margin-bottom: 12px; }
.cv-narrative-body p:last-child { margin-bottom: 0; }

@media (max-width: 560px) {
  .cv-narrative-section { padding-left: 14px; }
  .cv-narrative-heading { font-size: 1rem; }
}
