/* ===================================
   Par Society – Golf Leaderboard v2
   =================================== */

.leaderboard-wrapper {
  margin: 3rem auto;
  max-width: 1320px;
  background: #262626;
  border: 1px solid rgba(243,239,224,0.1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.leaderboard-header {
  background: #1d1d1d;
  padding: 2rem 2rem 1.5rem;
  border-bottom: 2px solid rgba(76,175,80,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.leaderboard-title {
  margin: 0;
  font-family: 'Coolvetica', sans-serif;
  font-size: 2rem;
  font-weight: normal;
  color: #4CAF50;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
  min-width: 300px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  color: #f3efe0;
  font-family: 'Geist', sans-serif;
  font-size: 0.95rem;
}

.leaderboard-table thead {
  background: #1d1d1d;
  position: sticky;
  top: 0;
  z-index: 5;
}

.leaderboard-table th {
  font-family: 'Coolvetica', sans-serif;
  font-weight: normal;
  text-transform: uppercase;
  color: #4CAF50;
  font-size: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(243,239,224,0.15);
  white-space: nowrap;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.leaderboard-table th:hover {
  background-color: rgba(76,175,80,0.1);
  color: #66BB6A;
}

.leaderboard-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(243,239,224,0.05);
  text-align: center;
  vertical-align: middle;
}

/* Rank (Gross) column - pinned left */
.leaderboard-table td:nth-child(1),
.leaderboard-table th:nth-child(1) {
  position: sticky;
  left: 0;
  background: #1d1d1d;
  font-family: 'Coolvetica', sans-serif;
  font-size: 1.25rem;
  color: #4CAF50;
  width: 80px;
  text-align: center;
  font-weight: bold;
  z-index: 4;
}

/* Rank (Net) column - pinned left */
.leaderboard-table td:nth-child(2),
.leaderboard-table th:nth-child(2) {
  position: sticky;
  left: 80px;
  background: #1d1d1d;
  font-family: 'Coolvetica', sans-serif;
  font-size: 1.1rem;
  color: rgba(76,175,80,0.8);
  width: 80px;
  text-align: center;
  font-weight: bold;
  z-index: 4;
  border-right: 1px solid rgba(243,239,224,0.1);
}

/* Player name column - pinned left */
.leaderboard-table td:nth-child(3),
.leaderboard-table th:nth-child(3) {
  text-align: left;
  position: sticky;
  left: 160px;
  background: #262626;
  z-index: 3;
  font-weight: 500;
  min-width: 200px;
  padding-left: 2rem;
  padding-right: 2rem;
  border-right: 1px solid rgba(243,239,224,0.1);
}

/* Handicap column - next to player name */
.leaderboard-table td:nth-child(4),
.leaderboard-table th:nth-child(4) {
  text-align: center;
  min-width: 70px;
  color: rgba(243,239,224,0.9);
  font-weight: 500;
  font-size: 0.95rem;
}

/* Rounds column - next to handicap */
.leaderboard-table td:nth-child(5),
.leaderboard-table th:nth-child(5) {
  text-align: center;
  min-width: 90px;
  color: rgba(243,239,224,0.8);
  font-size: 0.9rem;
}

/* Total Gross column - 6th column */
.leaderboard-table td:nth-child(6) {
  font-weight: 600;
  color: #4CAF50;
  font-size: 1.1rem;
  font-family: 'Coolvetica', sans-serif;
}

/* Total Net column - 7th column */
.leaderboard-table td:nth-child(7) {
  font-weight: 600;
  color: #66BB6A;
  font-size: 1.1rem;
  font-family: 'Coolvetica', sans-serif;
}

/* Row hover */
.leaderboard-table tbody tr:hover {
  background: rgba(76,175,80,0.08);
  transition: background 0.2s ease;
}

/* Highlight top 3 */
.leaderboard-table tbody tr:nth-child(1) {
  background: linear-gradient(90deg, rgba(255,215,0,0.15), rgba(29,29,29,0));
}
.leaderboard-table tbody tr:nth-child(2) {
  background: linear-gradient(90deg, rgba(192,192,192,0.1), rgba(29,29,29,0));
}
.leaderboard-table tbody tr:nth-child(3) {
  background: linear-gradient(90deg, rgba(205,127,50,0.08), rgba(29,29,29,0));
}

/* Fade-in rows */
.leaderboard-table tbody tr {
  opacity: 0;
  transform: translateY(6px);
  animation: fadeInRow 0.4s ease forwards;
}
.leaderboard-table tbody tr:nth-child(n) {
  animation-delay: calc(0.02s * var(--i,1));
}
@keyframes fadeInRow {
  to {opacity:1;transform:translateY(0);}
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .leaderboard-wrapper {
    margin: 2rem 0;
    border-radius: 0;
  }

  .leaderboard-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.75rem;
  }

  .leaderboard-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #4CAF50;
    margin-bottom: 0.25rem;
  }
}

/* Last updated note */
.leaderboard-updated {
  font-size: 0.8rem;
  text-align: right;
  color: rgba(243,239,224,0.6);
  padding: 0.75rem 1rem 1rem;
}

/* ==============================
   Leaderboard Interactive Tools
   ============================== */

.leaderboard-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0;
}

.leaderboard-btn {
  background: #4CAF50;
  color: #f3efe0;
  font-family: 'Coolvetica', sans-serif;
  font-size: 1rem;
  text-transform: uppercase;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.leaderboard-btn:hover {
  background: #66BB6A;
  transform: translateY(-1px);
}

/* Sort indicator and active states */
.sort-indicator {
  opacity: 0.4;
  margin-left: 8px;
  font-size: 0.85rem;
  display: inline-block;
  transition: opacity 0.2s ease;
}

.leaderboard-table th:hover .sort-indicator {
  opacity: 0.7;
}

th.asc .sort-indicator {
  opacity: 1;
}

th.asc .sort-indicator::after { 
  content: " ▲"; 
  color: #66BB6A;
  font-weight: bold;
}

th.desc .sort-indicator {
  opacity: 1;
}

th.desc .sort-indicator::after { 
  content: " ▼"; 
  color: #66BB6A;
  font-weight: bold;
}

/* Fullscreen styling */
:fullscreen .leaderboard-wrapper {
  background: #1d1d1d;
  max-width: none;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  border-radius: 0;
}

:fullscreen .leaderboard-title {
  font-size: 3rem;
}

:fullscreen .leaderboard-table {
  font-size: 1.5rem;
}

:fullscreen .leaderboard-table th {
  padding: 1.5rem 2rem;
  font-size: 1.25rem;
}

:fullscreen .leaderboard-table td {
  padding: 1.25rem 2rem;
}

:fullscreen .leaderboard-btn {
  font-size: 1.25rem;
  padding: 0.875rem 1.75rem;
}

