/* ==========================================================================
   LLaDA-UI project page — charts.css
   Results section: domain tabs, bar-chart cards, radar card, tooltip,
   comparison tables (also used by the lazily-loaded partials).

   Bar identity follows the report's own convention: LLaDA-UI = indigo,
   other diffusion models = warm mask tint, autoregressive models = slate.
   Identity never rides on color alone: every bar is direct-labeled and the
   full tables sit below each chart group.
   ========================================================================== */

:root {
  --bar-ours: #2a4b8c;
  --bar-diff: #e8a48f;
  --bar-diff-edge: #cd7a5e;
  --bar-base: #64748b;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.sw-ours { background: var(--bar-ours); }
.sw-diff { background: var(--bar-diff); box-shadow: inset 0 0 0 1px var(--bar-diff-edge); }
.sw-base { background: var(--bar-base); }
.sw-bound {
  background: repeating-linear-gradient(45deg, rgba(100, 116, 139, 0.4) 0 3px, rgba(100, 116, 139, 0.14) 3px 6px);
  border: 1px dashed rgba(100, 116, 139, 0.7);
}

/* Domain tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 24px;
}
.tab-btn {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover { color: var(--indigo); border-color: var(--indigo-bright); }
.tab-btn[aria-selected="true"] {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}

.panel-note {
  color: var(--muted);
  font-size: 14.5px;
  max-width: 820px;
  margin: 0 0 18px;
}

/* Chart cards */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
}
.chart-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.chart-cat {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--indigo-bright);
}
.chart-metric {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: normal;
}
.chart-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 6px 0 26px;
}

.plot {
  position: relative;
  height: 210px;
  border-bottom: 1.5px solid var(--line);
}
.gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed #e4e8f4;
  pointer-events: none;
}
.gridline i {
  position: absolute;
  left: 0;
  top: -8px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 9.5px;
  color: #a7b1cc;
  background: var(--card);
  padding-right: 4px;
}

.bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 0 6px;
}
.bar-slot {
  flex: 1 1 0;
  min-width: 0;
  max-width: 74px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 8px 8px 0 0;
  cursor: default;
}
.bar-slot:hover, .bar-slot:focus-visible { background: rgba(62, 108, 196, 0.06); }

.bar {
  width: 60%;
  max-width: 36px;
  min-width: 18px;
  height: 0;
  border-radius: 5px 5px 0 0;
  position: relative;
  transition: height 0.7s cubic-bezier(0.22, 0.8, 0.34, 1);
}
.grown .bar { height: var(--h); }
.bar.ours { background: var(--bar-ours); }
.bar.diff { background: var(--bar-diff); box-shadow: inset 0 0 0 1px var(--bar-diff-edge); }
.bar.base { background: var(--bar-base); }
/* A value reported only as an upper bound (e.g. "<7.0") */
.bar.bound {
  background: repeating-linear-gradient(45deg, rgba(100, 116, 139, 0.4) 0 5px, rgba(100, 116, 139, 0.14) 5px 10px);
  border: 1px dashed rgba(100, 116, 139, 0.7);
  border-bottom: none;
}

.bar-val {
  position: absolute;
  top: -21px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease 0.4s;
}
.grown .bar-val { opacity: 1; }
.bar-slot.is-ours .bar-val { font-weight: 600; }

.chart-names {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px 0;
}
.name-slot {
  flex: 1 1 0;
  min-width: 0;
  max-width: 74px;
  text-align: center;
}
.bar-name {
  font-size: 10px;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
}
.name-slot.is-ours .bar-name { font-weight: 650; }
.bar-sub {
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
}
.name-slot.is-ours .bar-sub { color: var(--indigo); font-weight: 550; }
.chart-foot {
  margin: 12px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* Hover tooltip for bars */
.chart-tooltip {
  position: fixed;
  z-index: 90;
  max-width: 240px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 12px 28px -12px rgba(20, 29, 49, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.chart-tooltip.show { opacity: 1; transform: none; }
.chart-tooltip .tt-model { font-weight: 600; color: #fff; }
.chart-tooltip .tt-val {
  font-family: var(--font-mono);
  color: #a8c6f2;
}
.chart-tooltip .tt-note { color: #9db4d8; font-size: 11.5px; }

/* --------------------------------------------------------------------------
   Radar card (overview) — native SVG, mirrors the report's hero figure.
   -------------------------------------------------------------------------- */

.radar-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 860px) { .radar-grid { grid-template-columns: 1fr; } }

.radar-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.radar-card svg { width: 100%; max-width: 480px; height: auto; }
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.radar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.radar-legend i {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}
.radar-foot {
  font-size: 11.5px;
  color: var(--muted);
  margin: 10px 4px 4px;
  text-align: center;
}

.overview-points { display: flex; flex-direction: column; gap: 12px; }
.overview-points .trick { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* --------------------------------------------------------------------------
   Result tables
   -------------------------------------------------------------------------- */

.table-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  font-size: 14.5px;
}
thead th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
  padding: 13px 14px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
thead th:first-child { text-align: left; padding-left: 20px; }

tbody td {
  padding: 9.5px 14px;
  text-align: center;
  border-bottom: 1px solid #edf0f8;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
tbody td:first-child {
  text-align: left;
  padding-left: 20px;
  font-family: var(--font-body);
  font-size: 14.5px;
}
tbody tr:last-child td { border-bottom: none; }

td.group, th.group {
  background: var(--tint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--indigo);
  text-align: left;
  padding: 7px 20px;
}

/* The report's own convention: AR columns cool-tinted, diffusion warm-tinted */
td.ar-col, th.ar-col { background: #f4f8fe; }
td.diff-col, th.diff-col { background: #fdf6f2; }
td.ours-col, th.ours-col { background: #fbf1ec; box-shadow: inset 2px 0 0 rgba(224, 122, 95, 0.4); }
th.ours-col { color: #b0532f; }

tr.ours td {
  background: linear-gradient(90deg, rgba(62, 108, 196, 0.12), rgba(62, 108, 196, 0.03));
}
tr.ours td:first-child {
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--indigo);
}
tr.dim td { color: var(--muted); }
td .best { font-weight: 700; color: var(--indigo); }
td .second { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(42, 75, 140, 0.55); }

.table-foot {
  font-size: 12.5px;
  color: var(--muted);
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

/* Collapsible full tables */
.full-table { margin-top: 18px; }
.full-table > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--indigo-bright);
  padding: 8px 0;
  user-select: none;
}
.full-table > summary::-webkit-details-marker { display: none; }
.full-table > summary::before {
  content: "▸";
  font-size: 11px;
  transition: transform 0.15s ease;
}
.full-table[open] > summary::before { transform: rotate(90deg); }
.full-table > summary:hover { color: var(--indigo); }
.full-table .table-card { margin-top: 8px; }

/* Lazily-loaded table partial states */
.table-load-error {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 4px;
}
