/* Dark theme matching the desktop Flask app. Two views on one page:
   a landing view with two drop zones (Standard / Basic Information)
   and a full-screen review view that takes over after a PDF is dropped. */

:root {
  --bg: #1e1e1e;
  --panel: #2a2a2a;
  --panel-2: #333;
  --border: #3a3a3a;
  --text: #e5e5e5;
  --muted: #888;
  --accent: #5aa2ee;
  --accept: #2e7d32;
  --high: rgba(198, 40, 40, 0.32);
  --medium: rgba(245, 124, 0, 0.32);
  --low: rgba(251, 192, 45, 0.30);
  --high-solid: #c62828;
  --medium-solid: #f57c00;
  --low-solid: #fbc02d;
}

* { box-sizing: border-box; }

/* HTML's `hidden` attribute should take the element out of layout.
   It normally does (display: none) but an explicit `display: flex/grid`
   on the same element wins specificity and keeps the element visible.
   Without this rule the landing view kept occupying space after the
   reviewer dropped a PDF, pushing the review view below the fold. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

h1 { font-size: 22px; margin: 0 0 4px; font-weight: 500; letter-spacing: -0.01em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

code {
  background: #1a1a1a;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: #404040; }

/* =================== LANDING VIEW =================== */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
}
.landing-wrap {
  width: 100%;
  max-width: 960px;
}
.landing-header {
  text-align: center;
  margin-bottom: 28px;
}
.landing-header .tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  background: rgba(90, 162, 238, 0.06);
  border: 1px solid rgba(90, 162, 238, 0.3);
  color: #b8d3ee;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.drop-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) {
  .drop-zones { grid-template-columns: 1fr; }
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 240px;
  background: #252525;
  user-select: none;
}
.drop-zone:hover { transform: translateY(-1px); }
.drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Standard (default) zone: blue accent */
.drop-zone.standard { border-color: rgba(90, 162, 238, 0.35); }
.drop-zone.standard:hover,
.drop-zone.standard.dragover {
  border-color: var(--accent);
  background: rgba(90, 162, 238, 0.08);
}

/* Basic Information (pending) zone: orange accent */
.drop-zone.pending { border-color: rgba(245, 124, 0, 0.35); }
.drop-zone.pending:hover,
.drop-zone.pending.dragover {
  border-color: var(--medium-solid);
  background: rgba(245, 124, 0, 0.08);
}

.drop-zone.uploading { pointer-events: none; opacity: 0.5; }

/* The file input is inside the label wrapper; clicking any part of
   the label triggers it natively. Hide the input visually but keep
   it in the normal flow so the label association works everywhere. */
.drop-zone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.drop-zone h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 500;
}
.drop-zone h3 .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 6px;
  vertical-align: middle;
}
.drop-zone.standard h3 .badge { background: rgba(90, 162, 238, 0.2); color: #9ec9ff; }
.drop-zone.pending  h3 .badge { background: rgba(245, 124, 0, 0.2); color: #ffbf80; }

.drop-zone p { margin: 6px 0; font-size: 13px; color: var(--muted); }
.drop-zone .big {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin: 8px 0 4px;
}

.summary {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}
.summary.error {
  color: #f5a0a0;
}

/* =================== REVIEW VIEW =================== */

.review-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: 100vh;
  overflow: hidden;
}
#review-column {
  overflow-y: auto;
  padding: 20px;
  background: #111;
}
#review-sidebar {
  overflow-y: auto;
  padding: 14px 16px;
  border-left: 1px solid var(--border);
  background: var(--panel);
}
#review-pages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.pdf-page-outer { display: inline-block; }
.pdf-page-num {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.pdf-page {
  position: relative;
  background: white;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pdf-overlay {
  position: absolute;
  border: 1.5px solid transparent;
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.pdf-overlay.conf-high   { background: var(--high);   border-color: var(--high-solid); }
.pdf-overlay.conf-medium { background: var(--medium); border-color: var(--medium-solid); }
.pdf-overlay.conf-low    { background: var(--low);    border-color: var(--low-solid); }

/* Custom (user-added) redactions: purple, distinct from auto-detection
   colors so the reviewer can tell at a glance which marks they
   themselves created. Click to remove. */
.pdf-overlay.custom {
  background: rgba(156, 39, 176, 0.35);
  border-color: #9c27b0;
}

/* Transient preview rectangles shown during a click-drag selection.
   No pointer events so they don't capture the mouseup that commits
   the selection. */
.pdf-overlay.custom-preview {
  background: rgba(156, 39, 176, 0.18);
  border: 1.5px dashed #9c27b0;
  pointer-events: none;
}

/* Rejected overlays still show where the detection was (so a reviewer
   can click them again to re-approve) but render as a thin dashed
   outline with no fill so the word underneath stays readable. */
.pdf-overlay.rejected {
  background: transparent !important;
  border-style: dashed;
  border-color: var(--muted) !important;
  opacity: 0.6;
}

.help-tip {
  padding: 8px 10px;
  background: rgba(90, 162, 238, 0.08);
  border: 1px solid rgba(90, 162, 238, 0.25);
  border-radius: 4px;
  color: #b8d3ee;
  margin-bottom: 12px;
  line-height: 1.4;
}
.help-tip strong { color: #dfecf8; }

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Download buttons in the review sidebar */
.download-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.btn-download {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--accept);
  background: transparent;
  color: var(--accept);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}
.btn-download:hover { background: rgba(46, 125, 50, 0.12); }
.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.download-row .btn-download {
  width: 100%;
}

/* Findings sidebar */
.findings-page-header {
  margin: 10px 0 4px;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.finding {
  padding: 8px 10px;
  margin: 6px 0;
  border-radius: 4px;
  background: #232323;
  border-left: 3px solid var(--medium-solid);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.finding:hover { background: #2b2b2b; }
.finding.conf-high { border-left-color: var(--high-solid); }
.finding.conf-low  { border-left-color: var(--low-solid); }
.finding.custom {
  border-left-color: #9c27b0;
}
.finding.custom .finding-cat { color: #c879d9; }

/* The "Custom redactions" header pinned at the top of the findings
   sidebar -- same base layout as page headers but tinted purple so it
   reads as its own section. */
.findings-page-header.custom-header {
  color: #c879d9;
  border-bottom-color: rgba(156, 39, 176, 0.35);
}
.finding.rejected {
  opacity: 0.45;
  border-left-color: var(--muted) !important;
}
.finding.rejected .finding-text {
  text-decoration: line-through;
}
.finding-cat { font-weight: 600; color: #ff8a80; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.finding-text { margin-top: 2px; font-family: Consolas, "Courier New", monospace; font-size: 12px; word-break: break-word; }
.finding-reason { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.finding-cite { margin-top: 2px; color: var(--muted); font-size: 11px; font-style: italic; }
