/* ── MCRO Forensic Reports Viewer ── */

:root {
  --bg-deep: #0c0c12;
  --bg-base: #12121c;
  --bg-surface: #1a1a2e;
  --bg-card: #16162a;
  --text: #e1d9eb;
  --text-bright: #f0f0f0;
  --text-muted: #a0a0a0;
  --text-dim: #707070;
  --border: #2a2a3c;
  --border-dim: #1e1e30;
  --border-bright: #3a3a52;
  --red: #ff5545;
  --gold: #ffb732;
  --green: #4eecc8;
  --cyan: #4eecc8;
  --blue: #3a86ba;
  --purple: #b990e6;
  --orange: #ff8c42;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  height: 100vh;
  overflow: hidden;
}

/* ── Site Bar ── */
.site-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bar-brand { text-decoration: none; }
.bar-brand img { height: 46px; }
.bar-sep { color: var(--text-dim); font-size: 18px; }
.bar-section {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.bar-section:hover { color: var(--text-bright); }
.bar-nav {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Layout ── */
.reports-layout {
  display: flex;
  height: calc(100vh - 52px);
  position: relative;
}

/* ── Sidebar ── */
.reports-sidebar {
  width: 420px;
  min-width: 300px;
  flex-shrink: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 12px;
}

.sidebar-overview-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-base);
  border: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}
.sidebar-overview-btn:hover { background: var(--bg-surface); color: var(--text-bright); }
.sidebar-overview-btn.active {
  background: var(--bg-surface);
  border-left: 3px solid var(--gold);
  color: var(--gold);
}

.sidebar-groups {
  flex: 1;
  overflow-y: auto;
}

/* Group button */
.group-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-base);
  border: none;
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}
.group-btn:hover { background: var(--bg-surface); color: var(--text-bright); }
.group-btn.expanded {
  color: var(--gold);
  background: var(--bg-surface);
  border-left: 3px solid var(--gold);
}
.group-toggle {
  font-size: 9px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.group-btn.expanded .group-toggle { transform: rotate(90deg); }
.group-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
}

/* Report list (collapsed by default) */
.report-list {
  display: none;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-dim);
}
.report-list.expanded { display: block; }

.report-btn {
  display: block;
  width: 100%;
  padding: 10px 16px 10px 24px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(42,42,60,0.4);
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  transition: 0.15s;
}
.report-btn:hover { background: var(--bg-surface); color: var(--text); }
.report-btn.active {
  color: var(--text-bright);
  background: var(--bg-surface);
  border-left: 3px solid var(--cyan);
  border-top: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
}
/* Multi-line report title */
.report-title-main {
  display: block;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 4px;
}
.report-btn:hover .report-title-main,
.report-btn.active .report-title-main { color: var(--text-bright); }
.report-title-sub {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.report-btn.active .report-title-sub { color: var(--text); }

/* ── Splitter ── */
.reports-splitter {
  width: 5px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}
.reports-splitter:hover, .reports-splitter.dragging {
  background: var(--green);
}

/* ── Main Panel ── */
.reports-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-deep);
  background-image: radial-gradient(ellipse at center top, rgba(78,236,200,0.13), transparent 60%);
  background-repeat: no-repeat;
  background-size: 100% 100vh;
  background-position: top center;
}

/* ── Overview (Landing Page) ── */
.reports-overview {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.reports-overview.active { display: block; }

.overview-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.overview-hero {
  text-align: center;
  margin-bottom: 48px;
}
.overview-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 8px 24px;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  margin-bottom: 24px;
  background: var(--bg-deep);
}
.overview-title {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.overview-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 720px;
  margin: 0 auto;
}

/* Stats grid */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
.stat-card {
  background: var(--bg-deep);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: #cccccc;
}
.stat-label {
  font-family: var(--mono);
  font-size: 12px;
  color: #cccccc;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Narrative */
.overview-narrative h2 {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
}
.overview-narrative p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 16px;
}

/* Findings grid */
.finding-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 32px;
}
.finding-card {
  background: var(--bg-card);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.finding-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--red);
}
.finding-label {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.finding-context {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Master ZIP card — sits above the 14-category list */
.reports-master-dl {
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 18px 20px;
  margin: 16px 0 18px;
  background: linear-gradient(135deg, rgba(255,183,50,0.08), rgba(58,134,186,0.06));
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255,183,50,0.06) inset;
}
.rmd-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.rmd-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rmd-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--bg-deep);
  background: var(--gold);
  padding: 3px 8px;
  border-radius: 3px;
}
.rmd-title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
}
.rmd-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.rmd-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 13px;
}
.rmd-size { color: var(--text-bright); font-weight: 600; }
.rmd-sep  { color: var(--text-dim); }
.rmd-hash {
  color: var(--cyan);
  cursor: pointer;
  word-break: break-all;
  transition: color 0.15s;
}
.rmd-hash:hover { color: var(--text-bright); }
.rmd-hash.copied { color: var(--gold); }
.rmd-actions {
  display: flex;
  align-items: center;
}
.rmd-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--gold);
  color: var(--bg-deep);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 6px;
  white-space: nowrap;
  transition: 0.15s;
}
.rmd-btn:hover {
  background: #ffc859;
  transform: translateY(-1px);
}

/* Category list on overview */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 32px;
}
.category-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s;
}
.category-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-bright);
}
.category-num {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  min-width: 28px;
  align-self: flex-start;
  padding-top: 2px;
}
.category-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.category-row1 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.category-name {
  font-size: 15px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.category-count {
  font-family: var(--mono);
  font-size: 13px;
  color: #cccccc;
  white-space: nowrap;
}
.category-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.category-zipsize { color: var(--text-muted); }
.category-sep    { color: var(--text-dim); }
.category-ziphash {
  color: var(--cyan);
  cursor: pointer;
  word-break: break-all;
  transition: color 0.15s;
}
.category-ziphash:hover { color: var(--text-bright); }
.category-ziphash.copied { color: var(--gold); }
.category-dl {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  text-decoration: none;
  font-family: var(--mono);
  white-space: nowrap;
  transition: 0.15s;
  align-self: center;
}
.category-dl:hover {
  background: var(--gold);
  border-color: var(--gold);
}
.category-dl:hover .category-dl-arrow,
.category-dl:hover .category-dl-label {
  color: var(--bg-deep);
}
.category-dl-arrow {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.category-dl-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.overview-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.overview-footer p {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.overview-footer strong { color: var(--text-muted); }

/* ── PDF Viewer ── */
.reports-viewer {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.reports-viewer.active {
  display: flex;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.viewer-dl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--blue);
  border-radius: 3px;
  flex-shrink: 0;
}
.viewer-dl:hover { background: rgba(77,171,240,0.12); }

.reports-viewer embed {
  flex: 1;
  width: 100%;
  border: none;
}

/* ── Drag Overlay ── */
.drag-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  cursor: col-resize;
}

/* ── Responsive ── */
/* At ≤900px the side-by-side split (sidebar + viewer) gets cramped, so we
   stack: hero + body on top, sidebar (the 14 category groups + report buttons)
   below. column-reverse keeps the .reports-main visually first. The redundant
   in-content "The 14 Categories" preview is hidden since the sidebar below
   already lists them in full, with deeper navigation. */
@media (max-width: 900px) {
  /* Release the body height/overflow lock — wide mode keeps body at 100vh so
     internal panes scroll, but stacked mode needs the page itself to scroll. */
  html, body { height: auto; overflow: visible; }
  .reports-layout {
    flex-direction: column-reverse;
    height: auto;
  }
  .reports-sidebar {
    width: 100%;
    min-width: 0;
    flex-shrink: 1;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-y: visible;
  }
  .reports-splitter { display: none; }
  .reports-main {
    flex: 1 1 auto;
    overflow: visible;
  }
  .reports-overview { overflow-y: visible; }
  .reports-overview .categories-section { display: none; }
  /* PDF embeds default to ~150px when their parent has no definite height —
     in stacked mode the layout/main are auto-height, so we give the viewer an
     explicit fill of the area below the sticky site-nav (≈66px tall). The
     embed inside (flex:1) then fills its share. */
  .reports-viewer { min-height: calc(100vh - 66px); }
}
@media (max-width: 768px) {
  .overview-stats { grid-template-columns: repeat(2, 1fr); }
  .finding-grid { grid-template-columns: repeat(2, 1fr); }
}
