/**
 * leaderboard.css - Styles for the Leaderboard page
 * Extracted from inline styles for consistency with design system
 * Enhanced with glass morphism v2 design
 */

/* ===== GLASS MORPHISM V2 BACKGROUND ===== */
.page-leaderboard-v2 .lb-bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.page-leaderboard-v2 .lb-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: lbOrbFloat 20s ease-in-out infinite;
}

.page-leaderboard-v2 .lb-orb--cyan {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.4) 0%, transparent 70%);
  top: -10%;
  left: -5%;
  animation-delay: 0s;
}

.page-leaderboard-v2 .lb-orb--purple {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.35) 0%, transparent 70%);
  top: 30%;
  right: -10%;
  animation-delay: -5s;
}

.page-leaderboard-v2 .lb-orb--teal {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.4) 0%, transparent 70%);
  bottom: 10%;
  left: 20%;
  animation-delay: -10s;
}

.page-leaderboard-v2 .lb-orb--gold {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  top: 60%;
  right: 30%;
  animation-delay: -15s;
}

@keyframes lbOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(10px, 30px) scale(1.02); }
}

.page-leaderboard-v2 .lb-grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.5;
}

/* Hide legacy background when v2 is active */
.page-leaderboard-v2 .animated-bg {
  display: none;
}

/* Main content positioning */
.page-leaderboard-v2 main {
  position: relative;
  z-index: 10;
}

/* ===== HERO SECTION ===== */
.leaderboard-hero {
  position: relative;
  padding: 4rem 1rem 5rem;
  text-align: center;
  margin-bottom: 2rem;
}

.hero-stat-card {
  position: absolute;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: var(--radius-lg, 1rem);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 140px;
  animation: cardFloat 6s ease-in-out infinite;
  z-index: 3;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(20, 184, 166, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hero-stat-card:hover {
  transform: scale(1.05);
  border-color: rgba(20, 184, 166, 0.4);
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(20, 184, 166, 0.2);
}

.hero-stat-card.top-left {
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.hero-stat-card.top-right {
  top: 10%;
  right: 5%;
  animation-delay: -1.5s;
}

.hero-stat-card.bottom-left {
  bottom: 15%;
  left: 5%;
  animation-delay: -4.5s;
}

.hero-stat-card.bottom-right {
  bottom: 15%;
  right: 5%;
  animation-delay: -3s;
}

.hero-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #71717a);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat-icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: var(--teal, #14b8a6);
  filter: drop-shadow(0 0 8px rgba(20, 184, 166, 0.5));
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.hero-stat-card:hover .stat-icon {
  transform: scale(1.1);
}

.stat-emoji {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.hero-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal, #14b8a6) 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Trophy */
.trophy-container {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.trophy-icon {
  font-size: 4rem;
  display: block;
  animation: trophyBounce 3s ease-in-out infinite;
}

.trophy-icon-svg {
  width: 6rem;
  height: 6rem;
  stroke: var(--teal, #14b8a6);
  stroke-width: 1.2;
  fill: rgba(20, 184, 166, 0.15);
  filter: drop-shadow(0 0 25px rgba(20, 184, 166, 0.6)) drop-shadow(0 0 50px rgba(20, 184, 166, 0.3));
  display: block;
  animation: trophyBounce 3s ease-in-out infinite, trophyGlow 2s ease-in-out infinite;
}

@keyframes trophyGlow {
  0%, 100% { filter: drop-shadow(0 0 25px rgba(20, 184, 166, 0.6)) drop-shadow(0 0 50px rgba(20, 184, 166, 0.3)); }
  50% { filter: drop-shadow(0 0 35px rgba(20, 184, 166, 0.8)) drop-shadow(0 0 70px rgba(20, 184, 166, 0.5)); }
}

.trophy-glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.5) 0%, rgba(20, 184, 166, 0.2) 40%, transparent 70%);
  filter: blur(25px);
  animation: glowPulse 2s ease-in-out infinite;
  z-index: -1;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.1;
}

.hero-title .highlight {
  background: linear-gradient(135deg, var(--teal, #14b8a6) 0%, #0ea5e9 50%, #818cf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.leaderboard-kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--teal, #14b8a6);
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 999px;
}

.hero-subtitle {
  color: var(--muted, #71717a);
  font-size: 1.1rem;
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* ===== YOUR RANK CARD ===== */
.your-rank-card {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.15) 0%, rgba(45, 212, 191, 0.05) 100%);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--radius-lg, 1rem);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  height: 100%;
  margin: 0;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.your-rank-card:hover {
  border-color: rgba(45, 212, 191, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 15px 35px -10px rgba(45, 212, 191, 0.2);
}

.your-rank-card.not-ranked {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

.your-rank-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.your-rank-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: #000;
  flex-shrink: 0;
}

.your-rank-details h3 {
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.your-rank-details .rank-number {
  color: var(--teal);
  font-weight: 700;
}

.your-rank-details .meta {
  font-size: 0.85rem;
}

.your-rank-score {
  text-align: right;
}

.your-rank-score .score-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.your-rank-score .score-label {
  font-size: 0.75rem;
  color: var(--muted, #71717a);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== CATEGORY TABS ===== */
.category-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  padding: 0 1rem;
}

.tab-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted, #71717a);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
}

.tab-btn.active {
  background: var(--teal);
  color: #000;
  font-weight: 600;
}

.tab-btn svg {
  width: 16px;
  height: 16px;
  margin-right: 0.4rem;
  vertical-align: -2px;
}

/* ===== PODIUM HUB ===== */
.podium-hub {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .podium-hub {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ===== STATS LIST CARDS (Side Lists) ===== */
.stats-list-card {
  background: rgba(255, 255, 255, 0.02);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg, 1rem);
  padding: 1.25rem;
  height: fit-content;
}

.stats-list-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text, #fff);
}

.stats-list-title svg {
  width: 18px;
  height: 18px;
  color: var(--teal);
  flex-shrink: 0;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius, 0.5rem);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s ease;
}

.stats-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.stats-list-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  min-width: 1.5rem;
  text-align: center;
}

.stats-list-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.stats-list-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-list-meta {
  font-size: 0.7rem;
  color: var(--muted, #71717a);
}

/* ===== PODIUM ===== */
#podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  padding: 0 0.5rem;
  align-items: end;
}

.podium-card {
  position: relative;
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: var(--radius-lg, 1rem);
  transition: transform 0.3s ease;
}

.podium-card:hover {
  transform: translateY(-4px);
}

.podium-card.gold {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  order: 2;
  padding-bottom: 2rem;
  animation: podiumFloat 4s ease-in-out infinite;
}

.podium-card.silver {
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.12) 0%, rgba(192, 192, 192, 0.04) 100%);
  border: 1px solid rgba(192, 192, 192, 0.25);
  order: 1;
}

.podium-card.bronze {
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.12) 0%, rgba(205, 127, 50, 0.04) 100%);
  border: 1px solid rgba(205, 127, 50, 0.25);
  order: 3;
}

.podium-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  overflow: hidden;
  border: 3px solid;
  position: relative;
}

.podium-card.gold .podium-avatar {
  border-color: #FFD700;
  width: 72px;
  height: 72px;
}

.podium-card.silver .podium-avatar {
  border-color: #C0C0C0;
}

.podium-card.bronze .podium-avatar {
  border-color: #CD7F32;
}

.podium-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.podium-card.gold .avatar-placeholder {
  font-size: 1.5rem;
}

.podium-medal {
  position: absolute;
  bottom: -6px;
  right: -6px;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.podium-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-card.gold .podium-name {
  font-size: 1rem;
}

.podium-score {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.podium-card.gold .podium-score {
  color: #FFD700;
  font-size: 1rem;
}

.podium-card.silver .podium-score {
  color: #C0C0C0;
}

.podium-card.bronze .podium-score {
  color: #CD7F32;
}

.podium-rank {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.podium-card.gold .podium-rank {
  background: #FFD700;
  color: #000;
}

.podium-card.silver .podium-rank {
  background: #C0C0C0;
  color: #000;
}

.podium-card.bronze .podium-rank {
  background: #CD7F32;
  color: #000;
}

/* ===== LEADERBOARD LIST ===== */
.leaderboard-card {
  background: rgba(255, 255, 255, 0.02);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.leaderboard-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.leaderboard-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.leaderboard-header h2 svg {
  width: 20px;
  height: 20px;
  color: var(--teal);
  filter: drop-shadow(0 0 5px rgba(45, 212, 191, 0.4));
}

.ranking-row {
  display: flex;
  align-items: center;
  padding: 1.25rem 2rem;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
}

.ranking-row:last-child {
  border-bottom: none;
}

.ranking-row:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(8px);
}

.ranking-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--teal);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ranking-row:hover::before {
  opacity: 1;
}

.ranking-row.is-you {
  background: rgba(45, 212, 191, 0.08);
}

.rank-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted, #71717a);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.ranking-row:hover .rank-badge {
  background: var(--teal);
  color: #000;
  transform: scale(1.1);
}

.ranking-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.ranking-row:hover .ranking-avatar {
  border-color: var(--teal);
  box-shadow: 0 0 15px rgba(45, 212, 191, 0.3);
}

.ranking-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-avatar .avatar-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

.ranking-info {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.ranking-stats {
  font-size: 0.85rem;
  color: var(--muted, #71717a);
  display: flex;
  gap: 1rem;
}

.ranking-stats span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ranking-stats svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.ranking-score {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ranking-score::after {
  content: 'POINTS';
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  opacity: 0.5;
  margin-top: -2px;
}

.follow-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 999px;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text, #fff);
  cursor: pointer;
  transition: all 0.2s ease;
}

.follow-btn:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #000;
}

/* ===== ANIMATIONS ===== */
@keyframes cardFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(1deg);
  }
}

@keyframes trophyBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

@keyframes podiumFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero-stat-card {
    display: none;
  }

  .ranking-row {
    padding: 1rem 1.25rem;
  }

  .leaderboard-header {
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 480px) {
  #podium {
    gap: 0.5rem;
  }

  .podium-card {
    padding: 0.75rem 0.25rem;
  }

  .podium-avatar {
    width: 48px;
    height: 48px;
  }

  .podium-card.gold .podium-avatar {
    width: 60px;
    height: 60px;
  }
}

/* ===== LIGHT MODE ===== */
body.light-mode .hero-stat-card {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-color: rgba(20, 184, 166, 0.25);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 0 20px rgba(20, 184, 166, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

body.light-mode .hero-stat-label {
  color: #4a5568;
}

body.light-mode .leaderboard-kicker {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.3);
}

body.light-mode .hero-subtitle {
  color: #64748b;
}

body.light-mode .beta-notice {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .beta-text {
  color: #4a5568;
}

body.light-mode .leaderboard-card {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .ranking-row {
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .ranking-row:hover {
  background: rgba(20, 184, 166, 0.05);
}

body.light-mode .stats-list-card {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .stats-list-item {
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .stats-list-name {
  color: #1a202c;
}

body.light-mode .your-rank-card {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.15) 0%, rgba(255, 255, 255, 0.9) 100%);
}

body.light-mode .your-rank-card.not-ranked {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-color: rgba(0, 0, 0, 0.1);
}
