/* Dark mode global styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background-color: #121212;
  color: #e0e0e0;
}

/* Top bar for navigation */
.top-bar {
  background-color: #1f1f1f;
  color: #e0e0e0;
  display: flex;
  justify-content: center !important;
  align-items: center !important;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
}

.logo {
  position: absolute;
  left: 1rem;
}

.site-logo {
  height: 40px;
  width: auto;
  display: block;
}

/* Update banner */
.update-banner {
  background: linear-gradient(135deg, #1e90ff, #0078d7);
  color: white;
  padding: 12px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(30, 144, 255, 0.3);
}

.update-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}

.update-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.update-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.update-dismiss {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.update-dismiss:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive banner */
@media (max-width: 768px) {
  .update-content {
    flex-direction: column;
    gap: 8px;
  }
  .update-text {
    font-size: 13px;
    text-align: center;
  }
}

/* Navigation */
.nav {
  display: flex;
  gap: 30px;
}

.nav a {
  color: #e0e0e0;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.nav a:hover {
  background-color: #333;
}

.nav a.active {
  background-color: #1e90ff;
  font-weight: 500;
  color: white;
}

/* Buttons */
button {
  padding: 10px 16px;
  background-color: #1e90ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin: 4px;
}

button:hover {
  background-color: #0078d7;
}

button.upload-button {
  background-color: #1e90ff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-top: 0 !important;
  height: 48px !important;
}

button.upload-button:hover {
  background-color: #0074d9;
}

/* Checkbox styling */
input[type="checkbox"] {
  margin-right: 8px;
}

.copy-button {
  top: 3px;
  position: relative;
  font-size: 10px;
}

/* Links */
a {
  color: #1e90ff;
}

a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  .detail-wrapper {
    flex-direction: column;
  }
  .medal-panel {
    margin-top: 10px;
  }
  .search-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-input {
    flex: 1 1 100%;
  }
  .filter-select {
    flex: 1 1 auto;
  }
  .choices {
    flex: 1 1 100%;
  }
  button.upload-button {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

/* Filter select */
.filter-select {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  height: 48px !important;
  min-width: 120px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Choices.js styling */
.choices {
  margin-bottom: 0;
}

.choices__inner {
  background-color: #1e1e1e;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 5px 8px;
  min-height: 38px;
}

.choices__list--dropdown {
  background-color: #1e1e1e;
  border: 1px solid #333;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.choices__list--dropdown .choices__item--selectable {
  color: #e0e0e0;
  padding: 8px 12px;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background-color: #2a2a2a;
}

.choices__list--multiple .choices__item {
  background-color: #026fc2;
  border: none;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  color: white;
  margin-right: 6px;
  margin-bottom: 3px;
}

.choices__list--multiple .choices__item.is-highlighted {
  background-color: #026fc2;
  opacity: 0.9;
}

.choices__input {
  background-color: transparent;
  color: #e0e0e0;
  font-size: 14px;
}

.choices__placeholder {
  opacity: 0.7;
  color: #999;
}

.choices__button {
  border-left: none;
  padding-left: 4px;
  opacity: 0.7;
}

.choices__button:hover {
  opacity: 1;
}

.is-open .choices__inner {
  border-radius: 4px 4px 0 0;
  border-color: #444;
}

.choices[data-type*="select-multiple"] .choices__inner {
  padding-top: 3px;
  padding-bottom: 3px;
}

/* Category chooser */
.category-chooser {
  background-color: #1f1f1f;
  border: 1px solid #333;
  border-radius: 4px;
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, border-width 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.category-chooser.is-active {
  max-height: 200px;
  border-width: 1px;
  overflow-y: auto;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background-color: #fff;
  border-radius: 4px;
  margin-top: 8px;
}

#categorySelector {
  background-color: #fff;
  border-radius: 4px;
  max-width: 600px;
}

.category-pill {
  background-color: #026fc2;
  color: white;
  border-radius: 16px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.category-pill .close-icon {
  margin-left: 6px;
  cursor: pointer;
  opacity: 0.7;
}

.category-pill .close-icon:hover {
  opacity: 1;
}

.category-pill .close-icon {
  margin-left: 6px;
  cursor: pointer;
  opacity: 0.7;
}

.category-pill .close-icon:hover {
  opacity: 1;
}

/* Search row */
.search-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 auto 20px auto;
  max-width: 1200px;
  padding: 0 20px;
}

.search-input {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  height: 30px !important;
  flex: 1;
}

/* Player search */
.player-search {
  margin-top: 5px;
}

.player-search .search-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 0 auto 20px auto;
  max-width: 600px;
  padding: 0 20px;
}

.player-search .search-input {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  height: 30px !important;
  flex: 0 0 250px;
}

.player-search .upload-button {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* Map preview */
.map-preview {
  margin-top: 10px;
}

.map-preview img {
  max-width: 200px;
  max-height: 150px;
  border: 1px solid #444;
  border-radius: 4px;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.map-preview img:hover {
  border-color: #1e90ff;
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .map-preview img {
    max-width: 150px;
    max-height: 112px;
  }
}

/* Preview modal */
.preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 9999 !important;
  cursor: pointer !important;
  overflow: hidden !important;
}

.preview-modal .modal-content {
  max-width: 90vw !important;
  max-height: 90vh !important;
  width: auto !important;
  height: auto !important;
  position: relative !important;
  overflow: auto !important;
}

.preview-modal .modal-content img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  object-fit: contain !important;
  display: block !important;
}

.preview-modal .close-button {
  position: absolute !important;
  top: -40px !important;
  right: 0 !important;
  color: white !important;
  font-size: 30px !important;
  cursor: pointer !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: bold !important;
  z-index: 10000 !important;
}

.preview-modal .map-name-label {
  position: absolute !important;
  top: -40px !important;
  left: 0 !important;
  color: white !important;
  font-size: 16px !important;
  font-weight: bold !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  padding: 8px 12px !important;
  border-radius: 4px !important;
  z-index: 10000 !important;
}

.preview-modal * {
  box-sizing: border-box !important;
}

.preview-modal .modal-content * {
  box-sizing: border-box !important;
}

/* Info banners */
.info-banner {
  background-color: #202a36;
  color: #fff;
  padding: 10px 20px;
  border-left: 5px solid #1e90ff;
  margin-bottom: 1px;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 14px;
}

.banner-content-speed,
.banner-content-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.banner-icon-speed,
.banner-icon-jump {
  font-size: 18px;
}

.banner-text-speed strong,
.banner-text-jump strong {
  color: #1e90ff;
  margin-right: 4px;
}

#jumpBanner {
  border-left-color: #2ecc71;
}

/* Leaderboard tabs */
.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.leaderboard-tabs button {
  padding: 8px 16px;
  background-color: #2b2b2b;
  color: #e0e0e0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.leaderboard-tabs button.active {
  background-color: #1e90ff;
  color: white;
  font-weight: bold;
}

/* Records container */
.records-container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 0;
  max-width: 1200px;
  margin: 0 auto;
}

.table-wrapper {
  flex: 2;
  overflow-x: auto;
}

.table-container {
  margin: 0 auto;
  padding-top: 10px;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  background-color: #1f1f1f;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  border-radius: 4px;
  table-layout: fixed;
}

.table-container table th,
.table-container table td {
  font-size: 0.8rem;
  padding: 4px 6px;
  line-height: 1.1;
  height: 20px;
  border-bottom: 1px solid #444;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.table-container table th {
  background-color: #2b2b2b;
  font-weight: bold;
}

.table-container table tr:hover {
  background-color: #2a2a2a;
}

/* Maps table column widths */
#mapsTable th.difficulty-col,
#mapsTable td.difficulty-col,
#mapsTable th.balls-col,
#mapsTable td.balls-col {
  width: 10%;
}

#mapsTable td.map-name,
#jumpsTable td.map-name {
  max-width: 600px;
}

#playerRunsContainer,
#completionContainer {
  padding: 0;
}

.map-name {
  cursor: pointer;
  color: #1e90ff;
  font-weight: bold;
}

.detail {
  display: inline-block;
  background-color: #1e1e1e;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 5px;
  margin-top: 5px;
  max-width: 400px;
}

/* Leaderboard page */
#leaderboardPage {
  display: none;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

#leaderboardContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.leaderboard-section {
  min-width: 220px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #1f1f1f;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

#leaderboardPage table th,
#leaderboardPage table td {
  font-size: 0.7rem;
  padding: 3px 4px;
  line-height: 1.1;
  height: 20px;
  border-bottom: 1px solid #444;
  text-align: left;
}

#leaderboardPage table th {
  background-color: #2b2b2b;
  font-weight: bold;
}

#leaderboardPage table tr:hover {
  background-color: #2a2a2a;
}

/* Detail wrapper */
.detail-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.left-detail {
  border: 1px solid #333;
  padding: 10px;
  border-radius: 5px;
  min-width: 200px;
  background-color: #1e1e1e;
}

.medal-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.medal-link {
  text-decoration: none;
}

.medal-row {
  display: flex;
  align-items: center;
  padding: 5px;
  border-radius: 5px;
  border: 1px solid;
  margin-bottom: 5px;
  background-color: #1e1e1e;
}

.medal-label {
  font-weight: bold;
  margin-right: 8px;
}

.medal-time {
  padding: 2px 5px;
  border-radius: 5px;
}

.capping-player-quote {
  font-style: italic;
  margin-top: 5px;
  color: #888;
}

/* Player summary */
#playerSummary {
  text-align: center;
  padding: 10px 0;
}

#playerSummary h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: #e0e0e0;
}

#playerSummary p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #ccc;
}

#playerSummary a {
  color: #1e90ff;
  text-decoration: none;
}

#playerSummary a:hover {
  text-decoration: underline;
}

.player-summary-box {
  background-color: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px 24px;
  max-width: 600px;
  margin: 0 auto 0px auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  text-align: center;
}

.player-summary-box h2 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ff512f, #dd2476);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  letter-spacing: 1px;
  color: #e0e0e0;
}

.player-summary-box a {
  color: #1e90ff;
  text-decoration: none;
  font-weight: bold;
}

.player-summary-box a:hover {
  text-decoration: underline;
}

/* Summary grid */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-top: 12px;
  font-size: 0.95rem;
  color: #ddd;
}

.summary-grid span {
  font-weight: bold;
  color: #aaa;
}

/* Table header */
.table-container h2 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

/* Completion rows */
.completion-row {
  cursor: pointer;
}

.completion-row:hover {
  background-color: #333;
}

.completion-details .details-box {
  background-color: #222;
  color: #ddd;
  padding: 10px;
  border-radius: 6px;
}

/* Expanded details grid */
.details-grid {
  display: flex;
  gap: 20px;
  padding: 10px;
}

.details-left {
  flex: 0 0 300px;
}

.details-right {
  flex: 1;
}

/* Map preview styling (scoped to player page) */
.map-preview-player {
  margin-top: 10px;
  margin-bottom: 12px;
  text-align: right;
  flex: 0 0 280px;
}

.map-preview-player img {
  max-width: 280px !important;
  border-radius: 6px;
  border: 1px solid #333;
  display: inline-block;
  max-width: 100%;
}

/* Meta info below preview */
.map-meta-player {
  margin-bottom: 12px;
  flex: 1;
  font-size: 14px;
}

.map-meta-player p {
  margin: 6px 0;
}

/* Copy buttons */
.copy-preset,
.copy-mapid {
  margin-left: 8px;
  padding: 4px 10px;
  background-color: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.copy-preset:hover,
.copy-mapid:hover {
  background-color: #666;
}

/* View map link */
.view-map-link {
  display: inline-block;
  margin-top: 6px;
  color: #1e90ff;
  font-weight: bold;
  text-decoration: none;
}

.view-map-link:hover {
  text-decoration: underline;
}

/* Run list */
.run-block {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #444;
}

.run-list {
  background-color: #1a1a1a;
  border: 1px solid #333;
  padding: 10px;
  border-radius: 6px;
  margin-top: 12px;
}

.run-list h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #ccc;
}

.run-list p {
  margin: 6px 0;
  font-size: 14px;
}

/* Status indicators */
.loading-spinner {
  color: #aaa;
}

.error {
  color: #f66;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.85rem;
  margin-left: 6px;
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

.badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #e6a96c);
  color: #fff;
}

.badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffb700);
  color: #222;
}

/* Details flex box */
.details-box.details-flex {
  display: flex;
  gap: 20px;
  padding: 10px;
  background-color: #222;
  color: #ddd;
  border-radius: 6px;
}

/* Player link */
.player-link {
  color: #d0e2ff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.player-link:hover {
  border-bottom: 1px solid #d0e2ff;
}

.season-container {
  margin-bottom: 1.5em;
  text-align: center;
  background: transparent;
  padding: 0.5em 0;
  font-size: 0.85em;
  color: #ccc;                  /* light gray text for readability */
}

.season-header {
  font-weight: normal;
  font-size: 0.9em;
  color: #aaa;                  /* slightly lighter than divider */
  margin-bottom: 0.5em;
}

.season-card {
  display: inline-flex;
  align-items: center;
  margin: 0.25em 0.75em;
  opacity: 0.8;                  /* still faded, but visible */
  color: #ddd;                   /* lighter text for dark bg */
}

.season-icon {
  height: 1em;
  margin-right: 6px;
  opacity: 0.7;                  /* faded but visible */
  filter: brightness(1.2);       /* boost icon visibility on black */
}

.toggle-btn {
  background-color: rgba(30, 60, 120, 0.6); /* dark blue with transparency */
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85em;
  font-weight: 500;
  color: #ddd;               /* light text for dark background */
  cursor: pointer;
  transition: background-color 0.3s, opacity 0.3s;
}

.toggle-btn:hover {
  background-color: rgba(30, 60, 120, 0.8); /* slightly less transparent on hover */
  opacity: 1;                               /* brighten when hovered */
}

.toggle-btn:focus {
  outline: none;
}
