/* Ranking Page Styles - Modern Dark Theme */

.ranking-page {
  min-height: calc(100vh - 64px);
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

/* ========== Hero Section ========== */
.ranking-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  padding: 4rem 1rem 3rem;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.ranking-hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(247, 147, 26, 0.2) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse-hero 4s ease-in-out infinite;
}

@keyframes pulse-hero {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ranking-hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

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

.trophy-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(247, 147, 26, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: trophy-pulse 2s ease-in-out infinite;
}

@keyframes trophy-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.trophy-emoji {
  font-size: 4rem;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 20px rgba(247, 147, 26, 0.5));
  animation: trophy-float 3s ease-in-out infinite;
}

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

.ranking-title {
  font-size: 3rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.ranking-subtitle {
  font-size: 1.15rem;
  color: #94a3b8;
  margin: 0 0 2.5rem;
  font-weight: 400;
}

/* Global Stats */
.ranking-global-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.global-stat {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  min-width: 160px;
  transition: all 0.3s ease;
}

.global-stat:hover {
  border-color: rgba(247, 147, 26, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(247, 147, 26, 0.15);
}

.global-stat-number {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: #f7931a;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.global-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== Container ========== */
.ranking-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

/* ========== Podium Section ========== */
.ranking-podium {
  margin-bottom: 4rem;
}

.podium-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin: 0 0 2.5rem;
  position: relative;
  display: inline-block;
  width: 100%;
}

.podium-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #f7931a, #ffab40);
  border-radius: 2px;
}

.podium-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
  padding: 0 1rem;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.podium-rank {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  z-index: 10;
}

.podium-first .podium-rank {
  border-color: #ffd700;
  background: linear-gradient(135deg, #ffd700 0%, #ffab00 100%);
  color: #0f172a;
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

.podium-second .podium-rank {
  border-color: #c0c0c0;
  background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 100%);
  color: #0f172a;
}

.podium-third .podium-rank {
  border-color: #cd7f32;
  background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
  color: #0f172a;
}

.podium-card {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s ease;
  width: 180px;
  display: block;
}

.podium-first .podium-card {
  width: 200px;
  padding: 2.5rem 1.5rem;
  border-color: rgba(255, 215, 0, 0.3);
  background: rgba(15, 23, 42, 0.8);
}

.podium-card:hover {
  transform: translateY(-8px);
  border-color: rgba(247, 147, 26, 0.4);
  box-shadow: 0 16px 40px rgba(247, 147, 26, 0.2);
}

.podium-avatar {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.podium-avatar.champion::before {
  content: '';
  position: absolute;
  inset: -6px;
  background: linear-gradient(135deg, #ffd700 0%, #ffab40 50%, #ffd700 100%);
  border-radius: 50%;
  animation: champion-glow 2s ease-in-out infinite;
}

@keyframes champion-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.podium-avatar-img,
.podium-avatar-placeholder {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.podium-first .podium-avatar-img,
.podium-first .podium-avatar-placeholder {
  width: 100px;
  height: 100px;
  border-color: rgba(255, 215, 0, 0.4);
}

.podium-avatar-img {
  object-fit: cover;
}

.podium-avatar-placeholder {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #f7931a;
}

.podium-first .podium-avatar-placeholder {
  font-size: 2.5rem;
}

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

.podium-first .podium-medal {
  font-size: 1.75rem;
}

.podium-name {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-first .podium-name {
  font-size: 1.1rem;
}

.podium-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.podium-solved {
  font-size: 0.8rem;
  color: #3b82f6;
  font-weight: 500;
}

.podium-earned {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 600;
}

.podium-pedestal {
  width: 100%;
  border-radius: 8px 8px 0 0;
  margin-top: 1rem;
}

.podium-pedestal.gold {
  height: 100px;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 171, 0, 0.15) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-bottom: none;
}

.podium-pedestal.silver {
  height: 70px;
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.1) 100%);
  border: 1px solid rgba(192, 192, 192, 0.2);
  border-bottom: none;
}

.podium-pedestal.bronze {
  height: 50px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.1) 100%);
  border: 1px solid rgba(205, 127, 50, 0.2);
  border-bottom: none;
}

/* ========== Controls ========== */
.ranking-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.leaderboard-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-dropdown label {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.875rem;
}

.sort-dropdown select {
  padding: 0.625rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

.sort-dropdown select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(15, 23, 42, 0.9);
}

.sort-dropdown select:focus {
  outline: none;
  border-color: #f7931a;
  box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.2);
}

/* ========== Ranking List ========== */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ranking-card:hover {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(247, 147, 26, 0.3);
  transform: translateX(4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ranking-card.top-three {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.12);
}

.ranking-card.top-three:hover {
  border-color: rgba(247, 147, 26, 0.4);
}

/* Position */
.ranking-position {
  width: 48px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.position-medal {
  font-size: 1.75rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.position-number {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #64748b;
}

/* User Info */
.ranking-user {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
}

.ranking-avatar {
  flex-shrink: 0;
}

.ranking-avatar-img,
.ranking-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.ranking-card:hover .ranking-avatar-img,
.ranking-card:hover .ranking-avatar-placeholder {
  border-color: rgba(247, 147, 26, 0.4);
}

.ranking-avatar-img {
  object-fit: cover;
}

.ranking-avatar-placeholder {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #f7931a;
  font-size: 1.1rem;
}

.ranking-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ranking-user-name {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-user-handle {
  font-size: 0.8rem;
  color: #64748b;
}

/* Metrics */
.ranking-metrics {
  display: flex;
  gap: 2rem;
  flex-shrink: 0;
}

.ranking-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 90px;
  text-align: right;
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}

.metric-value.solved {
  color: #3b82f6;
}

.metric-value.earned {
  color: #10b981;
}

.metric-value.average {
  color: #f7931a;
}

.metric-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 0.25rem;
}

/* Arrow */
.ranking-arrow {
  color: #475569;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.ranking-card:hover .ranking-arrow {
  color: #f7931a;
  transform: translateX(4px);
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.75rem;
}

.empty-state p {
  color: #94a3b8;
  font-size: 1rem;
  margin: 0 0 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: linear-gradient(135deg, #f7931a 0%, #ffab40 100%);
  color: #0f172a;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(247, 147, 26, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(247, 147, 26, 0.4);
}

/* ========== Responsive Design ========== */
@media (max-width: 900px) {
  .ranking-metrics {
    gap: 1.25rem;
  }

  .ranking-metric {
    min-width: 80px;
  }

  .metric-value {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .ranking-hero {
    padding: 3rem 1rem 2rem;
  }

  .ranking-title {
    font-size: 2.25rem;
  }

  .ranking-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .ranking-global-stats {
    gap: 0.75rem;
  }

  .global-stat {
    padding: 1rem 1.25rem;
    min-width: 100px;
    flex: 1;
  }

  .global-stat-number {
    font-size: 1.5rem;
  }

  .global-stat-label {
    font-size: 0.7rem;
  }

  .ranking-container {
    padding: 2rem 0.75rem;
  }

  /* Podium adjustments */
  .podium-wrapper {
    gap: 0.5rem;
    padding: 0 0.5rem;
  }

  .podium-card {
    width: 120px;
    padding: 1.5rem 1rem;
    border-radius: 16px;
  }

  .podium-first .podium-card {
    width: 140px;
    padding: 1.75rem 1rem;
  }

  .podium-avatar-img,
  .podium-avatar-placeholder {
    width: 56px;
    height: 56px;
  }

  .podium-first .podium-avatar-img,
  .podium-first .podium-avatar-placeholder {
    width: 70px;
    height: 70px;
  }

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

  .podium-first .podium-avatar-placeholder {
    font-size: 1.75rem;
  }

  .podium-medal {
    font-size: 1.25rem;
  }

  .podium-first .podium-medal {
    font-size: 1.5rem;
  }

  .podium-name {
    font-size: 0.85rem;
  }

  .podium-first .podium-name {
    font-size: 0.9rem;
  }

  .podium-solved,
  .podium-earned {
    font-size: 0.7rem;
  }

  .podium-pedestal.gold { height: 70px; }
  .podium-pedestal.silver { height: 50px; }
  .podium-pedestal.bronze { height: 35px; }

  /* List adjustments */
  .ranking-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .leaderboard-title {
    text-align: center;
  }

  .sort-dropdown {
    justify-content: center;
  }

  .ranking-card {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }

  .ranking-position {
    width: 40px;
  }

  .position-medal {
    font-size: 1.5rem;
  }

  .position-number {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .ranking-avatar-img,
  .ranking-avatar-placeholder {
    width: 40px;
    height: 40px;
  }

  .ranking-user-name {
    font-size: 0.9rem;
  }

  .ranking-user-handle {
    font-size: 0.75rem;
  }

  .ranking-metrics {
    gap: 1rem;
  }

  .ranking-metric {
    min-width: 70px;
  }

  .metric-value {
    font-size: 0.9rem;
  }

  .metric-label {
    font-size: 0.6rem;
  }
}

@media (max-width: 600px) {
  .ranking-metrics {
    display: none;
  }

  .ranking-card {
    padding: 0.75rem;
  }

  .ranking-user {
    gap: 0.75rem;
  }

  .ranking-arrow {
    display: none;
  }
}

@media (max-width: 480px) {
  .ranking-hero {
    padding: 2rem 1rem 1.5rem;
  }

  .trophy-emoji {
    font-size: 3rem;
  }

  .ranking-title {
    font-size: 1.75rem;
  }

  .ranking-subtitle {
    font-size: 0.9rem;
  }

  .ranking-global-stats {
    flex-direction: column;
    align-items: center;
  }

  .global-stat {
    width: 100%;
    max-width: 250px;
    padding: 1rem;
  }

  /* Hide podium on very small screens, show in list instead */
  .ranking-podium {
    display: none;
  }

  .ranking-container {
    padding: 1.5rem 0.75rem;
  }

  .leaderboard-title {
    font-size: 1.1rem;
  }

  .empty-state {
    padding: 3rem 1.5rem;
  }

  .empty-icon {
    font-size: 3rem;
  }

  .empty-state h3 {
    font-size: 1.25rem;
  }

  .empty-state p {
    font-size: 0.9rem;
  }
}
