/* ============================================
   Leaderboard Component
   ============================================ */

/* ---- Podium (Top 3) ---- */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4) var(--space-4);
}

.podium__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 140px;
}

.podium__avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  color: #fff;
  margin-bottom: var(--space-2);
  position: relative;
}

.podium__item:nth-child(1) .podium__avatar {
  background: linear-gradient(135deg, #FFB800, #FFD060);
  width: 60px;
  height: 60px;
  font-size: var(--text-lg);
}

.podium__item:nth-child(2) .podium__avatar {
  background: linear-gradient(135deg, #94A3B8, #CBD5E1);
}

.podium__item:nth-child(3) .podium__avatar {
  background: linear-gradient(135deg, #CD7F32, #DFA055);
}

.podium__medal {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
}

.podium__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium__score {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
}

.podium__bar {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-top: var(--space-3);
}

.podium__item:nth-child(1) .podium__bar {
  height: 80px;
  background: linear-gradient(180deg, rgba(255, 184, 0, 0.2) 0%, rgba(255, 184, 0, 0.05) 100%);
  border: 1px solid rgba(255, 184, 0, 0.3);
  border-bottom: none;
}

.podium__item:nth-child(2) .podium__bar {
  height: 56px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.2) 0%, rgba(148, 163, 184, 0.05) 100%);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-bottom: none;
}

.podium__item:nth-child(3) .podium__bar {
  height: 40px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.05) 100%);
  border: 1px solid rgba(205, 127, 50, 0.3);
  border-bottom: none;
}

/* ---- Leaderboard Table ---- */
.leaderboard {
  display: flex;
  flex-direction: column;
}

.leaderboard__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.leaderboard__row:hover {
  background: var(--bg-card-hover);
}

/* Highlight current player */
.leaderboard__row--current {
  background: rgba(var(--color-primary-rgb), 0.08);
  border-color: rgba(var(--color-primary-rgb), 0.2);
}

.leaderboard__rank {
  width: 32px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.leaderboard__row:nth-child(1) .leaderboard__rank { color: var(--color-gold); }
.leaderboard__row:nth-child(2) .leaderboard__rank { color: #94A3B8; }
.leaderboard__row:nth-child(3) .leaderboard__rank { color: #CD7F32; }

.leaderboard__player {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.leaderboard__player-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

.leaderboard__player-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard__score {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  flex-shrink: 0;
}

.leaderboard__date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
  width: 80px;
  text-align: right;
}

@media (max-width: 768px) {
  .leaderboard__date {
    display: none;
  }
}

/* ---- Leaderboard Header ---- */
.leaderboard__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard__header span:first-child {
  width: 32px;
  text-align: center;
}

.leaderboard__header span:nth-child(2) {
  flex: 1;
}

.leaderboard__header span:nth-child(3) {
  flex-shrink: 0;
}
