/* ============================================================================
 * leaderboard.css — tc-leaderboard
 * ----------------------------------------------------------------------------
 * SCHICHT 1 (geteilter Organismus). Wrapper um die fertige tc-lb-row + ein
 * Podium für die Top 3. Baut auf tc-lb-row (organisms.css) auf — diese Datei
 * liefert nur den Container, das Podium und die Listen-Sektionierung.
 *
 * THEME-GETRIEBEN. Medaillen-Farben (Gold/Silber/Bronze) sind DATEN und bleiben
 * hart (wie Grand-Alliance-Farben); alles andere kommt aus Tokens.
 *
 * Struktur:
 *   .tc-leaderboard                       Block
 *     .tc-leaderboard__podium             (optional) Top-3-Treppe
 *       .tc-leaderboard__podium-place     Einzelplatz (--first/--second/--third)
 *         __medal / __avatar / __name / __value
 *     .tc-leaderboard__list               Liste der tc-lb-row (Rang 4+)
 *     .tc-leaderboard__empty              (optional) Leerzustand
 *
 * Modifier:
 *   --no-podium    nur die Liste (kompakte Ranglisten ohne Treppe)
 * ============================================================================ */

.tc-leaderboard {
  display: flex;
  flex-direction: column;
  gap: var(--tc-space-4, 16px);
}

/* === PODIUM (Top 3) ======================================================= */
.tc-leaderboard__podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;   /* Sieger in der Mitte, etwas breiter */
  align-items: end;
  gap: var(--tc-space-3, 12px);
  padding: var(--tc-space-4, 16px) var(--tc-space-3, 12px) 0;
}

.tc-leaderboard__podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--tc-space-3, 12px) var(--tc-space-2, 8px);
  border-radius: var(--tc-radius-lg, 12px) var(--tc-radius-lg, 12px) 0 0;
  background: var(--tc-bg-surface-1);
  border: 1px solid var(--tc-border-subtle, rgba(255,255,255,0.06));
  border-bottom: none;
  position: relative;
  text-align: center;
}

/* Treppen-Höhe: Sieger am höchsten */
.tc-leaderboard__podium-place--first  { padding-top: var(--tc-space-5, 24px); order: 2; }
.tc-leaderboard__podium-place--second { order: 1; margin-top: var(--tc-space-4, 16px); }
.tc-leaderboard__podium-place--third  { order: 3; margin-top: var(--tc-space-5, 24px); }

/* Sieger bekommt einen Gold-Glanz (Auszeichnung, theme-getrieben für den Rahmen,
   Medaille bleibt Gold-Daten) */
.tc-leaderboard__podium-place--first {
  border-color: rgba(var(--tc-highlight-rgb), 0.45);
  box-shadow: 0 -2px 18px rgba(var(--tc-highlight-rgb), var(--tc-glow-intensity, 0.25));
  background: linear-gradient(180deg, rgba(var(--tc-highlight-rgb), 0.08), var(--tc-bg-surface-1) 60%);
}

/* Medaille (Daten-Farben, bleiben hart) */
.tc-leaderboard__medal {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tc-font-display, 'Cinzel', serif);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.tc-leaderboard__podium-place--first  .tc-leaderboard__medal { background: linear-gradient(135deg, #FFD700, #B8860B); color: #000; width: 48px; height: 48px; font-size: 1.3rem; }
.tc-leaderboard__podium-place--second .tc-leaderboard__medal { background: linear-gradient(135deg, #C0C0C0, #808080); color: #000; }
.tc-leaderboard__podium-place--third  .tc-leaderboard__medal { background: linear-gradient(135deg, #CD7F32, #8B4513); color: #fff; }

.tc-leaderboard__name {
  /* Der Name ist ein <a> auf das Spielerprofil (dashboard-teaser.js:1061)
     und mass 21px. Kein Block, damit die Ellipsis erhalten bleibt —
     inline-flex plus min-height loest beides (#235). */
  display: inline-flex;
  align-items: center;
  min-height: var(--tc-touch-min, 36px);
  font-weight: 600;
  color: var(--tc-text-strong);
  font-size: var(--tc-text-sm, 0.88rem);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-leaderboard__meta {
  font-size: var(--tc-text-xs, 0.72rem);
  color: var(--tc-text-muted);
}
.tc-leaderboard__value {
  font-family: var(--tc-font-display, 'Cinzel', serif);
  font-weight: 700;
  font-size: var(--tc-text-xl, 1.3rem);
  color: var(--tc-highlight);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tc-leaderboard__podium-place--first .tc-leaderboard__value {
  font-size: var(--tc-text-2xl, 1.6rem);
}

/* === LISTE (Rang 4+) ====================================================== */
.tc-leaderboard__list {
  display: flex;
  flex-direction: column;
}
/* Wenn ein Podium darüber steht, schließt die Liste bündig an */
.tc-leaderboard__podium + .tc-leaderboard__list {
  border-top: 1px solid var(--tc-border-subtle, rgba(255,255,255,0.06));
  padding-top: var(--tc-space-2, 8px);
}

/* === EMPTY ================================================================ */
.tc-leaderboard__empty {
  text-align: center;
  padding: var(--tc-space-6, 32px);
  color: var(--tc-text-muted);
  font-style: italic;
}

/* === MOBILE =============================================================== */
@media (max-width: 600px) {
  /* Podium auf Mobile: weniger Höhenversatz, kompakter */
  .tc-leaderboard__podium {
    gap: var(--tc-space-2, 8px);
    padding: var(--tc-space-3, 12px) 0 0;
  }
  .tc-leaderboard__podium-place--second,
  .tc-leaderboard__podium-place--third { margin-top: var(--tc-space-3, 12px); }
  .tc-leaderboard__podium-place--first { padding-top: var(--tc-space-4, 16px); }
  .tc-leaderboard__medal { width: 34px; height: 34px; font-size: 0.95rem; }
  .tc-leaderboard__podium-place--first .tc-leaderboard__medal { width: 40px; height: 40px; }
  .tc-leaderboard__value { font-size: var(--tc-text-lg, 1.1rem); }
  .tc-leaderboard__name { font-size: var(--tc-text-xs, 0.78rem); }
}

@media (prefers-reduced-motion: reduce) {
  .tc-leaderboard__podium-place--first { box-shadow: none; }
}
