/* Metrics dashboard — built on top of styles.css, palette harmonised with the site. */

:root {
  --skill: #4ADE80;
  --skill-dim: rgba(74, 222, 128, 0.14);
  --agent: #F472B6;
  --agent-dim: rgba(244, 114, 182, 0.14);
  --accent-dim: rgba(91, 141, 239, 0.14);
  --amber: #F5A623;
  --radius: 12px;
  --radius-sm: 8px;
}

/* Brand as a link should not look like a link */
.brand { cursor: pointer; }
.nav-actions a.active { color: var(--text); font-weight: 500; }

/* Hero with the period selector on the right */
.metrics-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.period-selector {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.period-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.period-btn.active { background: var(--accent); color: #fff; }
.period-btn:hover:not(.active) { color: var(--text); background: var(--surface-2); }

/* Dashboard layout */
.dashboard { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.kpi-card:nth-child(1)::before { background: var(--skill); }
.kpi-card:nth-child(2)::before { background: var(--agent); }
.kpi-card:nth-child(3)::before { background: var(--accent); }
.kpi-card:nth-child(4)::before { background: var(--amber); }

.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.kpi-card:nth-child(1) .kpi-value { color: var(--skill); }
.kpi-card:nth-child(2) .kpi-value { color: var(--agent); }
.kpi-card:nth-child(3) .kpi-value { color: var(--accent); }
.kpi-card:nth-child(4) .kpi-value { color: var(--amber); }

.kpi-trend { font-size: 12.5px; color: var(--text-2); min-height: 16px; }
.kpi-trend.up { color: var(--skill); }
.kpi-trend.muted { color: var(--text-3); }

/* GitHub activity row — its own accent set so it reads as a distinct group */
.kpi-row.github .kpi-card:nth-child(1)::before { background: #8B5BEF; }
.kpi-row.github .kpi-card:nth-child(2)::before { background: #06B6D4; }
.kpi-row.github .kpi-card:nth-child(3)::before { background: var(--amber); }
.kpi-row.github .kpi-card:nth-child(4)::before { background: var(--accent); }
.kpi-row.github .kpi-card:nth-child(1) .kpi-value { color: #8B5BEF; }
.kpi-row.github .kpi-card:nth-child(2) .kpi-value { color: #06B6D4; }
.kpi-row.github .kpi-card:nth-child(3) .kpi-value { color: var(--amber); }
.kpi-row.github .kpi-card:nth-child(4) .kpi-value { color: var(--accent); }

/* Chart cards */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.2s;
}

.chart-card:hover { border-color: var(--border-strong); }
.chart-card.full-width { grid-column: 1 / -1; }

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-title { font-size: 15px; font-weight: 500; color: var(--text); }
.chart-subtitle { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.chart-legend { display: flex; gap: 14px; flex-shrink: 0; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

.chart-container { position: relative; width: 100%; height: 260px; }

/* Contributors table */
.contributors-table { width: 100%; border-collapse: collapse; }

.contributors-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border);
}

.contributors-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.contributors-table tr:last-child td { border-bottom: none; }
.contributors-table tr:hover td { background: var(--surface-2); }

.contributor-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
}

.contributor-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; }

.bar-cell { display: flex; align-items: center; gap: 10px; }

.bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }

.bar-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  min-width: 36px;
  text-align: right;
}

.contributors-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-3);
  font-size: 13.5px;
}

.hidden { display: none; }

/* Entry animations (mirrors the reference dashboard) */
.kpi-card, .chart-card {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.45s ease forwards;
}
.kpi-card:nth-child(1) { animation-delay: 0.04s; }
.kpi-card:nth-child(2) { animation-delay: 0.08s; }
.kpi-card:nth-child(3) { animation-delay: 0.12s; }
.kpi-card:nth-child(4) { animation-delay: 0.16s; }
.charts-row:nth-of-type(3) .chart-card { animation-delay: 0.22s; }
.charts-row:nth-of-type(4) .chart-card { animation-delay: 0.28s; }

@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .metrics-hero { align-items: flex-start; }
  .period-selector { width: 100%; }
  .period-btn { flex: 1; }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
}
