/* Leaderboards-specific styles - uses game-container from Game.css */

/* Header styles removed - using game-header from Game.css */

.game-main .leaderboards-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  padding: 2rem;
}

.stat-selector {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(107, 185, 240, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 2rem;
}

.stat-selector h3 {
  margin: 0 0 1rem 0;
  color: #6bb9f0;
  font-size: 1.2rem;
  text-align: center;
}

.stat-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-option {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s;
  color: #fff;
  font-size: 1rem;
  text-align: left;
}

.stat-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.stat-option.active {
  background: rgba(107, 185, 240, 0.2);
  border-width: 2px;
  box-shadow: 0 0 10px rgba(107, 185, 240, 0.4);
}

.stat-icon {
  font-size: 1.5rem;
}

.stat-label {
  font-weight: 600;
}

.leaderboard-content {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(107, 185, 240, 0.3);
  border-radius: 12px;
  padding: 2rem;
}

.leaderboard-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.title-icon {
  font-size: 2rem;
}

.leaderboard-title h2 {
  margin: 0;
  font-size: 2rem;
  color: #fff;
}

.leaderboard-loading, .leaderboard-error, .leaderboard-empty {
  text-align: center;
  padding: 4rem 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 1rem;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #6bb9f0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.leaderboard-error button {
  margin-top: 1rem;
  background: #6bb9f0;
  border: none;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

.leaderboard-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.table-header {
  display: grid;
  grid-template-columns: 80px 1fr 120px 150px;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  font-weight: 700;
  color: #6bb9f0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 150px;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  align-items: center;
}

.table-row:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
  border-color: rgba(107, 185, 240, 0.5);
}

.table-row.rank-gold {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-color: rgba(255, 215, 0, 0.4);
}

.table-row.rank-gold:hover {
  border-color: rgba(255, 215, 0, 0.7);
}

.table-row.rank-silver {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-color: rgba(192, 192, 192, 0.4);
}

.table-row.rank-silver:hover {
  border-color: rgba(192, 192, 192, 0.7);
}

.table-row.rank-bronze {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-color: rgba(205, 127, 50, 0.4);
}

.table-row.rank-bronze:hover {
  border-color: rgba(205, 127, 50, 0.7);
}

.col-rank {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-badge {
  font-size: 1.5rem;
  font-weight: 700;
}

.col-player {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.player-username {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.col-level {
  display: flex;
  justify-content: center;
}

.level-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.95rem;
}

.col-value {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.col-value .stat-value {
  font-size: 1.3rem;
  font-weight: 700;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 0;
}

.pagination-top {
  margin: 0;
  gap: 0.5rem;
}

.pagination-top .pagination-btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  min-width: 40px;
}

.pagination-top .pagination-info {
  font-size: 0.9rem;
  min-width: 60px;
  text-align: center;
}

.pagination-btn {
  background: rgba(107, 185, 240, 0.1);
  border: 2px solid rgba(107, 185, 240, 0.3);
  color: #6bb9f0;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(107, 185, 240, 0.2);
  border-color: #6bb9f0;
  transform: translateY(-2px);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  font-weight: 600;
}

/* Mobile responsive */
@media (max-width: 1024px) {
  .game-main .leaderboards-container {
    grid-template-columns: 1fr;
  }

  .stat-selector {
    position: static;
  }

  .stat-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Remove tab bar spacing for leaderboards page */
  .game-main {
    margin-bottom: 0 !important;
  }

  .game-main .leaderboards-container {
    padding: 0.75rem;
    padding-top: 4rem; /* Space for hamburger button */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Hide desktop stat selector on mobile */
  .stat-selector {
    display: none;
  }

  .stat-selector h3 {
    display: none;
  }

  /* Dropdown-style selector on mobile */
  .stat-options {
    position: relative;
    display: block;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(107, 185, 240, 0.3);
    border-radius: 8px;
    width: 90%;
    max-width: 350px;
    margin: 0 auto;
  }

  .stat-option {
    width: 100%;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 1rem;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s;
  }

  .stat-option:hover {
    background: rgba(255, 255, 255, 0.05);
  }

  .stat-option:first-child {
    border-radius: 6px 6px 0 0;
  }

  .stat-option:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
  }

  /* Show only active by default */
  .stat-option:not(.active) {
    display: none;
  }

  .stat-option.active {
    background: rgba(107, 185, 240, 0.15);
    border-radius: 6px;
    position: relative;
  }

  /* Add dropdown arrow to active option */
  .stat-option.active::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    opacity: 0.7;
    font-size: 0.8rem;
    pointer-events: none;
  }

  /* Show all options when expanded */
  .stat-options.expanded .stat-option:not(.active) {
    display: flex;
  }

  .stat-options.expanded .stat-option.active {
    border-radius: 6px 6px 0 0;
  }

  .stat-options.expanded .stat-option.active::after {
    content: '▲';
  }

  .stat-options.expanded {
    background: rgba(0, 0, 0, 0.98);
    border-radius: 6px;
    border-color: rgba(107, 185, 240, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
  }

  .leaderboard-content {
    padding: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .leaderboard-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
  }

  .leaderboard-title.dropdown-open {
    z-index: 100;
  }

  .title-left {
    width: 100%;
  }

  .clickable-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
  }

  .clickable-title:active {
    background: rgba(255, 255, 255, 0.05);
  }

  .dropdown-arrow {
    margin-left: auto;
    font-size: 0.9rem;
    opacity: 0.7;
  }

  .title-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.98);
    border: 2px solid rgba(107, 185, 240, 0.6);
    border-top: none;
    border-radius: 0 0 12px 12px;
    margin-top: -0.75rem;
    padding-top: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 101;
    max-height: 400px;
    overflow-y: auto;
  }

  .title-dropdown-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
  }

  .title-dropdown-option:last-child {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
  }

  .title-dropdown-option:hover,
  .title-dropdown-option:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .title-icon {
    font-size: 1.5rem;
  }

  .leaderboard-title h2 {
    font-size: 1.3rem;
  }

  .pagination-top,
  .pagination-bottom {
    width: 100%;
    justify-content: center;
  }

  .pagination-bottom {
    margin-top: 1rem;
  }

  .pagination-btn {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0.5rem !important;
    font-size: 1.2rem !important;
    border-radius: 8px !important;
  }

  .pagination-info {
    min-width: 100px;
    text-align: center;
    font-size: 0.95rem;
  }

  .table-header {
    display: none; /* Hide header on mobile */
  }

  .table-row {
    grid-template-columns: 50px 1fr 70px;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .col-level {
    order: 3;
  }

  .col-value {
    order: 2;
    grid-column: 2 / 3;
    text-align: right;
    margin-top: 0.25rem;
  }

  .player-name {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-username {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .level-badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .col-value .stat-value {
    font-size: 1.1rem;
  }
}
