/* redesign.css — CRT interface redesign, additive only.
   Everything here is scoped to new wrapper classes (.crt-progress*,
   .crt-summary*, .crt-gauge*, .crt-card-pro*, .crt-table-pro) added by
   index_v2.html. No existing selector from index.html's inline <style>
   block is overridden, so this file is safe to include alongside the
   original stylesheet.

   REVISION (2026-09-02): professional visual redesign —
   - Inter typeface, refined spacing/shadow/radius scale.
   - .crt-stepper / .crt-step (pill list of every section) REMOVED per
     explicit user request ("omit the list of sections at the top of the
     page") and replaced with a slim, single-line progress indicator
     (.crt-progress-pro) that shows only the CURRENT step, not the whole
     list.
   - New .crt-card-pro / .crt-card-header-pro / .crt-table-pro / .crt-score-pill
     classes for the consolidated Exposure and Vulnerability tables built
     in consolidated_tables_v2.js.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --crt-navy: #0f4c81;
  --crt-navy-2: #1d6fa5;
  --crt-ink: #101828;
  --crt-muted: #667085;
  --crt-border: #e4e9f0;
  --crt-bg-soft: #f6f8fb;
  --crt-veryhigh: #a40000;
  --crt-high: #d15a00;
  --crt-medium: #c7a600;
  --crt-low: #4aa838;
  --crt-verylow: #0b7a2a;
  --crt-radius-lg: 16px;
  --crt-radius-md: 12px;
  --crt-shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--crt-ink);
}

/* ---------- Top app header ---------- */
.crt-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.crt-app-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crt-app-title .crt-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--crt-navy) 0%, var(--crt-navy-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .02em;
  box-shadow: 0 6px 16px rgba(15,76,129,.28);
  flex: 0 0 auto;
}

.crt-app-title h4 {
  margin-bottom: 0;
  font-weight: 800;
  letter-spacing: -.01em;
}

.crt-app-title .crt-app-subtitle {
  font-size: .82rem;
  color: var(--crt-muted);
  font-weight: 500;
}

.crt-badge-pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--crt-bg-soft);
  border: 1px solid var(--crt-border);
  color: var(--crt-navy);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .02em;
}

.crt-badge-pro .crt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crt-verylow);
  display: inline-block;
}

/* ---------- Progress indicator (replaces the old .crt-stepper pill list) ----------
   Deliberately shows ONLY the current step + a fill bar, not a list of every
   section name — that list was removed per user request. */
.crt-progress-pro {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  padding: 14px 0 16px;
  margin-bottom: 6px;
}

.crt-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--crt-bg-soft);
  overflow: hidden;
}

.crt-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--crt-navy) 0%, var(--crt-navy-2) 100%);
  transition: width .3s ease;
  width: 20%;
}

.crt-progress-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  font-size: .92rem;
}

.crt-progress-label #crtProgressStepNum {
  font-weight: 800;
  color: var(--crt-navy);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.crt-progress-label #crtProgressStepName {
  font-weight: 700;
  color: var(--crt-ink);
}

/* ---------- Step panes ---------- */
.crt-pane { display: none; }
.crt-pane.active { display: block; animation: crt-fade-in .22s ease; }

@keyframes crt-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.crt-pane-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--crt-border);
}

.crt-pane-heading h5 {
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 2px;
}

.crt-pane-heading .crt-pane-desc {
  font-size: .85rem;
  color: var(--crt-muted);
}

.crt-pane-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--crt-border);
}

.crt-pane-nav .btn {
  font-weight: 600;
  padding: .55rem 1.2rem;
  border-radius: 10px;
}

.crt-pane-nav .btn-primary {
  background: linear-gradient(135deg, var(--crt-navy) 0%, var(--crt-navy-2) 100%);
  border: none;
  box-shadow: 0 6px 16px rgba(15,76,129,.25);
}

.crt-pane-nav .btn-primary:hover { filter: brightness(1.06); }

.crt-pane-nav .btn-outline-secondary {
  border-color: var(--crt-border);
  color: var(--crt-muted);
}

/* ---------- Sub-section divider (used inside the merged Risk pane) ---------- */
.crt-subsection-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .95rem;
  margin: 26px 0 12px;
  color: var(--crt-navy);
}

.crt-subsection-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--crt-navy) 0%, var(--crt-navy-2) 100%);
  display: inline-block;
}

.crt-subsection-title:first-child { margin-top: 4px; }

/* ---------- Layout: content + sticky summary sidebar ---------- */
.crt-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 992px) {
  .crt-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }

  .crt-summary-col {
    position: sticky;
    top: 78px;
  }
}

/* ---------- Sticky risk summary ---------- */
.crt-summary-card {
  border-radius: var(--crt-radius-lg);
  background: #fff;
  box-shadow: var(--crt-shadow-card);
  border: 1px solid var(--crt-border);
  padding: 18px;
}

.crt-summary-card h6 {
  font-weight: 800;
  margin-bottom: 12px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--crt-muted);
}

.crt-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--crt-border);
  font-size: .85rem;
}

.crt-mini-row:last-child { border-bottom: none; }

.crt-mini-score {
  font-weight: 700;
  min-width: 34px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff;
  font-size: .78rem;
}

/* ---------- Gauge ---------- */
.crt-gauge-wrap {
  position: relative;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
}

.crt-gauge-value {
  position: absolute;
  left: 0; right: 0; bottom: 10%;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
}

.crt-gauge-label {
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  text-align: center;
  font-size: .8rem;
  color: var(--crt-muted);
  font-weight: 600;
}

/* ---------- Hazard context tag ---------- */
.crt-hazard-tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- Simple 5-class risk meter (sidebar gauge) ---------- */
.crt-meter {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: visible;
  display: flex;
  margin: 10px 0 22px;
}

.crt-meter-seg {
  flex: 1 1 20%;
  height: 100%;
}
.crt-meter-seg:first-child { border-radius: 999px 0 0 999px; }
.crt-meter-seg:last-child { border-radius: 0 999px 999px 0; }

.crt-meter-pointer {
  position: absolute;
  top: -6px;
  width: 3px;
  height: 26px;
  background: #212529;
  border-radius: 2px;
  transform: translateX(-1.5px);
  transition: left .25s ease;
  left: 0%;
}

.crt-meter-pointer::after {
  content: "";
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #212529;
}

/* ---------- Professional card + table treatment for the consolidated
   Exposure / Vulnerability displays ---------- */
.crt-card-pro {
  border: 1px solid var(--crt-border);
  border-radius: var(--crt-radius-lg);
  box-shadow: var(--crt-shadow-card);
  overflow: hidden;
}

.crt-card-header-pro {
  background: linear-gradient(135deg, var(--crt-navy) 0%, var(--crt-navy-2) 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.crt-card-header-pro strong {
  font-weight: 700;
  letter-spacing: .01em;
}

.crt-card-header-pro .crt-card-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}

.crt-card-header-pro .crt-card-header-controls label {
  color: rgba(255,255,255,.85);
  margin-bottom: 0;
}

.crt-card-header-pro select {
  border: none;
}

.crt-table-pro {
  margin-bottom: 0;
}

.crt-table-pro thead th {
  background: var(--crt-bg-soft);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--crt-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--crt-border);
}

.crt-table-pro td, .crt-table-pro th {
  vertical-align: middle;
  padding: .65rem .75rem;
}

.crt-table-pro tbody tr:nth-child(even) { background: rgba(15,76,129,.02); }

.crt-score-pill {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
}

.crt-score-pill.crt-score-na {
  background: #eef1f4;
  color: var(--crt-muted);
  font-weight: 600;
  font-size: .72rem;
}

.crt-card-footer-pro {
  padding: 12px 18px;
  border-top: 1px solid var(--crt-border);
  background: var(--crt-bg-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 700;
}

/* ---------- Legacy per-hazard sub-cards, now data sinks only ----------
   river_exposure.js / raster_exposure.js / drought_exposure.js /
   soil_vulnerability.js / settlement_vulnerability.js still render into
   these elements (so those files needed zero changes to keep working);
   they are visually hidden now that consolidated_tables_v2.js owns the
   visible Exposure/Vulnerability tables. */
.crt-legacy-sink { display: none !important; }

/* ---------- Mobile bottom sheet for summary ---------- */
@media (max-width: 991.98px) {
  .crt-summary-col {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    max-height: 40vh;
    overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0,0,0,.15);
  }

  .crt-summary-card { border-radius: 16px 16px 0 0; }
}
