/* ═══════════════════════════════════════════════════════════════════════════
   DCPG Property Reports — Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --navy: #1B2B5E;
  --navy-light: #2a3f7a;
  --gold: #F5A623;
  --gold-dark: #d48e1c;
  --green: #22c55e;
  --green-dark: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
}

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

body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: #f5f6f8;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: none; color: var(--navy-light); }

/* ── Navbar ── */
.navbar {
  background: white;
  color: var(--gray-900);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gray-200);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--navy);
  text-decoration: none;
}
.brand-dcpg {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
}
.brand-sub {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
}
.nav-links { display: flex; gap: 2px; }
.nav-link {
  color: var(--gray-600);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}
.nav-link:hover {
  background: var(--gray-50);
  color: var(--navy);
  text-decoration: none;
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--gray-400);
  font-size: 12px;
}

/* ── Typography ── */
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-subtitle { color: var(--gray-600); font-size: 14px; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.header-actions { display: flex; gap: 8px; align-items: center; }
.back-link {
  font-size: 13px;
  color: var(--gray-600);
  display: inline-block;
  margin-bottom: 4px;
}
.back-link:hover { color: var(--navy); }

/* ── Dashboard hero ── */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--gray-200);
}
.dash-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}
.dash-subtitle {
  color: var(--gray-400);
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
}
.dash-stats {
  display: flex;
  gap: 32px;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dash-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.dash-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ── Sections ── */
.section { margin-bottom: 40px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.section-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
}
.section-actions { margin-top: 16px; }

/* ── Report list (replaces date-timeline) ── */
.report-list {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.report-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.report-row:last-child { border-bottom: none; }
.report-row:hover { background: var(--gray-50); text-decoration: none; }
.report-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  min-width: 110px;
}
.report-location {
  font-size: 13px;
  color: var(--gray-600);
  flex: 1;
}
.report-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: 20px;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}
.report-address {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}
.report-arrow {
  font-size: 14px;
  color: var(--gray-300);
  transition: color .15s, transform .15s;
}
.report-row:hover .report-arrow { color: var(--navy); transform: translateX(2px); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  gap: 6px;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-light); }
.btn-outline {
  background: white;
  color: var(--navy);
  border-color: var(--gray-300);
}
.btn-outline:hover { border-color: var(--navy); background: var(--gray-50); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-active {
  background: var(--navy) !important;
  color: white !important;
  border-color: var(--navy) !important;
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-label { font-size: 11px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.card-grid.top-deals {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ── Deal Card ── */
.deal-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.deal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  border-color: var(--gray-300);
}
a.deal-card { cursor: pointer; }

.card-rank {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--navy);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 2;
  letter-spacing: 0.3px;
}
.card-image {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--gray-100);
}
.card-image--empty {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.deal-card:hover .card-image img { transform: scale(1.03); }
.card-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-address { font-size: 14px; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.card-price { font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.3px; }
.card-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--gray-400); flex-wrap: wrap; }
.card-strategy { display: flex; gap: 6px; align-items: center; }
.card-footer { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.card-scores { display: flex; gap: 16px; align-items: flex-start; }
.score-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.score-label { font-size: 10px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.3px; }
.score-row { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.score-mini { display: flex; align-items: center; gap: 6px; }
.card-gdv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--gray-100);
}
.gdv-label { color: var(--gray-400); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.3px; }
.gdv-value { font-weight: 700; color: var(--navy); font-size: 14px; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--gray-100); }
.card-pdf-link { font-size: 11px; }
.card-pdf-link:hover { border-color: var(--navy); background: var(--gray-50); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-location { background: var(--gold); color: white; }
.badge-tenure { background: var(--gray-200); color: var(--gray-700); }
.badge-strategy { color: white; }
.badge-flip { background: #f97316; }
.badge-brrr { background: #3b82f6; }
.badge-btl { background: var(--green); }
.badge-rag { color: white; }
.badge-rag-green { background: var(--green-dark); }
.badge-rag-amber { background: var(--amber); }
.badge-rag-red { background: var(--red); }
.badge-running { background: #3b82f6; color: white; }

/* ── Rank Badge (large, detail page) ── */
.rank-badge {
  background: var(--navy);
  color: white;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.rank-badge--lg { font-size: 18px; padding: 4px 12px; }

/* ── Date Timeline ── */
.date-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.date-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all .15s;
}
.date-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.date-card-date { font-size: 15px; font-weight: 700; color: var(--navy); }
.date-card-location { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ── Detail Hero ── */
.detail-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 300px;
}
.hero-info { padding: 24px; }
.hero-title { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.hero-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--gray-600); margin-bottom: 16px; }

/* ── KPI Strip ── */
.kpi-strip {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
}
.kpi { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kpi-label { font-size: 10px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; }
.kpi-value { font-size: 18px; font-weight: 900; color: var(--gray-900); }
.kpi-sub { font-size: 11px; color: var(--gray-600); }

/* ── Detail Sections ── */
.detail-section {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.section-toggle { cursor: pointer; user-select: none; }
.section-toggle:hover { color: var(--navy-light); }
.toggle-icon { margin-left: auto; font-size: 18px; color: var(--gray-400); }

/* ── Charts ── */
.chart-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; justify-content: center; }
.chart-container { flex: 1; min-width: 300px; display: flex; justify-content: center; }
.chart-container svg { max-width: 100%; height: auto; }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--navy);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--gray-200);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tr:hover { background: var(--gray-50); }
.url-cell { max-width: 400px; word-break: break-all; font-size: 12px; }

/* ── Finance Grid ── */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.finance-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
}
.finance-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}
.mini-table { width: 100%; font-size: 13px; }
.mini-table td { padding: 4px 0; }
.mini-table td:last-child { text-align: right; font-weight: 600; }
.row-total td {
  border-top: 2px solid var(--gray-300);
  font-weight: 700 !important;
  padding-top: 8px;
}

/* ── Negotiation / Tip boxes ── */
.negotiation-box, .tip-box {
  background: var(--gray-50);
  border-left: 4px solid var(--gold);
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 16px;
}
.negotiation-box h4, .tip-box h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}
.negotiation-box p, .tip-box p { font-size: 13px; margin-bottom: 4px; }
.total-line { margin-top: 12px; font-size: 14px; }

/* ── Text blocks ── */
.text-block {
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-700);
}

/* ── Lists ── */
.refurb-list, .risk-list, .feature-list {
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.8;
}
.risk-list li { color: var(--red); }
.risk-list li::marker { content: "! "; }

/* ── Image Gallery ── */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.gallery-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .15s;
}
.gallery-img:hover { transform: scale(1.03); }

/* ── Analyse Form ── */
.analyse-form-section {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 28px;
}
.input-row { display: flex; gap: 8px; margin-top: 8px; }
.input-url {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  transition: all .15s;
}
.input-url:focus { outline: none; border-color: var(--navy); background: white; box-shadow: 0 0 0 3px rgba(27,43,94,.08); }
.form-note { font-size: 12px; color: var(--gray-400); margin-top: 8px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
}
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ── Daily Header ── */
.daily-header {
  margin-bottom: 28px;
}
.daily-meta {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Daily Stats Strip ── */
.daily-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.daily-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.daily-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.daily-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 18px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.filter-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover {
  border-color: var(--gray-300);
  color: var(--navy);
  background: var(--gray-50);
}
.filter-btn--active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.filter-btn--active:hover {
  background: var(--navy-light);
  border-color: var(--navy-light);
  color: white;
}
.filter-divider {
  width: 1px;
  height: 24px;
  background: var(--gray-200);
  flex-shrink: 0;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
  font-size: 15px;
  background: white;
  border-radius: var(--radius);
  border: 1px dashed var(--gray-300);
}
.empty-hint { font-size: 13px; margin-top: 4px; }
.empty-hint a { color: var(--navy); font-weight: 600; }

/* ── Utilities ── */
.text-green { color: var(--green-dark); }
.text-red { color: var(--red); }
.text-sm { font-size: 12px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: 1fr; }
  .hero-image img { min-height: 200px; }
  .finance-grid { grid-template-columns: 1fr; }
  .chart-row { flex-direction: column; }
  .chart-container { min-width: unset; }
  .controls { flex-direction: column; gap: 12px; }
  .page-header { flex-direction: column; }
  .kpi-strip { gap: 12px; }
  .input-row { flex-direction: column; }
  .date-timeline { grid-template-columns: 1fr 1fr; }
  .nav-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 8px; }
  .dash-hero { flex-direction: column; gap: 16px; align-items: flex-start; }
  .dash-stats { gap: 20px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .report-row { padding: 12px 16px; }
  .daily-stats { gap: 16px; flex-wrap: wrap; }
  .filter-bar { gap: 10px; padding: 10px 14px; }
  .filter-divider { display: none; }
  .filter-group { flex-wrap: wrap; }
}
