/* Statistik-Tab (Session 37).
   Read-only Showroom. Vertikales Scroll-Layout, CSS-basierte Balken,
   keine Interaktionskomponenten. Nutzt --color-kug-blau und
   --color-sicht-* aus variables.css. */

.statistik {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-10);
  color: var(--color-text-primary);
}

.statistik__intro {
  border-bottom: 1px solid var(--border-color-light);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
}

.statistik__title {
  font-family: var(--font-title);
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  color: var(--color-kug-blau);
  margin: 0 0 var(--space-2);
}

.statistik__lead {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 68ch;
  margin: 0;
}

.statistik__sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  margin-top: var(--space-8);
}

/* --- Sektionen ----------------------------------------------------------- */

.stat-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stat-section__title {
  font-family: var(--font-title);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-kug-blau);
  display: inline-block;
  align-self: flex-start;
}

.stat-section__lead {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 72ch;
  margin: 0;
}

.stat-section--minor {
  opacity: 0.92;
}

.stat-subsection {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.stat-subsection__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-2);
}

/* --- Horizontale Balkenliste --------------------------------------------- */

.stat-bars {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-bars__row {
  display: grid;
  grid-template-columns: minmax(140px, 18ch) 1fr minmax(90px, auto);
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.stat-bars__label {
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-bars__track {
  background: var(--color-parchment);
  border-radius: 2px;
  height: 14px;
  overflow: hidden;
  position: relative;
}

.stat-bars__fill {
  background: var(--color-kug-blau);
  height: 100%;
  border-radius: 2px 0 0 2px;
  transition: width var(--transition-normal);
}

.stat-bars__count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-align: right;
  white-space: nowrap;
}

.stat-bars__label--link {
  color: var(--color-kug-blau);
  text-decoration: none;
  border-bottom: 1px dotted var(--color-kug-blau-light);
}

.stat-bars__label--link:hover {
  color: var(--color-kug-blau-dark);
  border-bottom-style: solid;
}

/* --- Charts (Donut, Histogramm, Legende) --------------------------------- */

.stat-chart {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.stat-chart--hist {
  display: block;
}

.stat-chart__svg-wrap {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.stat-chart svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.stat-donut__center-value {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: var(--weight-bold);
  fill: var(--color-text-primary);
}

.stat-donut__center-label {
  font-size: 11px;
  fill: var(--color-text-tertiary);
}

.stat-chart__legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  flex: 1;
}

.stat-chart__legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  padding: 2px 0;
}

.stat-chart__legend-swatch {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.stat-chart__legend-label {
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
  min-width: 0;
}

.stat-chart__legend-value {
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  font-size: 11px;
}

/* Histogramm-Achsen */
.stat-axis .domain { stroke: var(--border-color); }
.stat-axis line { stroke: var(--border-color-light); }
.stat-axis text {
  font-family: var(--font-ui);
  font-size: 10px;
  fill: var(--color-text-tertiary);
}

.stat-axis--y line {
  stroke: var(--border-color-light);
  stroke-dasharray: 2,3;
}

.stat-axis__title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  fill: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.stat-hist__bar {
  transition: opacity var(--transition-fast);
}

.stat-hist__bar:hover {
  opacity: 0.75;
}
