/* leaderboard.css - Custom styling for Leaderboard Page */

.leaderboard-container {
  max-width: 1200px;
  margin: 100px auto 40px;
  padding: 0 24px;
}

.leaderboard-header-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.header-titles {
  flex: 1;
  min-width: 300px;
}

.header-titles h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 8px;
  margin-bottom: 12px;
  text-shadow: 0 0 40px rgba(0, 255, 136, 0.1);
}

.section-desc {
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 520px;
}

/* Stats Panel */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  min-width: 460px;
  padding: 20px;
}

@media (max-width: 768px) {
  .stats-panel {
    min-width: 100%;
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(12, 22, 32, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0, 255, 136, 0.05);
  color: var(--primary);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Top 3 Podium */
.podium-section {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 50px;
  min-height: 280px;
  padding-top: 20px;
}

@media (max-width: 640px) {
  .podium-section {
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }
}

.podium-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(12, 22, 32, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: 220px;
}

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

.podium-card.rank-1 {
  height: 280px;
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
  z-index: 2;
}

.podium-card.rank-2 {
  height: 240px;
  border-color: rgba(192, 192, 192, 0.3);
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.1);
}

.podium-card.rank-3 {
  height: 210px;
  border-color: rgba(205, 127, 50, 0.3);
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.08);
}

.podium-badge {
  position: absolute;
  top: -20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  background: var(--bg-2);
  border: 2px solid;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rank-1 .podium-badge { border-color: #ffd700; color: #ffd700; }
.rank-2 .podium-badge { border-color: #c0c0c0; color: #c0c0c0; }
.rank-3 .podium-badge { border-color: #cd7f32; color: #cd7f32; }

.podium-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.05);
  border: 2px solid rgba(0, 255, 136, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 10px;
  margin-bottom: 12px;
}

.rank-1 .podium-avatar { border-color: rgba(255, 215, 0, 0.4); color: #ffd700; }
.rank-2 .podium-avatar { border-color: rgba(192, 192, 192, 0.4); color: #c0c0c0; }
.rank-3 .podium-avatar { border-color: rgba(205, 127, 50, 0.4); color: #cd7f32; }

.podium-alias {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.rank-1 .podium-score { color: #ffd700; }
.rank-2 .podium-score { color: #c0c0c0; }
.rank-3 .podium-score { color: #cd7f32; }

/* Table Matrix Toolbar */
.matrix-section {
  padding: 24px;
}

.matrix-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 360px;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  width: 18px;
  height: 18px;
}

#leaderboardSearch {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: rgba(12, 22, 32, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#leaderboardSearch:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.25);
}

.matrix-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 8px #00ff88;
  animation: pulse 1.8s infinite;
}

.status-text {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #00ff88;
  font-weight: 600;
}

/* Table Style */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(12, 22, 32, 0.2);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.leaderboard-table th {
  background: rgba(12, 22, 32, 0.8);
  padding: 16px 20px;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}

.leaderboard-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.08);
  color: #e2e8f0;
  vertical-align: middle;
}

.leaderboard-table tbody tr {
  transition: background-color 0.2s ease;
}

.leaderboard-table tbody tr:hover {
  background-color: rgba(0, 255, 136, 0.03);
}

.leaderboard-table tbody tr.current-user-row {
  background-color: rgba(0, 255, 136, 0.07);
  border-left: 3px solid var(--primary);
  border-right: 3px solid var(--primary);
}

.leaderboard-table tbody tr.current-user-row td {
  color: var(--primary);
  font-weight: 600;
}

.col-rank { width: 80px; font-weight: 700; font-variant-numeric: tabular-nums; }
.col-player { font-weight: 600; }
.col-score { color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.col-flags { font-variant-numeric: tabular-nums; }
.col-levels { font-variant-numeric: tabular-nums; }
.col-lastsolve { color: #94a3b8; }

/* Loading & Empty State */
.table-loading {
  text-align: center;
  padding: 40px !important;
}

.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #94a3b8;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 255, 136, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

.loading-placeholder {
  color: #94a3b8;
  font-size: 1rem;
}

.no-results-panel {
  text-align: center;
  padding: 60px 40px;
}

.no-results-icon {
  width: 48px;
  height: 48px;
  color: #94a3b8;
  margin-bottom: 16px;
  opacity: 0.7;
}

.no-results-panel h3 {
  font-size: 1.3rem;
  color: #ffffff;
  margin-bottom: 8px;
}

.no-results-panel p {
  color: #94a3b8;
}

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

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(0, 255, 136, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
}
