/* Leaderboard Specific Styles */

.leaderboard-card {
  max-width: 900px;
  margin: 0 auto;
}

.leaderboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(122, 92, 255, 0.2);
}

.metric-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-selector label {
  color: var(--muted);
  font-weight: 500;
}

.update-info {
  font-size: 0.85rem;
  color: var(--muted);
}

.back-link {
  color: var(--neon);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

/* Date Timeline */
.date-timeline-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 15px;
  background: linear-gradient(135deg, rgba(13, 23, 48, 0.6) 0%, rgba(15, 26, 51, 0.4) 100%);
  border-radius: 12px;
  border: 1px solid rgba(122, 92, 255, 0.15);
}

.date-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--neon);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  transition: all 0.2s;
  flex-shrink: 0;
}

.date-nav-btn:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.date-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.date-timeline {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  padding: 5px 0;
}

.date-timeline::-webkit-scrollbar {
  height: 4px;
}

.date-timeline::-webkit-scrollbar-track {
  background: rgba(122, 92, 255, 0.1);
  border-radius: 2px;
}

.date-timeline::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 2px;
}

.timeline-track {
  position: relative;
  min-width: max-content;
  display: flex;
  align-items: center;
  padding: 10px 0;
}

.timeline-line {
  position: absolute;
  top: 20px;
  /* Align with center of marker dots */
  left: 25px;
  right: 25px;
  height: 2px;
  background: linear-gradient(90deg, var(--neon) 0%, var(--accent) 50%, var(--neon) 100%);
  opacity: 0.3;
}

.timeline-dates {
  display: flex;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.timeline-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 50px;
}

.timeline-marker:hover {
  background: rgba(122, 92, 255, 0.2);
}

.timeline-marker.active {
  background: rgba(0, 229, 255, 0.2);
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.marker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(122, 92, 255, 0.5);
  border: 2px solid var(--panel);
  transition: all 0.2s;
}

.timeline-marker:hover .marker-dot {
  background: var(--accent);
  transform: scale(1.2);
}

.timeline-marker.active .marker-dot {
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
  transform: scale(1.3);
}

.marker-label {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.2s;
  font-weight: 500;
}

.timeline-marker:hover .marker-label {
  color: var(--text);
}

.timeline-marker.active .marker-label {
  color: var(--neon);
  font-weight: 600;
}

/* Loading */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
}

.loading-container.hidden {
  display: none !important;
}

.loader {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(122, 92, 255, 0.2);
  border-top-color: var(--neon);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Leaderboard Table */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.leaderboard-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.leaderboard-table th {
  background: rgba(13, 23, 48, 0.95);
  color: var(--neon);
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--accent);
}

.leaderboard-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(122, 92, 255, 0.1);
  transition: background 0.2s;
  vertical-align: middle;
}

.leaderboard-table tbody tr {
  transition: all 0.2s;
}

.leaderboard-table tbody tr:hover {
  background: rgba(122, 92, 255, 0.08);
}

/* Column widths */
.col-rank {
  width: 60px;
  text-align: center !important;
}

.col-rank-diff {
  width: 80px;
  text-align: center !important;
}

.col-name {
  min-width: 200px;
}

.col-value {
  width: 150px;
  text-align: right !important;
}

.col-diff {
  width: 120px;
  text-align: right !important;
}

/* Rank styling */
.rank-cell {
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

.rank-1 {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  font-size: 1.2rem;
}

.rank-2 {
  color: #c0c0c0;
  text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
  font-size: 1.1rem;
}

.rank-3 {
  color: #cd7f32;
  text-shadow: 0 0 8px rgba(205, 127, 50, 0.5);
  font-size: 1.05rem;
}

/* Rank diff cell */
.rank-diff-cell {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Top 3 row highlights */
.row-rank-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
}

.row-rank-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.08) 0%, transparent 100%);
}

.row-rank-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.08) 0%, transparent 100%);
}

/* Name cell */
.name-cell {
  vertical-align: middle;
}

.player-name {
  font-weight: 600;
  color: var(--text);
}

.player-id {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

/* Value cell */
.value-cell {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Diff cell */
.diff-cell {
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.diff-positive {
  color: var(--good);
}

.diff-negative {
  color: var(--bad);
}

.diff-neutral {
  color: var(--muted);
}

/* Sortable Headers */
.sortable-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.col-rank-diff .sortable-header,
.col-diff .sortable-header {
  justify-content: flex-end;
}

.col-value .sortable-header {
  justify-content: flex-end;
}

.sort-btns {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sort-btn {
  width: 16px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 8px;
  line-height: 1;
  padding: 0;
  transition: all 0.15s;
  opacity: 0.5;
}

.sort-btn:hover {
  color: var(--neon);
  opacity: 1;
}

.sort-btn.active {
  color: var(--neon);
  opacity: 1;
  text-shadow: 0 0 6px var(--neon);
}

.sort-btn.sort-up {
  border-radius: 3px 3px 0 0;
}

.sort-btn.sort-down {
  border-radius: 0 0 3px 3px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(122, 92, 255, 0.2);
  flex-wrap: wrap;
}

.btn-page {
  background: rgba(122, 92, 255, 0.15);
  border: 1px solid rgba(122, 92, 255, 0.3);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  gap: 5px;
}

.page-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 23, 48, 0.6);
  border: 1px solid rgba(122, 92, 255, 0.2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.page-btn:hover {
  border-color: var(--neon);
  background: rgba(122, 92, 255, 0.2);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--bad);
}

.error-state p {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
  .leaderboard-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .leaderboard-table {
    font-size: 0.85rem;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 8px;
  }

  .col-diff {
    display: none;
  }

  .page-numbers {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Medal icons for top 3 */
.medal {
  display: inline-block;
  margin-right: 4px;
}

/* Player Modal */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.player-modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 25, 0.85);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 450px;
  background: linear-gradient(135deg, var(--panel) 0%, #0f1a33 100%);
  border: 1px solid rgba(122, 92, 255, 0.3);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(122, 92, 255, 0.2);
  animation: modalSlideIn 0.3s ease-out;
}

/* Responsive modal - shrink everything to fit */
@media (max-height: 700px),
(max-width: 550px) {
  .player-modal {
    padding: 8px;
  }

  .modal-content {
    max-width: 95vw;
    border-radius: 10px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 12px;
  }

  .modal-stats-grid {
    gap: 6px;
    margin-bottom: 12px;
  }

  .modal-stat {
    padding: 8px 6px;
    border-radius: 8px;
  }

  .modal-stat-label {
    font-size: 0.65rem;
    margin-bottom: 2px;
  }

  .modal-stat-value {
    font-size: 0.9rem;
  }

  .modal-stat.highlight {
    padding: 10px;
  }

  .modal-stat.highlight .modal-stat-value {
    font-size: 1.4rem;
  }

  .modal-chart-container {
    height: 175px;
    padding: 8px;
  }

  .chart-title {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .modal-footer {
    padding: 10px 12px 12px;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(122, 92, 255, 0.2);
  position: relative;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--neon);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
  flex: 1;
  text-align: center;
  padding-right: 32px;
  /* Offset for close button */
}

.btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 92, 147, 0.1);
  border: 1px solid rgba(255, 92, 147, 0.3);
  color: var(--bad);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s;
}

.btn-close:hover {
  background: rgba(255, 92, 147, 0.2);
  border-color: var(--bad);
  box-shadow: 0 0 12px rgba(255, 92, 147, 0.3);
}

.modal-body {
  padding: 24px;
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.modal-stat {
  background: rgba(122, 92, 255, 0.08);
  border: 1px solid rgba(122, 92, 255, 0.15);
  border-radius: 8px;
  padding: 10px 10px;
  text-align: center;
  transition: all 0.2s;
}

.modal-stat:hover {
  background: rgba(122, 92, 255, 0.12);
  border-color: rgba(122, 92, 255, 0.25);
}

.modal-stat.highlight {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  grid-column: span 2;
  padding: 12px;
}

.modal-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-stat-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-stat.highlight .modal-stat-value {
  color: var(--neon);
  font-size: 1.8rem;
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
  flex-direction: row;
  justify-content: center;
  gap: 10px;
}

.rank-highlight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Stat diff styling */
.stat-diff {
  font-size: 0.75rem;
  font-weight: 600;
}

.stat-diff.diff-positive {
  color: var(--good);
}

.stat-diff.diff-negative {
  color: var(--bad);
}

.stat-diff.diff-neutral {
  color: var(--muted);
}

/* Stat ranking badge */
.stat-ranking {
  display: inline-block;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(122, 92, 255, 0.2));
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--neon);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}

.modal-chart-container {
  height: 200px;
  background: rgba(5, 10, 25, 0.5);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(122, 92, 255, 0.1);
  position: relative;
}

.chart-title {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--neon);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 25, 0.8);
  border-radius: 10px;
  z-index: 5;
  color: var(--muted);
  font-size: 0.85rem;
}

.loader-small {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(122, 92, 255, 0.2);
  border-top-color: var(--neon);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.no-chart-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
}

.switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  width: 32px;
  height: 18px;
  background: rgba(122, 92, 255, 0.3);
  border-radius: 9px;
  position: relative;
  transition: all 0.2s;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.switch-label input:checked+.switch-slider {
  background: rgba(0, 229, 255, 0.4);
}

.switch-label input:checked+.switch-slider::before {
  transform: translateX(14px);
  background: var(--neon);
  box-shadow: 0 0 6px var(--neon);
}

.switch-icon {
  color: var(--muted);
  transition: color 0.2s;
}

.switch-label input:checked~.switch-icon {
  color: var(--neon);
}

.rank-metric {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 500;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #000;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #333;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-share:hover {
  background: #1a1a1a;
  border-color: #555;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.btn-share svg {
  flex-shrink: 0;
}

.modal-footer .btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--neon), var(--accent));
  color: var(--dark);
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.modal-footer .btn-primary:hover {
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
  transform: translateY(-2px);
}

/* Clickable row styling */
.clickable-row {
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.clickable-row:hover {
  background: rgba(122, 92, 255, 0.15) !important;
}

.clickable-row:active {
  transform: scale(0.995);
}

.player-name-link {
  color: var(--neon);
  cursor: pointer;
  transition: color 0.2s;
}

.player-name-link:hover {
  color: var(--accent);
  text-decoration: underline;
}