/* Center Best Score and Attempts columns, keep Name left-aligned */

/* Target the score & attempts header and cells */
.leaderboard-table th.leaderboard-score,
.leaderboard-table td.leaderboard-score,
.leaderboard-table th.leaderboard-attempts,
.leaderboard-table td.leaderboard-attempts {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  /* Optional: set a fixed-ish width so columns look centered and consistent */
  width: 140px;
  padding-left: 12px;
  padding-right: 12px;
}

/* Keep the name column readable and left-aligned */
.leaderboard-table th.leaderboard-name,
.leaderboard-table td.leaderboard-name {
  text-align: left;
  min-width: 280px;
  max-width: 300px; /* Prevent extremely long usernames from breaking layout */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* If you want the header labels to visually center inside their cells */
.leaderboard-table thead th {
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* Small-screen adjustments */
@media (max-width: 720px) {
  .leaderboard-table th.leaderboard-score,
  .leaderboard-table td.leaderboard-score,
  .leaderboard-table th.leaderboard-attempts,
  .leaderboard-table td.leaderboard-attempts {
    width: 90px;
    font-size: 13px;
  }
  
  /* Allow header text to wrap on smaller screens */
  .leaderboard-table th.leaderboard-score,
  .leaderboard-table th.leaderboard-attempts {
    white-space: normal;
    line-height: 1.2;
    padding: 8px 6px;
  }

  .leaderboard-table th.leaderboard-name,
  .leaderboard-table td.leaderboard-name {
    min-width: 160px;
  }
}

/* Extra small screens - even more compact */
@media (max-width: 480px) {
  .leaderboard-table th.leaderboard-score,
  .leaderboard-table td.leaderboard-score,
  .leaderboard-table th.leaderboard-attempts,
  .leaderboard-table td.leaderboard-attempts {
    width: 70px;
    font-size: 11px;
    padding: 6px 4px;
  }
  
  .leaderboard-table th.leaderboard-score,
  .leaderboard-table th.leaderboard-attempts {
    white-space: normal;
    word-break: break-word;
  }
}

/* User Statistics Table Styling - Dark Mode */
.user-stats-section {
  margin: 2rem 0 3rem;
}

.user-stats-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
}

.user-stats-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(17, 24, 39, 0.95);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(59, 158, 206, 0.2);
}

.user-stats-table thead {
  background: linear-gradient(135deg, rgba(59, 158, 206, 0.3) 0%, rgba(42, 125, 168, 0.3) 100%);
  border-bottom: 2px solid rgba(59, 158, 206, 0.4);
}

.user-stats-table th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: #f1f5f9;
}

.user-stats-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  color: #cbd5e1;
}

.user-stats-table tbody tr {
  transition: background 0.2s ease;
}

.user-stats-table tbody tr:hover {
  background: rgba(59, 158, 206, 0.08);
}

.user-stats-table tbody tr.rank-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, transparent 100%);
  border-left: 3px solid #ffd700;
}

.user-stats-table tbody tr.rank-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, transparent 100%);
  border-left: 3px solid #c0c0c0;
}

.user-stats-table tbody tr.rank-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, transparent 100%);
  border-left: 3px solid #cd7f32;
}

/* Center numeric columns */
.user-stats-table th:first-child,
.user-stats-table td:first-child,
.user-stats-table th:nth-child(3),
.user-stats-table td:nth-child(3),
.user-stats-table th:nth-child(4),
.user-stats-table td:nth-child(4),
.user-stats-table th:nth-child(5),
.user-stats-table td:nth-child(5),
.user-stats-table th:nth-child(6),
.user-stats-table td:nth-child(6),
.user-stats-table th:nth-child(7),
.user-stats-table td:nth-child(7) {
  text-align: center;
}

/* Username column stays left-aligned */
.user-stats-table th:nth-child(2),
.user-stats-table td:nth-child(2) {
  text-align: left;
  font-weight: 500;
  color: #7fd4ff;
}

/* Tablet and smaller */
@media (max-width: 900px) {
  .user-stats-table th,
  .user-stats-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
  
  .user-stats-table th {
    font-size: 0.8rem;
  }
}

/* Mobile - hide less important columns */
@media (max-width: 640px) {
  .user-stats-table th:nth-child(4),
  .user-stats-table td:nth-child(4),
  .user-stats-table th:nth-child(5),
  .user-stats-table td:nth-child(5) {
    display: none; /* Hide Modules and Sections columns on mobile */
  }
  
  .user-stats-table th,
  .user-stats-table td {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
  }
  
  .user-stats-table th {
    font-size: 0.75rem;
    padding: 0.75rem 0.4rem;
  }
}

/* Extra small mobile */
@media (max-width: 420px) {
  .user-stats-table th:nth-child(3),
  .user-stats-table td:nth-child(3) {
    display: none; /* Also hide Total Exams on very small screens */
  }
  
  .user-stats-table th,
  .user-stats-table td {
    padding: 0.6rem 0.3rem;
    font-size: 0.75rem;
  }
}
