/* ladder.css */

/* ─── SEASON TABS ─────────────────────────────────────── */
.season-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.season-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75em 1.8em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--steel);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--gold-light); }
.tab-btn.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

/* ─── LADDER CONTROLS ─────────────────────────────────── */
.ladder-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 180px;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.55em 1em;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: rgba(245,237,216,0.05);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.search-box:focus { border-color: var(--gold); }
.search-box::placeholder { color: var(--steel-light); }

.sort-select {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6em 1em;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.entry-count {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel-light);
  margin-left: auto;
}

/* ─── LADDER TABLE ────────────────────────────────────── */
.ladder-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.ladder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.ladder-table thead {
  background: var(--ink);
}
.ladder-table th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-light);
  padding: 0.9em 1.1em;
  text-align: left;
  font-weight: 400;
  border-bottom: 1px solid rgba(201,150,42,0.3);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.ladder-table th:hover { color: var(--gold-light); }
.ladder-table th .sort-icon { margin-left: 0.3em; opacity: 0.4; }
.ladder-table th.sorted .sort-icon { opacity: 1; }

.ladder-table tbody tr {
  border-bottom: 1px solid rgba(201,150,42,0.12);
  transition: background 0.15s;
}
.ladder-table tbody tr:hover { background: rgba(201,150,42,0.05); }
.ladder-table tbody tr:last-child { border-bottom: none; }

.ladder-table td {
  padding: 0.85em 1.1em;
  vertical-align: middle;
}

/* rank column */
.col-rank { width: 60px; text-align: center; }
.rank-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.rank-1 .rank-num { color: #f0c060; }
.rank-2 .rank-num { color: #d8dde5; }
.rank-3 .rank-num { color: #e08a5a; }

.rank-medal {
  font-size: 1.2rem;
  display: block;
}

/* username */
.col-username { min-width: 140px; }
.username-cell {
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.username-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}
.username-text { font-weight: 700; color: var(--text); font-size: 1.02rem; }

/* stats */
.col-wins .stat { color: #6fcf75; font-weight: 700; }
.col-losses .stat { color: #ff7b6b; font-weight: 700; }
.col-points { min-width: 90px; }
.points-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold-light);
}

/* tournament wins */
.col-tw { text-align: center; }
.tw-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  background: rgba(201,150,42,0.18);
  border: 1px solid rgba(201,150,42,0.45);
  border-radius: 2px;
  padding: 0.2em 0.6em;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--gold-light);
  font-weight: 700;
}
.tw-badge.zero {
  background: transparent;
  border-color: transparent;
  color: var(--steel-light);
  font-weight: 400;
}

/* empty state */
.ladder-empty {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--steel-light);
  font-style: italic;
}

/* ─── RECENT MATCHES ──────────────────────────────────── */
.recent-matches {
  margin-top: 3rem;
}
.recent-matches-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(201,150,42,0.3);
}

.matches-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.match-card {
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color 0.15s;
}
.match-card:hover { border-color: rgba(201,150,42,0.45); }

.match-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.match-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-time {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--steel-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.match-meta {
  font-size: 0.75rem;
  color: var(--steel-light);
  letter-spacing: 0.05em;
}

.match-players {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.match-group-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--steel-light);
  margin-top: 0.3rem;
}
.match-group-label:first-child { margin-top: 0; }

.match-player {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.88rem;
  padding: 0.2em 0;
}
.match-player .icon {
  width: 1em;
  display: inline-block;
  text-align: center;
  font-size: 0.9em;
}
.match-player.winner { color: var(--gold-light); font-weight: 700; }
.match-player.loser  { color: var(--steel-light); }
.match-player .ai-tag {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(201,150,42,0.15);
  border: 1px solid rgba(201,150,42,0.3);
  border-radius: 2px;
  padding: 0.1em 0.4em;
  color: var(--steel-light);
  margin-left: 0.3em;
}

.matches-empty {
  padding: 2rem;
  text-align: center;
  color: var(--steel-light);
  font-style: italic;
  grid-column: 1 / -1;
}

/* ─── REGISTER CTA ────────────────────────────────────── */
.register-cta {
  margin-top: 2.5rem;
  padding: 2rem 2.5rem;
  background: var(--ink);
  border: 1px solid rgba(201,150,42,0.3);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.register-cta-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}
.register-cta-sub { color: var(--parchment-dark); font-size: 0.9rem; font-style: italic; }

/* ─── TOP-3 PODIUM ────────────────────────────────────── */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding: 1.5rem 0 0;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.podium-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
  font-weight: 700;
}
.podium-place:nth-child(1) .podium-avatar { border-color: #9ca3af; order: -1; }
.podium-place:nth-child(2) .podium-avatar { border-color: #c9962a; width: 60px; height: 60px; font-size: 1.2rem; }
.podium-place:nth-child(3) .podium-avatar { border-color: #b57241; }

.podium-name { font-size: 0.95rem; font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.podium-pts {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.08em;
}
.podium-block {
  border-radius: 2px 2px 0 0;
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.podium-place:nth-child(1) .podium-block { height: 50px; background: #718096; }
.podium-place:nth-child(2) .podium-block { height: 80px; background: var(--gold); color: var(--ink); }
.podium-place:nth-child(3) .podium-block { height: 36px; background: #b57241; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 600px) {
  .register-cta { flex-direction: column; }
  .ladder-controls { flex-direction: column; align-items: stretch; }
  .entry-count { margin-left: 0; }
  .podium { gap: 0.25rem; }
  .podium-block { width: 52px; }
}
