/* leaderboard.css */

.leaderboard-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

.leaderboard-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  padding: 20px;
}

.back-btn {
  text-decoration: none;
  color: rgb(239, 68, 68);
  font-weight: bold;
  font-size: 16px;
  padding: 8px 16px;
  border: 2px solid rgb(239, 68, 68);
  border-radius: 6px;
  transition: all 0.2s;
  position: absolute;
  right: 20px;
  top: 30px;
}

.back-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
}

td {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  font-size: 15px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background-color: #f8fafc;
}

/* Rank column styling */
td:first-child {
  font-weight: bold;
  color: #64748b;
  width: 60px;
  text-align: center;
}

th:first-child {
  text-align: center;
}

/* Top 3 Ranks */
tr:nth-child(1) td:first-child {
  color: #eab308; /* Gold */
  font-size: 1.2em;
}

tr:nth-child(2) td:first-child {
  color: #94a3b8; /* Silver */
  font-size: 1.1em;
}

tr:nth-child(3) td:first-child {
  color: #b45309; /* Bronze */
  font-size: 1.1em;
}

/* Comment column */
td:nth-child(4) {
  color: #64748b;
  font-style: italic;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading-text {
  text-align: center;
  padding: 40px;
  color: #64748b;
  font-style: italic;
}

@media (max-width: 600px) {
  .back-btn {
    position: static;
    display: inline-block;
    margin-top: 10px;
  }

  .header {
    flex-direction: column;
    gap: 10px;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none; /* Hide comment and date on mobile */
  }

  .leaderboard-container {
    padding: 0 10px;
    margin: 20px auto;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .back-btn {
    position: static;
    display: block;
    width: fit-content;
    margin: 0 auto 20px;
  }
}
