/* ════════════════════════════════════════════════════════════════
   STATISTIKEN – eigenständiges CSS (v31), berührt style.css nicht.
   Übernimmt Farb-/Font-Sprache aus style.css (Roboto, dunkles Theme,
   --sidebar-bg, --border, --shadow, --radius aus :root).
   ════════════════════════════════════════════════════════════════ */

/* ── BUTTON (unter den Filtern, Desktop + Mobile) ── */
.stats-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 2px;
}
.stats-btn:hover { background: rgba(255,255,255,0.28); }
.stats-btn:active { transform: scale(0.98); }

/* ── OVERLAY ── */
.stats-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6,9,16,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.stats-overlay.hidden { display: none; }

.stats-panel {
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
  background: rgb(17,22,38);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stats-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.stats-panel-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.stats-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 13px;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stats-close:hover { background: rgba(255,255,255,0.25); }

.stats-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.stats-panel-body::-webkit-scrollbar { width: 6px; }
.stats-panel-body::-webkit-scrollbar-track { background: transparent; }
.stats-panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }

.stats-loading, .stats-error {
  padding: 30px 12px;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius);
  line-height: 1.6;
}
.stats-error { color: #ffb3b3; border-color: rgba(255,120,120,0.35); }

.stats-progress {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 6px;
}

/* ── SECTIONS ── */
.stats-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stats-section-note {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: rgba(255,255,255,0.4);
}

/* Grid für die kompakten Karten (Nord/Süd/Distanz/Klima/Höhe) – kleinere
   Mindestbreite als zuvor, da die Karten jetzt schlanker sind. */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

/* ── KARTE (zeigt immer die Top 3 statt nur den Sieger) ── */
.stats-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.stats-card-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.5);
  padding: 0 2px;
}
.stats-card-note {
  font-size: 9px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: rgba(255,255,255,0.35);
}

/* ── GROSSE-ZAHL-KARTE (z.B. "12 Länder besucht") ── */
.stats-bignum {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  padding: 2px 2px 1px;
}

/* ── KOMPAKTE ZEILE (in Karten UND in den Top-10-Listen) ── */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stats-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.stats-row:hover { background: rgba(255,255,255,0.08); }
/* Statische Zeile (Land/Kontinent-Ranking) – kein Klickziel, daher kein Hover. */
.stats-row.static { cursor: default; }
.stats-row.static:hover { background: transparent; }
.stats-row-rank {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.stats-row-title {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  /* Zu lange Titel brechen um (statt seitlich abgeschnitten zu werden),
     aber maximal 2 Zeilen – danach "…". */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stats-row-value {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffd479;
  white-space: nowrap;
  padding-top: 1px;
}
.stats-row-value.neg { color: #7ec8ff; }

/* ── GEOGRAFISCHE EXTREME: erzwungenes 2×2-Raster ──
   Immer genau 2 Spalten (→ 2 Zeilen bei 4 Karten), damit die vollen
   Herz-Titel Platz haben statt per Ellipsis gekürzt zu werden. */
.stats-grid.stats-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats-grid-wide .stats-row-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
}
.stats-grid-wide .stats-row {
  align-items: flex-start;
}
.stats-grid-wide .stats-row-rank {
  margin-top: 1px;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .stats-overlay { padding: 0; align-items: flex-end; }
  .stats-panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  /* Auf Mobile: 1 Zelle pro Zeile, damit keine Karte über den
     Bildschirmrand hinausragt (die Zeilen brechen dort ohnehin um). */
  .stats-grid.stats-grid-wide { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
