/* General page styling */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: rgb(200, 200, 200);
  color: #333;
  min-height: 100vh;
}

/* Header */
header {
  background: rgb(211, 47, 27);
  color: white;
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
}

p {
  font-size: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tabs button {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px 8px 0 0;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tabs button.active {
  background: rgb(211, 47, 27);
  color: #fff;
}

.tabs button:hover:not(.active) {
  background: #b53921;
  color: #fff;
}

/* Main content */
main {
  padding: 1rem 2rem;
  max-width: 900px;
  margin: auto;
}

/* Controls (dropdown + search) */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

select,
#monthSelect {
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
  transition: all 0.2s ease;
  background: #fff;
}

select:focus,
#monthSelect:focus {
  border-color: rgb(211, 47, 27);
  box-shadow: 0 0 5px rgba(211, 47, 27, 0.4);
}

/* Search wrapper */
.search-wrapper {
  display: flex;
  max-width: 600px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ccc;
}

/* Search inputs */
#searchInput, #lbSearchInput {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 8px 0 0 8px;
  font-size: 1rem;
  border: none;
  outline: none;
}

/* Search buttons */
#searchButton, #lbSearchButton {
  padding: 0 1rem;
  font-size: 1rem;
  border: none;
  background: rgb(211, 47, 27);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#searchButton:hover:enabled, #lbSearchButton:hover:enabled {
  background: rgb(180, 40, 25);
}

#searchButton:disabled, #lbSearchButton:disabled {
  background: #999;       /* grey when disabled */
  cursor: not-allowed;
}

/* Clear buttons */
#clearButton, #lbClearButton {
  padding: 0 1rem;
  font-size: 1rem;
  border: none;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#clearButton:hover, #lbClearButton:hover {
  background: #fff;
}

/* Loading text */
.loading {
  display: none;
  margin: 1rem 0;
  font-weight: 500;
  color: #333;
}

/* Results container */
.results {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  overflow-x: auto;
  color: #333;
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 200px;
}

td {
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

td.rank {
  width: 1%;
  padding: 10px 0px 10px 12px;
}

td.username {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.points {
  width: 1%;          /* shrink as much as possible */
  white-space: nowrap; /* prevent wrapping */
  text-align: right;  /* align numbers right */
  padding: 10px 12px 10px 0px;
}

td.change {
  width: 1%;
  padding: 10px 4px 10px 2px;
  text-align: right;
}

th {
  padding: 10px 12px;
  text-align: left;
  background-color: rgb(211, 47, 27);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

th.rank {
  width: 1%;
  padding: 10px 0px 10px 12px;
}

th.change {
  width: 1%;
  padding: 10px 0px 10px 0px;
  text-align: right;
}

th.points {
  width: 1%;          /* shrink as much as possible */
  white-space: nowrap; /* prevent wrapping */
  text-align: right;  /* align numbers right */
  padding: 10px 12px 10px 0px;
}

tr:nth-child(even) {
  background-color: #f9f9f9;
}

tr:hover {
  background-color: rgba(211, 47, 27, 0.1);
}

/* Description under leaderboard title */
.description {
  background: rgba(211, 47, 27, 0.05);
  border-left: 4px solid rgb(211, 47, 27);
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Responsive font size tweaks */
@media (max-width: 768px) {
  table {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  main {
  padding: 1rem 1rem;
  }
  table {
    font-size: 0.65rem;
  }
  .results {
    padding: 1rem;
  }
  p {
    font-size: 0.8rem;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrapper {
    max-width: 100%;
  }
}
