/* DZIF-MDR statistics page */

#mdr-statistics {
  width: 100%;
}

.stats-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.stats-intro {
  max-width: 70ch;
  font-size: 0.88rem;
}

.stats-intro code {
  font-size: 0.85em;
  color: #495057;
}

.stats-loading {
  padding: 3rem 0;
  color: #6c757d;
}

.stats-loading span {
  margin-left: 0.6rem;
}

/* ---------------------------------------------------------------- tiles */

.stats-tiles {
  margin-bottom: 1.5rem;
  row-gap: 0.75rem;
}

.stats-tile {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  height: 100%;
  background: #fff;
}

.stats-tile-primary {
  border-color: #0b7285;
  background: #f2fafc;
}

.stats-tile-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: #14505c;
}

.stats-tile-label {
  display: block;
  font-size: 0.82rem;
  color: #6c757d;
  margin-top: 0.15rem;
}

/* Einzeiler unter der Kachelbeschriftung. Bewusst knapp;
   ausfuehrlich erklaert das Glossar darunter. */
.stats-tile-hint {
  display: block;
  font-size: 0.75rem;
  line-height: 1.25;
  color: #8a9199;
  margin-top: 0.2rem;
}

/* --------------------------------------------------- Kernzahlen oben ---- */
/* Datensaetze und Datenelemente stehen in einer eigenen Reihe und deutlich
   groesser: sie beantworten die beiden Fragen, die zuerst gestellt werden. */

.stats-tiles-lead {
  margin-bottom: 0.75rem;
}

.stats-tiles-lead .stats-tile {
  padding: 1.2rem 1.4rem;
}

.stats-tiles-lead .stats-tile-value {
  font-size: 2.8rem;
}

.stats-tiles-lead .stats-tile-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #14505c;
  margin-top: 0.3rem;
}

.stats-tiles-lead .stats-tile-hint {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* In der schmalen Spalte der Landingpage etwas zurueckhaltender, damit die
   Zahlen nicht ueber die Kachelbreite hinauslaufen. */
.stats-compact .stats-tiles-lead .stats-tile-value {
  font-size: 2.1rem;
}

.stats-compact .stats-tiles-lead .stats-tile-label {
  font-size: 1rem;
}

/* ------------------------------------------------------------- Glossar */

.stats-glossary {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: #fbfcfd;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.stats-glossary > summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
  color: #14505c;
  list-style-position: inside;
}

.stats-glossary > summary:hover {
  background: #f2fafc;
}

.stats-glossary[open] > summary {
  border-bottom: 1px solid #dee2e6;
}

.stats-glossary dl {
  margin: 0;
  padding: 0.9rem 1rem 0.3rem;
}

.stats-glossary dt {
  font-weight: 700;
  color: #14505c;
  margin-top: 0.9rem;
}

.stats-glossary dt:first-child {
  margin-top: 0;
}

.stats-glossary dd {
  margin: 0.2rem 0 0;
  color: #495057;
  line-height: 1.5;
}

.stats-glossary .stats-example {
  display: block;
  margin-top: 0.35rem;
  padding-left: 0.7rem;
  border-left: 3px solid #b7d7de;
  color: #6c757d;
}

.stats-glossary code {
  font-size: 0.85em;
  color: #0b7285;
  background: #eef7f9;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
}

.stats-glossary-note {
  margin: 0;
  padding: 0.6rem 1rem 0.9rem;
  color: #6c757d;
  font-style: italic;
}

/* ---------------------------------------------------------------- cards */

.stats-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1.25rem 1.4rem 1.5rem;
  background: #fff;
  margin-bottom: 1.5rem;
  height: calc(100% - 1.5rem);
}

.stats-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.stats-note {
  font-size: 0.82rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

.stats-empty {
  color: #6c757d;
  font-size: 0.9rem;
  background: #f8f9fa;
  border-radius: 4px;
  padding: 1.5rem;
  margin: 0;
}

.stats-generated {
  font-size: 0.78rem;
  margin-top: -0.5rem;
}

/* --------------------------------------------------------------- charts */

.stats-sunburst-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.stats-sunburst-wrap .stats-chart {
  flex: 0 0 340px;
  max-width: 100%;
}

.stats-legend {
  flex: 1 1 320px;
  min-width: 260px;
  font-size: 0.85rem;
}

.stats-legend-group {
  margin-bottom: 1rem;
  break-inside: avoid;
}

.stats-legend-group h3 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #14505c;
}

.stats-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats-legend li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.1rem 0;
}

.stats-legend .swatch {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
}

.stats-legend .legend-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-legend .legend-value {
  flex: 0 0 auto;
  color: #6c757d;
  font-variant-numeric: tabular-nums;
}

.sb-slice {
  stroke: #fff;
  stroke-width: 1;
  transition: opacity 0.12s ease;
}

.sb-slice:hover {
  opacity: 0.78;
}

.sb-cat-label {
  font-size: 13px;
  font-weight: 700;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.25);
  stroke-width: 2px;
}

.bar-rect {
  fill: #2a9d8f;
}

.bar-rect:hover {
  opacity: 0.8;
}

.bar-label {
  font-size: 12px;
  fill: #343a40;
}

.bar-value {
  font-size: 12px;
  fill: #6c757d;
  font-variant-numeric: tabular-nums;
}

.donut-center {
  font-size: 22px;
  font-weight: 700;
  fill: #14505c;
}

.donut-center-sub {
  font-size: 11px;
  fill: #6c757d;
}

.axis {
  stroke: #adb5bd;
  stroke-width: 1;
}

.grid {
  stroke: #e9ecef;
  stroke-width: 1;
}

.tick {
  font-size: 10px;
  fill: #6c757d;
  font-variant-numeric: tabular-nums;
}

.line {
  fill: none;
  stroke: #1f77b4;
  stroke-width: 2.5;
}

.dot {
  fill: #1f77b4;
}

@media (max-width: 768px) {
  .stats-sunburst-wrap .stats-chart {
    flex: 1 1 100%;
  }
}

.line-old {
  stroke: #adb5bd;
  stroke-dasharray: 5 3;
}

.dot-old {
  fill: #adb5bd;
}

/* ------------------------------------------------ Landingpage (schmaler) */

/* In der rechten Landingpage-Spalte steht weniger Breite zur Verfuegung als
   auf der Vollseite: kleinere Kacheln, kompakteres Kreisdiagramm. */

.stats-compact .stats-tiles {
  margin-bottom: 1rem;
}

/* Detailreihe: drei Kacheln nebeneinander, auch in der schmalen Spalte. */
.stats-compact .stats-tiles > [class^="col"] {
  flex: 1 1 30%;
  max-width: none;
}

/* Kernzahlen: zwei nebeneinander, nicht drei - sonst wuerde die obige Regel
   auch hier 30 % erzwingen und die grossen Zahlen umbrechen. */
.stats-compact .stats-tiles-lead > [class^="col"] {
  flex: 1 1 45%;
  max-width: none;
}

.stats-compact .stats-tile {
  padding: 0.6rem 0.7rem;
}

.stats-compact .stats-tile-value {
  font-size: 1.35rem;
}

.stats-compact .stats-tile-label {
  font-size: 0.75rem;
}

.stats-compact .stats-card {
  padding: 1rem 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.stats-compact .stats-sunburst-wrap .stats-chart {
  flex: 0 0 280px;
}

.stats-compact .stats-legend {
  flex: 1 1 240px;
  min-width: 220px;
  font-size: 0.8rem;
}

/* Die Landingpage-Spalte ist flex-column: verhindert, dass die Zeilen
   auseinandergezogen werden. */
#landing-end-slot #mdr-statistics {
  flex: 0 0 auto;
}
