/* ==========================================================================
   BarrioRadar - Location Intelligence Report (A4 Printable Layout Engine)
   Version 3.1 (Design-System Compliant Exact A4 Paged Budgeting)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --report-bg: #f8fafc;
  --report-page-bg: #ffffff;
  --report-border: #e2e8f0;
  --report-border-subtle: #cbd5e1;
  --report-text-main: #0f172a;
  --report-text-secondary: #475569;
  --report-text-muted: #64748b;
  
  --report-accent-blue: #2563eb;
  --report-accent-emerald: #059669;
  --report-accent-amber: #d97706;
  --report-accent-red: #dc2626;
  --report-accent-purple: #9333ea;
  --report-accent-cyan: #0891b2;
  
  --report-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --report-font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--report-font-sans);
  background-color: var(--report-bg);
  color: var(--report-text-main);
  line-height: 1.38;
  font-size: 12.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* ==========================================================================
   Interactive Floating Toolbar (Screen Only)
   ========================================================================== */
.report-screen-toolbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-screen-toolbar .toolbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-screen-toolbar .toolbar-logo {
  height: 32px;
  width: 32px;
}

.report-screen-toolbar .toolbar-title {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.report-screen-toolbar .toolbar-tagline {
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 500;
}

.report-screen-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--report-font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.report-btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
}

.report-btn-primary:hover {
  background: #1d4ed8;
}

.report-btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.report-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   Document Container & A4 Page Budgeting
   ========================================================================== */
.report-doc-container {
  max-width: 860px;
  margin: 32px auto 64px auto;
  padding: 0 16px;
}

.report-page {
  background: var(--report-page-bg);
  width: 210mm;
  min-height: 297mm;
  height: 297mm;
  margin: 0 auto 36px auto;
  padding: 10mm 12mm 10mm 12mm;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
}

.report-page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & Official Certification Slot
   ========================================================================== */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--report-text-main);
  margin-bottom: 16px;
  gap: 16px;
}

.report-brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.report-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
  display: block;
}

.report-brand-text {
  min-width: 0;
}

.report-brand-text h1 {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--report-text-main);
  line-height: 1.15;
}

.report-brand-text p {
  font-size: 0.625rem;
  color: var(--report-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.35;
  word-break: break-word;
}

.report-meta-box {
  text-align: right;
  font-family: var(--report-font-mono);
  font-size: 0.625rem;
  color: var(--report-text-muted);
  line-height: 1.4;
  flex-shrink: 0;
  white-space: nowrap;
}

.report-doc-id {
  font-weight: 800;
  color: var(--report-text-main);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.report-qr-box {
  background: #ffffff !important;
  padding: 2px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.report-qr-box svg,
.report-qr-box canvas,
.report-qr-box img {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* ==========================================================================
   Property Hero Banner
   ========================================================================== */
/* ==========================================================================
   Replicated Canonical Sections (Deep Dossier, Geo Benchmarks, Spider Radar)
   ========================================================================== */
.report-dossier-card {
  background-color: #ffffff;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 28px;
  padding: 0;
}

.report-dossier-card .dossier-top-bar {
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.report-dossier-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  align-items: stretch;
  background-color: #ffffff;
}

.report-score-sidebar {
  border-right: 1px solid var(--border-light, #e2e8f0);
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-radius: 0;
  padding: 14px 16px;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.report-score-sidebar .big-score-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 6px solid var(--brand-accent, #2563eb);
  margin: 0 auto 8px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.report-score-sidebar .big-score-ring .big-score-num {
  font-family: var(--report-font-mono);
  font-size: 2.125rem;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
}

.report-score-sidebar .big-score-ring .big-score-max {
  font-size: 0.625rem;
  font-family: var(--report-font-mono);
  color: #64748b;
  font-weight: 700;
}

.report-bars-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.report-bars-list .cat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-bars-list .cat-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.report-bars-list .cat-bar-track {
  height: 5px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}

.report-bars-list .cat-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.report-dossier-content {
  padding: 14px 18px;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.report-essentials-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.report-essentials-table th {
  background: transparent;
  color: #64748b;
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 6px;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  text-align: left;
  white-space: nowrap;
}

.report-essentials-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: #0f172a;
  vertical-align: middle;
}

/* 2. Geographic Benchmark Section (Direct Unwrapped Grid) */
.report-geo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* 3. Spider Livability Section (3 Vertically Stacked Panels) */
.report-persona-card {
  background: #f8fafc;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.report-spider-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.report-spider-chart-col {
  background: #ffffff;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.report-matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.report-action-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.benchmark-legend-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.benchmark-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  border: 1px solid var(--border-light, #e2e8f0);
  background: #ffffff;
}

.benchmark-legend-pill.prop-pill {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.benchmark-legend-pill.city-pill {
  color: var(--text-secondary, #475569);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.prop-dot {
  background: #2563eb;
}

.city-dot {
  background: #94a3b8;
}

.benchmark-chart-footnote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light, #e2e8f0);
  font-size: 0.6875rem;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}

.benchmark-diagnostics-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.diagnostics-header {
  margin-bottom: 2px;
}

.diagnostics-header h3 {
  font-size: 1.125rem;
  font-weight: 800;
  color: #0f172a;
  margin: 4px 0 2px 0;
}

.diagnostics-header p {
  font-size: 0.75rem;
  color: #475569;
  line-height: 1.35;
  margin: 0;
}

.benchmark-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.benchmark-summary-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px 14px;
}

.report-benchmark-card {
  background: #ffffff;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-top: 3px solid #059669;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  min-height: 96px;
}

.report-benchmark-card:nth-child(2) {
  border-top-color: #8b5cf6;
}

.report-benchmark-card:nth-child(3) {
  border-top-color: #1d4ed8;
  background: #f8fafc;
}

.report-benchmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.report-benchmark-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--report-text-muted, #64748b);
  letter-spacing: 0.05em;
}

.report-benchmark-badge {
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.625rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.report-benchmark-val {
  font-family: var(--report-font-mono);
  font-size: 1.625rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin: 6px 0;
}

.report-benchmark-lbl {
  font-size: 0.6875rem;
  color: #64748b;
  line-height: 1.35;
}

.geo-explainer-card.report-geo-explainer {
  background: #f8fafc;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 14px;
}

/* ==========================================================================
   Section Layout & Typography
   ========================================================================== */
.report-section {
  margin-bottom: 8px;
}

.report-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--report-border);
}

.report-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--report-text-main);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}

.report-section-subtitle {
  font-size: 0.625rem;
  color: var(--report-text-muted);
  font-weight: 500;
}

.report-two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.report-three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.report-four-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.report-five-col {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

/* ==========================================================================
   KPI Cards & Micro-Metrics
   ========================================================================== */
.report-kpi-card {
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.report-kpi-val {
  font-family: var(--report-font-mono);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--report-text-main);
  line-height: 1.15;
}

.report-kpi-lbl {
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--report-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* ==========================================================================
   Curated Tables & Registry
   ========================================================================== */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.625rem;
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  overflow: hidden;
}

.report-table th {
  background: #f8fafc;
  color: var(--report-text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--report-border);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--report-text-main);
  vertical-align: middle;
}

.report-table tr:last-child td {
  border-bottom: none;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.5625rem;
  font-weight: 700;
  font-family: var(--report-font-mono);
  white-space: nowrap;
}

.report-badge-metro { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.report-badge-bus { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.report-badge-rail { background: #faf5ff; color: #9333ea; border: 1px solid #e9d5ff; }
.report-badge-tram { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.report-badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* ==========================================================================
   Analytics Chart Boxes
   ========================================================================== */
.report-chart-box {
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.report-analytics-card {
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.report-analytics-card-title {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--report-text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-analytics-card-sub {
  font-size: 0.5rem;
  color: var(--report-text-muted);
  margin-bottom: 2px;
}

/* ==========================================================================
   Catchment & Isochrone Band
   ========================================================================== */
.report-isochrone-box {
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  padding: 6px 8px;
}

.report-isochrone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  text-align: center;
}

.report-isochrone-cell {
  background: #f8fafc;
  border: 1px solid var(--report-border);
  border-radius: 4px;
  padding: 4px;
}

.report-isochrone-val {
  font-family: var(--report-font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--report-text-main);
}

.report-isochrone-lbl {
  font-size: 0.5rem;
  color: var(--report-text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.report-isochrone-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
  background: #e2e8f0;
}

/* ==========================================================================
   Data Provenance & Footer
   ========================================================================== */
.report-provenance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.report-provenance-col {
  background: #ffffff;
  border: 1px solid var(--report-border);
  border-radius: 6px;
  padding: 5px 7px;
}

.report-prov-header {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--report-text-main);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
}

.report-provenance-col p {
  font-size: 0.5rem;
  color: var(--report-text-secondary);
  line-height: 1.25;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--report-border);
  font-size: 0.5625rem;
  color: var(--report-text-muted);
  font-weight: 600;
  margin-top: auto;
}

/* ==========================================================================
   Mobile Responsive Screen Rules for Toolbar and Document View
   ========================================================================== */
@media screen and (max-width: 640px) {
  .report-screen-toolbar {
    padding: 8px 12px;
    height: 52px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    overflow: hidden;
  }

  .report-screen-toolbar .toolbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
  }

  .report-screen-toolbar .toolbar-brand-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
  }

  .report-screen-toolbar .toolbar-logo {
    height: 24px;
    width: 24px;
    flex-shrink: 0;
  }

  .report-screen-toolbar .toolbar-title {
    font-size: 0.8125rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .report-screen-toolbar .toolbar-tagline {
    display: none !important;
  }

  .report-screen-toolbar .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    width: auto;
  }

  .report-btn {
    padding: 5px 10px;
    height: 34px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    white-space: nowrap;
  }

  .report-btn-secondary .report-btn-text {
    font-size: 0;
  }

  .report-btn-secondary .report-btn-text::before {
    content: "Back";
    font-size: 0.75rem;
    font-weight: 700;
  }

  .report-btn-primary .report-btn-text {
    font-size: 0;
  }

  .report-btn-primary .report-btn-text::before {
    content: "PDF";
    font-size: 0.75rem;
    font-weight: 700;
  }

  .custom-lang-btn {
    padding: 4px 6px !important;
    height: 34px;
    box-sizing: border-box;
  }

  #activeLangText {
    font-size: 0.6875rem !important;
  }
}

/* ==========================================================================
   PRINT ENGINE (Strict A4 Paged Media Rules - Zero Artifacts)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .report-screen-toolbar {
    display: none !important;
  }

  .report-doc-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .report-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 8mm 10mm 8mm 10mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
    break-inside: avoid !important;
    overflow: hidden !important;
  }

  .report-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .report-master-score-card {
    background: #0f172a !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
