/* General page styles */
body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  background: #f8f9fa;
  color: #222;
}

/* Header styling */

header#bannerHeader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .25em 0;
  background-color: #001f4d;
  border-bottom: 1px solid #ccc;
}

header#bannerHeader img {
  max-width: 300px;
  width: 100%;
  height: auto;
  display: block;
}

header#bannerHeader .subtitle {
  margin-top: 0.5em;
  font-size: 1.1em;
  color: #f2f3f5;
  font-weight: bold;
  text-align: center;
}

header h1 {
  font-size: 1.8em;
  margin: 0;
  letter-spacing: 1px;
}

header h2 {
  font-size: 1em;
  font-weight: normal;
  margin-top: 0.5em;
}

/* Filter controls */
.filters {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  padding: 1em;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filters label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
}

.filters select,
.filters button {
  padding: 0.5em;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-top: 0.25em;
}

.filters button {
  background-color: #001f4d;
  color: white;
  border: none;
  cursor: pointer;
}

.filters button:hover {
  background-color: #003377;
}

/* Leaderboard table */
.leaderboard {
  display: block;
  margin: 0 auto 1em auto;
  max-width: 300px;
  gap: .75em;
  padding: 1em;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.leaderboard h3 {
  margin-top: 0em;
  margin-bottom: .75em;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th,
td {
  padding: 0.25em;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

thead {
  background-color: #f1f1f1;
  font-weight: bold;
}

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

/* Responsive tweaks */
@media (min-width: 600px) {
  .filters {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filters label {
    flex: 1;
    margin-right: 1em;
  }
}

/* === New styles for Position/Rank columns and medal colors === */

/* Narrow Position/Rank column & center text for both Overall and Track tables */
.leaderboard>table th:first-child,
.leaderboard>table td:first-child {
  width: 3em;
  text-align: center;
  font-weight: bold;
}

/* Medal display: use emoji rendered by JS; clear default backgrounds */
.leaderboard>table tbody tr:nth-child(1) td:first-child,
.leaderboard>table tbody tr:nth-child(2) td:first-child,
.leaderboard>table tbody tr:nth-child(3) td:first-child {
  background: none;
  color: inherit;
}

/* Styling for emoji medals */
.medal {
  font-size: 1.15em;
  line-height: 1;
}

/* small medal icon next to player names */
.medal-icon {
  font-size: 1.05em;
  margin-right: 0.4em;
  vertical-align: middle;
}

/* ensure rank column stays numeric and unobtrusive */
.leaderboard>table td:first-child {
  background: none;
  font-weight: bold;
}

/* Track search container positioning */
#trackFilters {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 1em auto;
}

/* Search input styling */
#trackSearch {
  width: 100%;
  font-size: 1.2rem;
  padding: 12px 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

/* Dropdown list styling as minimal dropdown */
#trackList {
  position: absolute;
  width: 100%;
  left: 0;
  top: 100%;
  margin: 0;
  border: 1px solid #ccc;
  border-top: none;
  /*border-radius: 0 0 6px 6px;*/
  background: white;
  max-height: 200px;
  max-width: 300px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  display: none;
}

#trackList li {
  padding: 8px 16px;
  cursor: pointer;
  list-style: none;
}

#trackList li:hover {
  background-color: #f0f0f0;
}

.track-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  box-sizing: border-box;
}

#toggleOverallBtn {
  margin: 1em;
  background-color: #001f4d;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#toggleOverallBtn:hover {
  background-color: #003377;
}

#trackStandings {
  display: none;
  padding: 1em;
}

#trackStandings table {
  margin-bottom: 2em;
}

.button-container {
  display: flex;
  justify-content: center;
  margin: 1em 0;
}

.spinner-container {
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 2em;
  font-size: 1.1rem;
  color: #001f4d;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top: 4px solid #001f4d;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1em;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}