/* ============================================================
   WoningInzicht — stylesheet
   Gebaseerd op design/woningcheck.html
   ============================================================ */

:root {
  --navy: #0B1E3D;
  --navy2: #132B52;
  --amber: #D4891A;
  --amber-light: #FFF3DC;
  --green: #1A7A4A;
  --green-light: #E6F4ED;
  --red: #C0392B;
  --red-light: #FCECEA;
  --orange: #E07B25;
  --orange-light: #FFF0E0;
  --bg: #F5F4F0;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --muted: #6B6B6B;
  --border: #E0DED8;
  --mono: 'IBM Plex Mono', monospace;
  --serif: 'Playfair Display', serif;
  --sans: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

/* ── Autocomplete dropdown ─────────────────────────────────── */
.search-wrap { position: relative; flex: 1; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0efeb;
  color: var(--text);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.active { background: #f7f6f2; }
.autocomplete-item strong { font-weight: 600; }

/* ── Search hero ───────────────────────────────────────────── */
.hero {
  background: var(--navy);
  padding: 56px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,.015) 40px,
    rgba(255,255,255,.015) 80px
  );
}
.hero-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .15em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 16px;
  position: relative;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 12px;
  position: relative;
}
.hero p {
  color: rgba(255,255,255,.55);
  font-size: 16px;
  margin-bottom: 36px;
  font-weight: 300;
  position: relative;
}
.search-bar {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  gap: 0;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.search-bar input {
  flex: 1;
  width: 100%;
  padding: 16px 20px;
  font-family: var(--sans);
  font-size: 15px;
  border: none;
  border-radius: 6px 0 0 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.search-bar input::placeholder { color: #aaa; }
.search-bar button {
  padding: 16px 24px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: .02em;
  transition: background .15s;
  flex-shrink: 0;
}
.search-bar button:hover { background: #c07c12; }
.hero-tags {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
  position: relative;
}
.hero-tags span {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,.35);
  letter-spacing: .05em;
}

/* ── Loading state ────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .08em;
}
.loading-steps {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}
.step-done { color: var(--green); }
.step-active { color: var(--amber); font-weight: 500; }

/* ── Report wrapper ───────────────────────────────────────── */
.report-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ── Report header ────────────────────────────────────────── */
.report-header {
  background: var(--navy);
  color: #fff;
  padding: 32px 36px 28px;
}
.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.brand-mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--amber);
  text-transform: uppercase;
}
.report-date {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,.35);
}
.report-address {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}
.report-address-sub {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: rgba(255,255,255,.5);
}
.report-scores {
  display: flex;
  gap: 0;
  margin-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  flex-wrap: wrap;
}
.score-item {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 0 12px;
  border-right: 1px solid rgba(255,255,255,.1);
}
.score-item:last-child { border-right: none; }
.score-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.score-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.score-value.amber  { color: var(--amber); }
.score-value.green  { color: #4AE89A; }
.score-value.orange { color: #FFB347; }
.score-value.red    { color: #FF7B7B; }
.score-value.muted  { color: rgba(255,255,255,.4); font-size: 18px; }
.score-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

/* ── Section headers ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  margin-bottom: 4px;
}
.section-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Cards & grids ────────────────────────────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.section-grid.thirds { grid-template-columns: 1fr 1fr 1fr; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
}
.card.full { grid-column: 1 / -1; }
.card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.data-row:last-child { border-bottom: none; }
.data-key {
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
}
.data-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
}
.badge.green  { background: var(--green-light);  color: var(--green); }
.badge.orange { background: var(--orange-light); color: var(--orange); }
.badge.red    { background: var(--red-light);    color: var(--red); }
.badge.amber  { background: var(--amber-light);  color: var(--amber); }
.badge.navy   { background: #EEF2F8;             color: var(--navy); }
.badge.muted  { background: #F0EFEB;             color: var(--muted); }

/* ── Energy label bar ─────────────────────────────────────── */
.energy-bar {
  display: flex;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  margin: 14px 0 8px;
  gap: 2px;
}
.energy-seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,.8);
}
.energy-seg.a4 { background: #1A7A4A; }
.energy-seg.a3 { background: #229E60; }
.energy-seg.a2 { background: #2DC274; }
.energy-seg.a1 { background: #5DD99A; color: rgba(0,0,0,.5); }
.energy-seg.b  { background: #95E0B8; color: rgba(0,0,0,.5); }
.energy-seg.c  { background: #E4D534; color: rgba(0,0,0,.6); }
.energy-seg.d  { background: #F0A500; }
.energy-seg.e  { background: #E07B25; }
.energy-seg.f  { background: #C95220; }
.energy-seg.g  { background: #A83226; }
.energy-seg.active { outline: 3px solid var(--navy); outline-offset: -2px; }

/* ── Congestion bar ───────────────────────────────────────── */
.congestion-bar {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #1A7A4A 0%, #95E030 30%, #F0A500 55%, #E07B25 75%, #A83226 100%);
  position: relative;
  margin: 14px 0 6px;
}
.congestion-needle {
  position: absolute;
  top: -5px;
  width: 3px;
  height: 20px;
  background: var(--navy);
  border-radius: 2px;
  transform: translateX(-50%);
}
.congestion-needle::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  background: var(--navy);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ── WOZ bar chart ────────────────────────────────────────── */
.woz-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 70px;
  margin: 14px 0 6px;
}
.woz-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.woz-bar {
  width: 100%;
  background: var(--navy);
  border-radius: 3px 3px 0 0;
  opacity: .7;
}
.woz-bar.current { opacity: 1; background: var(--amber); }
.woz-year   { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.woz-amount { font-family: var(--mono); font-size: 9px; font-weight: 500; }

/* ── Restriction items ────────────────────────────────────── */
.restriction-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.restriction-item:last-child { border-bottom: none; }
.restriction-icon {
  width: 20px; height: 20px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}
.restriction-text { font-size: 13px; line-height: 1.45; }
.restriction-name   { font-weight: 500; }
.restriction-detail { color: var(--muted); font-size: 12px; }

/* ── Claim / alert boxes ──────────────────────────────────── */
.claim-box {
  background: var(--amber-light);
  border: 1px solid #F0CC80;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 12px;
}
.claim-box strong { color: var(--amber); font-weight: 600; }
.alert-box {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 12px;
  border: 1px solid;
}
.alert-box.red   { background: var(--red-light);   border-color: #F5C6C2; color: var(--red); }
.alert-box.green { background: var(--green-light);  border-color: #B0DFC4; color: var(--green); }

/* ── Not available placeholder ────────────────────────────── */
.not-available {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
}
.not-available svg { flex-shrink: 0; opacity: .4; }

/* ── Report footer ────────────────────────────────────────── */
.report-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.footer-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .04em;
  line-height: 1.7;
}
.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  letter-spacing: .02em;
  transition: background .15s;
}
.btn-pdf:hover { background: var(--navy2); }
.btn-pdf svg   { width: 14px; height: 14px; }

/* ── Error state ──────────────────────────────────────────── */
.error-state {
  text-align: center;
  padding: 60px 20px;
}
.error-state h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  margin-bottom: 10px;
}
.error-state p { color: var(--muted); font-size: 14px; }
.btn-back {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 22px;
  background: var(--amber);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.btn-back:hover { background: #c07c12; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .search-bar { flex-direction: column; }
  .search-bar input  { border-radius: 6px 6px 0 0; }
  .search-bar button { border-radius: 0 0 6px 6px; width: 100%; justify-content: center; display: flex; }
  .section-grid        { grid-template-columns: 1fr; }
  .section-grid.thirds { grid-template-columns: 1fr; }
  .report-scores { flex-direction: column; gap: 12px; }
  .score-item    { border-right: none; border-bottom: 1px solid rgba(255,255,255,.1); padding: 8px 0; }
  .score-item:last-child { border-bottom: none; }
  .report-header { padding: 24px 20px 20px; }
  .report-address { font-size: 22px; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  body { background: #fff; font-size: 13px; }
  .hero, .no-print { display: none !important; }
  .report-wrapper { padding: 0; max-width: 100%; }
  .card { break-inside: avoid; box-shadow: none; }
  .report-header {
    background: var(--navy) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .energy-seg, .badge, .woz-bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .btn-pdf { display: none; }
  @page { margin: 16mm 14mm; }
}
