/* ============================================================
   Leaderboard — leaderboard.css
   Prefix: lb-
   ============================================================ */

.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 32px;
}

.lb-title {
  font-size: var(--font-3xl);
  font-weight: 700;
  margin: 0;
}

.lb-subtitle {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

.lb-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── KPI Row ─────────────────────────────────────────────────── */

.lb-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.lb-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.lb-kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.lb-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
}

/* ── Tier Distribution ───────────────────────────────────────── */

.lb-tiers-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.lb-tier-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  flex: 1;
  min-width: 0;
}

.lb-tier-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lb-tier-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.lb-tier-count {
  margin-left: auto;
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

/* ── Body Grid ───────────────────────────────────────────────── */

.lb-body-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .lb-body-grid {
    grid-template-columns: 1fr;
  }
  .lb-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Cards ────────────────────────────────────────────────────── */

.lb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.lb-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.lb-card-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── Table ────────────────────────────────────────────────────── */

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.lb-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lb-table tbody tr:hover {
  background: var(--bg-secondary);
}

.lb-table tbody tr.lb-row-me {
  background: rgba(99, 102, 241, 0.06);
}

.lb-table tbody tr.lb-row-me:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* Rank badges */
.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.lb-rank-1 {
  background: linear-gradient(135deg, #ffd700, #daa520);
  color: #333;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.lb-rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
  color: #333;
}

.lb-rank-3 {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: #fff;
}

.lb-rank-other {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.lb-user-name {
  font-weight: 600;
}

.lb-user-me {
  color: var(--accent);
}

.lb-points {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.lb-actions-count {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.lb-tier-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 10px;
  border-radius: 6px;
}

.lb-tier-tag.bronze   { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; }
.lb-tier-tag.silver   { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); color: #333; }
.lb-tier-tag.gold     { background: linear-gradient(135deg, #ffd700, #daa520); color: #333; box-shadow: 0 0 6px rgba(255,215,0,0.2); }
.lb-tier-tag.platinum { background: linear-gradient(135deg, #e5e4e2, #b0c4de, #e5e4e2); color: #333; box-shadow: 0 0 8px rgba(176,196,222,0.3); }

.lb-streak {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.lb-streak-fire {
  color: var(--warning, #f59e0b);
  font-weight: 600;
}

/* ── My Stats Sidebar ─────────────────────────────────────────── */

.lb-my-stats {
  padding: 20px;
}

.lb-my-rank-display {
  text-align: center;
  margin-bottom: 20px;
}

.lb-my-rank-num {
  font-size: 36px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  line-height: 1;
}

.lb-my-rank-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.lb-my-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lb-my-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.lb-my-stat-val {
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

.lb-my-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.lb-my-tier-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.lb-my-progress {
  margin-top: 14px;
}

.lb-my-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.lb-my-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.lb-my-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Point Values Reference ──────────────────────────────────── */

.lb-point-ref {
  padding: 16px 20px;
}

.lb-point-cat {
  margin-bottom: 12px;
}

.lb-point-cat:last-child {
  margin-bottom: 0;
}

.lb-point-cat-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.lb-point-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}

.lb-point-name {
  color: var(--text-secondary);
}

.lb-point-val {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 11px;
}

/* ── Loading ─────────────────────────────────────────────────── */

.lb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
