/* Quake color codes */
.qc0 {
  color: black !important;
}
.qc1 {
  color: red !important;
}
.qc2 {
  color: lime !important;
}
.qc3 {
  color: yellow !important;
}
.qc4 {
  color: blue !important;
}
.qc5 {
  color: cyan !important;
}
.qc6 {
  color: magenta !important;
}
.qc7 {
  color: white !important;
}
.qc8 {
  color: orange !important;
}
.qc9 {
  color: cornflowerblue !important;
}

.navbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  position: relative;
  border-bottom: 2px solid transparent; /* reserve space */
  transition: color 0.2s ease;
}

.navbar .nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background-color: #0d6efd; /* Bootstrap primary blue */
  transition: width 0.25s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: #fff;
}

.navbar .nav-link:hover::after,
.navbar .nav-link:focus::after {
  width: 100%; /* grows from center to full width */
}

.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer small span:not(:first-child)::before {
  content: "▪";
  margin: 0 6px;
  color: #999;
  font-size: 0.7rem;
  opacity: 0.6;
}

#last-updated {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

#viewer-count {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

/* === Layout container for cards === */
.server-cards-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* keeps them centered */
  gap: 1rem; /* fixed, predictable gap */
}

.server-card {
  flex: 1 1 300px; /* grow if needed, shrink if needed, base size 300px */
  max-width: 300px; /* don’t grow beyond this */
  height: 500px;
  display: flex;
  flex-direction: column;
  background-color: rgba(30, 30, 30, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}
.server-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.server-card .card-header {
  border-bottom: none;
}

.server-card .card-body {
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.05),
    rgba(0, 0, 0, 0.2)
  );
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 0 8px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card {
  background-color: rgba(50, 50, 50, 0.7) !important;
}

/* Title bar */
.card-header {
  background: linear-gradient(90deg, #222, #333);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  text-align: center;
  letter-spacing: 1px;
}

.server-name {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
}

.server-address {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-top: 2px;
}

/* Badges */
.badge-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.badge-row .badge {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 4px !important;
  padding: 0.25rem 0.5rem !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #eee !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.badge-row .badge.badge-offline {
  color: #dc3545 !important;
  background: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.4) !important;
}

/* Map thumbnail */
.map-thumbnail {
  aspect-ratio: 16 / 9;
  height: 150px;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
}
.map-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}
.map-thumbnail img.loaded {
  opacity: 1;
}

/* Player list */
.player-list {
  flex: 1;
  overflow-y: auto;
  max-height: 200px; /* adjust to fit inside card */
  color: white;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.4;
}
.player-list:empty {
  display: none;
}

/* Discord toggle */
#discord-toggle.hidden {
  display: none;
}
#discord-toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Slide-out panel */
#discord-panel {
  position: fixed;
  top: 0;
  right: -400px; /* hidden by default */
  width: 400px;
  height: 100%;
  background: #2c2f33;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.5);
  transition: right 0.3s ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
}
#discord-panel.open {
  right: 0;
}
.panel-header {
  background: #23272a;
  color: #fff;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#discord-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}
iframe {
  flex: 1;
}

/* === Scrollbars === */
html {
  scrollbar-gutter: stable;
}

html,
body {
  scrollbar-width: thin;
  scrollbar-color: #555 #1e1e1e;
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 6px;
  border: 2px solid #1e1e1e;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}

/* === Accessibility: Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  .server-card:hover {
    transform: none;
  }
  .map-thumbnail img {
    transition: none;
  }
}

/* === Typography polish === */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.slide-down {
  animation: slideDown 0.5s ease-out;
}
