/* VICRISK Design System */
:root {
  --bg:         #0B1120;
  --surface:    #141D2F;
  --surface-2:  #1A2640;
  --border:     #1E2D45;
  --primary:    #4F9CF9;
  --accent:     #F97316;
  --danger:     #EF4444;
  --success:    #22C55E;
  --warning:    #FBBF24;
  --text:       #F1F5F9;
  --muted:      #64748B;
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,17,32,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  letter-spacing: 0.05em;
  text-decoration: none;
  margin-right: 2.5rem;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0;
  height: 100%;
}

.nav-links a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 1.1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.card-value {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.card-value.primary { color: var(--primary); }
.card-value.accent  { color: var(--accent); }
.card-value.success { color: var(--success); }
.card-value.danger  { color: var(--danger); }

/* ── KPI Cards ──────────────────────────────────────────── */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kpi-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.kpi-value {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}

.kpi-delta {
  font-size: 0.78rem;
  color: var(--success);
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.section-title span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.5rem;
}

/* ── Charts ─────────────────────────────────────────────── */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  position: relative;
}

.chart-placeholder {
  width: 100%;
  background: var(--surface-2);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted);
  font-size: 0.85rem;
  gap: 0.5rem;
}

.chart-placeholder svg { opacity: 0.4; }

/* Heatmap placeholder */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  width: 100%;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform 0.1s;
  cursor: default;
}

.heat-cell:hover { transform: scale(1.15); z-index: 1; position: relative; }

/* Risk colour scale */
.risk-low    { background: var(--success); opacity: 0.3; }
.risk-med    { background: var(--warning); opacity: 0.5; }
.risk-high   { background: var(--accent);  opacity: 0.7; }
.risk-vhigh  { background: var(--danger);  opacity: 0.9; }

/* Bar chart placeholder */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-top: 1rem;
}

.bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--primary);
  opacity: 0.7;
  transition: opacity 0.15s;
}
.bar:hover { opacity: 1; }
.bar-label { font-size: 0.65rem; color: var(--muted); text-align: center; }
.bar-val   { font-family: var(--mono); font-size: 0.65rem; color: var(--text); }

/* Feature importance bars */
.feat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.feat-label { width: 130px; font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.feat-bar-wrap { flex: 1; height: 22px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.feat-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.8s ease; }
.feat-val  { width: 38px; font-family: var(--mono); font-size: 0.78rem; text-align: right; flex-shrink: 0; }

/* ── Pill / Tag ──────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tag-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.tag-warning  { background: rgba(251,191,36,0.15); color: var(--warning); }
.tag-success  { background: rgba(34,197,94,0.15); color: var(--success); }
.tag-accent   { background: rgba(249,115,22,0.15);color: var(--accent); }
.tag-primary  { background: rgba(79,156,249,0.15);color: var(--primary); }

/* ── Table ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(30,45,69,0.5);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(30,45,69,0.3); }

/* ── Pillars (Rashidi) ──────────────────────────────────── */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.pillar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.pillar-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.pillar-name {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.pillar-score {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.pillar-bar-wrap {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.pillar-bar { height: 100%; border-radius: 3px; }

.pillar-status {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Explorer ───────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input, .filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-input { flex: 1; min-width: 200px; }
.search-input:focus, .filter-select:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--muted); }

.filter-select option { background: var(--surface); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost   { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* Map placeholder */
.map-placeholder {
  width: 100%;
  height: 420px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  margin-top: 4rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .pillars-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .container { padding: 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pillars-grid { grid-template-columns: 1fr 1fr; }
  .nav { padding: 0 1rem; }
  .nav-links a { padding: 0 0.6rem; font-size: 0.8rem; }
}
