/* rankings.css — Player Rankings page styles */

/* ── Controls: search bar + rank-mode tabs ─────────────────────── */
.rk-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.rk-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-dim);
  transition: border-color 0.2s;
}
.rk-search:focus-within {
  border-color: var(--purple-light);
}

.rk-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
}
.rk-search input::placeholder {
  color: var(--text-dim);
}

.rk-search-clear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.2s;
}
.rk-search-clear:hover {
  color: var(--text);
}

.rk-controls-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.rk-view-toggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 12px var(--purple-glow);
}
.view-btn:focus-visible {
  outline: 2px solid var(--purple-light);
  outline-offset: 2px;
}

.rankings-filter-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.filter-tab {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  cursor: pointer;
}
.filter-tab.active {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 12px var(--purple-glow);
}

/* ── Rank groups ────────────────────────────────────────────────── */
#rankings-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rk-group {
  --band: var(--purple);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--band);
  border-radius: 8px;
  overflow: hidden;
}

.rk-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--band) 55%, var(--surface-2));
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}
.rk-group-header:hover {
  background: color-mix(in srgb, var(--band) 70%, var(--surface-2));
}
.rk-group-header:focus-visible {
  outline: 2px solid var(--purple-light);
  outline-offset: -2px;
}

.rk-group-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.rk-chevron {
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.rk-group.is-collapsed .rk-chevron {
  transform: rotate(-90deg);
}

/* Collapse animation: grid-row 1fr → 0fr */
.rk-group-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.25s ease;
}
.rk-group-body > .rk-group-players {
  min-height: 0;
  overflow: hidden;
  transition: padding 0.25s ease;
}
.rk-group.is-collapsed .rk-group-body {
  grid-template-rows: 0fr;
}
.rk-group.is-collapsed .rk-group-players {
  padding-top: 0;
  padding-bottom: 0;
}

.rk-group-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--purple-bright);
  background: var(--purple-dim);
  border-radius: 10px;
  padding: 2px 10px;
}

.rk-group-header .rk-group-count {
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
}

.rk-group-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 16px 20px;
}

.rk-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  transition: border-color 0.2s, background 0.2s;
}
.rk-card:hover {
  border-color: var(--purple-light);
  background: var(--purple-dim);
}

.rk-card-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 2v2 mode accent variant ────────────────────────────────────────
   Subtle red-shifted nudge of the purple accent (hue +~10°) used for
   rank group headers/borders, count badges, and card hover glow while
   the 2v2 view is active. Scoped to the rankings container only — the
   filter-tab active state stays the default purple. */
.rankings-2v2 {
  --purple:        #932FBE;
  --purple-light:  #B351E0;
  --purple-bright: #C355F7;
  --purple-glow:   rgba(147, 47, 190, 0.4);
  --purple-dim:    rgba(147, 47, 190, 0.15);
  --border:        rgba(147, 47, 190, 0.25);
}

/* Column view: let the page container use the full screen width.
   Scoped with :has() so it only applies while column view is active,
   and only on this page (rankings.css is loaded on rankings.html only). */
.wrap:has(#rankings-container.view-columns) {
  max-width: none;
}

/* ── Column view ────────────────────────────────────────────────── */
.rk-columns-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
}

.rk-columns {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(96px, 1fr));
  gap: 1px;
  background: var(--border); /* 1px gaps act as grid lines */
}

.rk-cols-head-scroll {
  overflow: hidden;
}

.rk-cols-body-scroll {
  overflow-x: auto;
}

.rk-cols-topbar {
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.rk-cols-topbar.is-hidden {
  display: none;
}
.rk-cols-topbar-inner {
  height: 1px;
}

.rk-cols-topbar,
.rk-cols-body-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--purple) var(--surface-2);
}
.rk-cols-topbar::-webkit-scrollbar,
.rk-cols-body-scroll::-webkit-scrollbar {
  height: 8px;
}
.rk-cols-topbar::-webkit-scrollbar-track,
.rk-cols-body-scroll::-webkit-scrollbar-track {
  background: var(--surface-2);
}
.rk-cols-topbar::-webkit-scrollbar-thumb,
.rk-cols-body-scroll::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 4px;
}

.rk-col-band,
.rk-col-head {
  --band: var(--purple);
}

.rk-col-band {
  background: var(--band);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 8px 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.rk-col-band.is-empty {
  background: var(--surface-2);
}

.rk-col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 12px 4px 8px;
  background: color-mix(in srgb, var(--band) 55%, var(--surface-2));
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.rk-col-count {
  position: absolute;
  top: 3px;
  right: 5px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  line-height: 1;
  opacity: 0.75;
}

.rk-col-list {
  background: var(--surface-1);
  padding: 6px 0;
}

.rk-col-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rk-col-name:hover {
  background: var(--purple-dim);
}

.rk-empty {
  text-align: center;
  padding: 50px 20px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ── Mobile overrides ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .rk-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .rk-search {
    max-width: none;
  }
  .rankings-filter-tabs {
    justify-content: stretch;
  }
  .filter-tab {
    flex: 1;
    text-align: center;
  }
  .rk-group-players {
    grid-template-columns: 1fr;
  }
  .rk-controls-left {
    width: 100%;
  }
  .rk-search {
    flex: 1;
  }
  .rk-columns {
    grid-template-columns: repeat(var(--cols), 110px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rk-search,
  .rk-search-clear,
  .rk-card,
  .rk-group-header,
  .rk-chevron,
  .rk-group-body,
  .rk-group-players,
  .view-btn {
    transition: none;
  }
}
