/**
 * Leaderboard Page Styles
 *
 * Hexagonal hub design with:
 * - Central hex showing #1, #2, #3 positions
 * - Player hexes attached to top three edges
 * - Category buttons on bottom three edges
 * - Rankings table below
 */

/* ============================================
   PAGE CONTAINER
   ============================================ */

.leaderboard-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: calc(100vw - 32px);
  min-height: 0;
  overflow: hidden;
  padding: 8px 0;
}

.leaderboard-layout-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  min-height: 0;
  overflow: hidden;
}

/* ============================================
   HUB SECTION
   ============================================ */

.leaderboard-hub-section {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 16px;
}

#hub-canvas {
  display: block;
}

.hub-overlays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hub-btn-overlay {
  pointer-events: auto;
}

.hub-avatar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   RANKINGS SECTION
   ============================================ */

.leaderboard-rankings-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0; /* Required for flex child overflow to work */
  background: rgba(26, 21, 16, 0.8);
  border: 2px solid var(--border-dark, #3d3530);
  border-radius: 4px;
  overflow: hidden;
}

.rankings-header-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-medium, #2a2520);
  border-bottom: 2px solid var(--border-dark, #3d3530);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary, #a89880);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.rankings-header-row .col-rank {
  width: 70px;
  text-align: center;
}

.rankings-header-row .col-player {
  flex: 1;
}

.rankings-header-row .col-score {
  width: 120px;
  text-align: right;
}

.rankings-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* Required for flex child to scroll properly */
}

/* Custom scrollbar for rankings */
.rankings-scroll::-webkit-scrollbar {
  width: 12px;
}

.rankings-scroll::-webkit-scrollbar-track {
  background: var(--bg-darkest, #0d0b09);
  border-left: 1px solid var(--border-dark, #3d3530);
}

.rankings-scroll::-webkit-scrollbar-thumb {
  background: var(--border-light, #6b5c4a);
  border: 2px solid var(--bg-darkest, #0d0b09);
}

.rankings-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--gold, #d4a92a);
}

.rankings-list {
  display: flex;
  flex-direction: column;
}

.ranking-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dark, #3d3530);
  transition: background-color 0.15s;
}

.ranking-row:hover {
  background: var(--bg-medium, #2a2520);
}

.ranking-row.highlight {
  background: rgba(212, 169, 42, 0.1);
  border-left: 3px solid var(--gold, #d4a92a);
  padding-left: 13px;
}

.ranking-row .col-rank {
  width: 70px;
  display: flex;
  justify-content: center;
}

.ranking-row .col-player {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ranking-row .col-score {
  width: 120px;
  text-align: right;
}

/* Hexagonal rank badge */
.rank-hex {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-light, #3d3530);
  color: var(--text-primary, #f0e6d3);
  font-weight: bold;
  font-size: 12px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background-color 0.2s;
}

.ranking-row:hover .rank-hex {
  background: var(--border-light, #6b5c4a);
}

/* Medal styling for top 3 in table */
.rank-hex.medal-1 {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #1a1510;
}

.rank-hex.medal-2 {
  background: linear-gradient(135deg, #c0c0c0, #808080);
  color: #1a1510;
}

.rank-hex.medal-3 {
  background: linear-gradient(135deg, #cd7f32, #8b4513);
  color: #1a1510;
}

.ranking-row.medal-1 {
  background: rgba(255, 215, 0, 0.08);
}

.ranking-row.medal-2 {
  background: rgba(192, 192, 192, 0.08);
}

.ranking-row.medal-3 {
  background: rgba(205, 127, 50, 0.08);
}

/* Player info */
.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid var(--border-dark, #3d3530);
  flex-shrink: 0;
}

.player-name {
  color: var(--text-accent, #e8c547);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name:hover {
  text-decoration: underline;
  color: var(--gold, #d4a92a);
}

.score-value {
  color: var(--gold, #d4a92a);
  font-weight: bold;
  font-size: 14px;
}

/* Empty/error states */
.no-more-data,
.error-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text-secondary, #a89880);
  font-style: italic;
}

.error-message {
  color: var(--danger, #cc4444);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--border-dark, #3d3530);
  background: var(--bg-medium, #2a2520);
  flex-shrink: 0;
}

.hex-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-darkest, #0d0b09);
  border: 2px solid var(--border-dark, #3d3530);
  color: var(--text-primary, #f0e6d3);
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
  transition: background-color 0.15s, border-color 0.15s;
}

.hex-page-btn:hover:not(:disabled) {
  background: var(--bg-light, #3d3530);
  border-color: var(--border-light, #6b5c4a);
}

.hex-page-btn.active {
  background: var(--gold, #d4a92a);
  border-color: var(--gold, #d4a92a);
  color: var(--bg-darkest, #0d0b09);
}

.hex-page-btn:disabled,
.hex-page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-secondary, #a89880);
  padding: 0 4px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 700px) {
  .leaderboard-layout-container {
    max-width: 100%;
  }

  .rankings-header-row,
  .ranking-row {
    padding: 8px 12px;
  }

  .rankings-header-row .col-rank,
  .ranking-row .col-rank {
    width: 50px;
  }

  .rankings-header-row .col-score,
  .ranking-row .col-score {
    width: 80px;
  }

  .rank-hex {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .player-avatar {
    width: 28px;
    height: 28px;
  }

  .ranking-row .col-player {
    gap: 8px;
  }

  .score-value {
    font-size: 12px;
  }
}

@media (max-width: 500px) {
  .player-avatar {
    display: none;
  }

  .rankings-header-row .col-rank,
  .ranking-row .col-rank {
    width: 40px;
  }

  .rankings-header-row .col-score,
  .ranking-row .col-score {
    width: 60px;
  }

  .rank-hex {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .hex-page-btn {
    min-width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .pagination-container {
    gap: 4px;
    padding: 8px;
  }
}
