/* Ranking Page Styles - Bright Holographic Theme with Podium Effects */

/* ==================== CONTAINER ==================== */

.ranking-container {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #e0e7ff 50%, #fce7f3 100%);
  padding-bottom: 5rem;
  position: relative;
}

.ranking-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(251, 191, 36, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== HEADER ==================== */

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}

.ranking-header .back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #6366f1;
  text-decoration: none;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  transition: all 0.2s ease;
}

.ranking-header .back-link:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateX(-2px);
}

.ranking-header .header-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ranking-header .header-actions {
  width: 40px;
}

/* ==================== TABS ==================== */

.ranking-tabs {
  display: flex;
  padding: 1rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
}

.ranking-tabs::-webkit-scrollbar {
  display: none;
}

.ranking-tab {
  flex: 1;
  min-width: max-content;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ranking-tab:hover {
  background: rgba(99, 102, 241, 0.05);
  color: #6366f1;
  transform: translateY(-2px);
}

.ranking-tab.active {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}

/* ==================== CONTENT ==================== */

.ranking-content {
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

.ranking-panel {
  display: none;
}

.ranking-panel.active {
  display: block;
}

/* ==================== PODIUM (Top 3) ==================== */

.ranking-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 2rem 1rem;
  margin-bottom: 1.5rem;
}

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

.podium-item.rank-1 { order: 2; }
.podium-item.rank-2 { order: 1; }
.podium-item.rank-3 { order: 3; }

.podium-avatar {
  position: relative;
  margin-bottom: -24px;
  z-index: 2;
}

.podium-avatar-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #6366f1, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.podium-item.rank-1 .podium-avatar-img {
  width: 80px;
  height: 80px;
  border-color: #fbbf24;
  font-size: 2rem;
  box-shadow:
    0 0 30px rgba(251, 191, 36, 0.5),
    0 0 60px rgba(251, 191, 36, 0.3);
  animation: goldGlow 2s ease-in-out infinite;
}

@keyframes goldGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.5), 0 0 60px rgba(251, 191, 36, 0.3); }
  50% { box-shadow: 0 0 40px rgba(251, 191, 36, 0.7), 0 0 80px rgba(251, 191, 36, 0.5); }
}

.podium-item.rank-2 .podium-avatar-img {
  border-color: #e2e8f0;
  box-shadow: 0 0 20px rgba(226, 232, 240, 0.5);
}

.podium-item.rank-3 .podium-avatar-img {
  border-color: #fdba74;
  box-shadow: 0 0 20px rgba(253, 186, 116, 0.5);
}

.podium-crown {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.75rem;
  animation: crownBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(251, 191, 36, 0.5));
}

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

.podium-stand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.75rem 1.5rem 1rem;
  border-radius: 16px 16px 0 0;
  min-width: 90px;
  position: relative;
  overflow: hidden;
}

.podium-item.rank-1 .podium-stand {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  min-height: 130px;
  box-shadow:
    0 0 40px rgba(251, 191, 36, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.podium-item.rank-2 .podium-stand {
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
  min-height: 100px;
  box-shadow:
    0 0 20px rgba(203, 213, 225, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.podium-item.rank-3 .podium-stand {
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 100%);
  min-height: 75px;
  box-shadow:
    0 0 20px rgba(251, 146, 60, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.podium-stand::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: standShine 3s ease-in-out infinite;
}

@keyframes standShine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.podium-rank {
  font-size: 1.75rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.podium-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-top: 0.25rem;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.podium-score {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.25rem;
  font-weight: 600;
}

/* ==================== USER RANK BANNER (Sticky Footer) ==================== */

.user-rank-banner {
  position: fixed;
  bottom: 70px;
  left: 1rem;
  right: 1rem;
  background: white;
  border: 2px solid #6366f1;
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 30px rgba(99, 102, 241, 0.2);
  z-index: 90;
}

.user-rank-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-rank-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.user-rank-details {
  display: flex;
  flex-direction: column;
}

.user-rank-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.user-rank-position {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-rank-percentile {
  padding: 0.375rem 0.875rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #10b981;
}

/* ==================== TYPE DISTRIBUTION ==================== */

.type-distribution {
  margin-bottom: 1.5rem;
  background: white;
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.distribution-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.distribution-bar-container {
  margin-bottom: 0.75rem;
}

.distribution-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.distribution-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #1e293b;
  font-weight: 600;
}

.distribution-type-emoji {
  font-size: 1rem;
}

.distribution-percentage {
  font-size: 0.875rem;
  font-weight: 700;
  color: #6366f1;
}

.distribution-bar {
  height: 28px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.distribution-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
  position: relative;
}

.distribution-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==================== LEADERBOARD ==================== */

.leaderboard {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  align-items: center;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
  transition: all 0.2s ease;
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-item:hover {
  background: rgba(99, 102, 241, 0.03);
  transform: translateX(4px);
}

.leaderboard-item.highlighted {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border-left: 3px solid #6366f1;
}

.leaderboard-rank {
  font-size: 1rem;
  font-weight: 800;
  color: #1e293b;
  text-align: center;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 10px;
}

.leaderboard-rank.gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.leaderboard-rank.silver {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #475569;
}

.leaderboard-rank.bronze {
  background: linear-gradient(135deg, #fdba74, #fb923c);
  color: white;
}

.leaderboard-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.leaderboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.2);
}

.leaderboard-user-info {
  display: flex;
  flex-direction: column;
}

.leaderboard-name {
  font-weight: 700;
  color: #1e293b;
  font-size: 0.9375rem;
}

.leaderboard-type {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.leaderboard-value {
  font-weight: 800;
  color: #6366f1;
  font-size: 1rem;
  text-align: right;
}

/* ==================== COMPATIBILITY PAIRS ==================== */

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

.compatibility-card {
  background: white;
  border-radius: 20px;
  padding: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.compatibility-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.12);
}

.compatibility-rank {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.compatibility-rank-number {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  min-width: 32px;
}

.compatibility-rank-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.compatibility-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.compatibility-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.compatibility-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.375rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.compatibility-name {
  font-size: 0.8125rem;
  color: #1e293b;
  font-weight: 600;
}

.compatibility-heart {
  font-size: 1.75rem;
  color: #f43f5e;
  animation: heartPulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(244, 63, 94, 0.3));
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.compatibility-score {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.08);
}

.compatibility-score-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #10b981;
}

.compatibility-score-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ==================== EMPTY STATE ==================== */

.ranking-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.ranking-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.ranking-empty-text {
  color: #64748b;
  font-size: 0.9375rem;
}

/* ==================== NAVIGATION ==================== */

.ranking-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: white;
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.ranking-nav .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.ranking-nav .nav-link:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.05);
}

.ranking-nav .nav-link.active {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.ranking-nav .nav-icon {
  font-size: 1.25rem;
}

/* ==================== LOADING ==================== */

.ranking-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.ranking-loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ranking-loading-text {
  color: #64748b;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ==================== RESPONSIVE ==================== */

@media (min-width: 768px) {
  .ranking-container {
    max-width: 700px;
    margin: 0 auto;
  }

  .ranking-tabs {
    justify-content: center;
  }

  .ranking-tab {
    flex: none;
    min-width: 140px;
  }

  .user-rank-banner {
    max-width: 668px;
    left: 50%;
    transform: translateX(-50%);
  }

  .podium-item.rank-1 .podium-avatar-img {
    width: 96px;
    height: 96px;
    font-size: 2.5rem;
  }

  .podium-avatar-img {
    width: 64px;
    height: 64px;
  }
}
