/* =========================================
   leaderboard.css (CLEAN, SINGLE SYSTEM)
   - PGA-style leaderboard cards
   - Max 3 columns grid (2 on medium, 1 on mobile)
   - Stronger contrast striping + hover
   - Supports: Leaderboard, Overall Results (podium), By-flight cards
   ========================================= */

:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #d8dde3;
  --line2: #eef1f4;

  --head: #f3f6f9;
  --stripe: #f7f9fb;
  --hover: #eef5ff;

  --leader: #e9f2ff;
  --top3: #f2f7ff;

  --card-border: #d4dbe3;
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial;
}

/* Keep your “site” padding behavior (you’ve been using this everywhere) */
body {
  padding: 20px;
}

/* Layout wrapper */
.wrap {
  max-width: 1300px;
  margin: 0 auto;
}

/* Pills/meta row */
.meta {
  opacity: 0.9;
  margin-top: 6px;
  margin-bottom: 18px;
  font-size: 0.9em;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #d5dde7;
  background: #eef3f8;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0b1320;
}

/* Sections (used by Overall + Daily pages too) */
.section {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.section > h2 {
  margin: 2px 0 12px;
  font-size: 0.95em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1f2937;
}

/* Grid of flight cards (MAX 3 columns) */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(340px, 1fr));
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }
}

@media (max-width: 740px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow: hidden; /* keeps header/rows clean */
}

/* Card title (flight label) */
.card h2,
.card h3 {
  margin: 0;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line2);
  font-size: 0.82em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1f2937;
}

/* Table */
.card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.card thead th {
  background: var(--head);
  color: #111;
  font-weight: 800;
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}

.card tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line2);
  vertical-align: middle;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card tbody tr:last-child td {
  border-bottom: 0;
}

/* Striping + hover */
.card tbody tr:nth-child(odd) td {
  background: #fff;
}
.card tbody tr:nth-child(even) td {
  background: var(--stripe);
}
.card tbody tr:hover td {
  background: var(--hover);
}

/* Standard columns */
.rank {
  width: 44px;
  text-align: right;
  padding-right: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta,
.count {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #111;
}

/* Row highlights */
.card tbody tr.is-leader td {
  background: var(--leader) !important;
}
.card tbody tr.is-top3 td {
  background: var(--top3) !important;
}
.card tbody tr.is-leader .rank,
.card tbody tr.is-leader .delta,
.card tbody tr.is-leader .count {
  color: #0b1a2a;
  font-weight: 900;
}

/* Utility */
.right {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.left {
  text-align: left !important;
}
.muted {
  color: var(--muted);
}

/* =========================================
   Overall Results: Podium cards
   ========================================= */

.podium {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 0.9rem;
  margin: 0.75rem 0 1.1rem;
  margin-top: 0.35rem;
}

@media (max-width: 720px) {
  .podium {
    grid-template-columns: 1fr;
  }
}

.podium-card {
  border: 1px solid rgba(144, 144, 144, 0.25);
  border-radius: 14px;
  background: #fff;
  padding: 0.95rem 1rem;
  box-shadow: var(--card-shadow);
}

.podium-card .podium-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.podium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.podium-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid rgba(144, 144, 144, 0.25);
  background: #f7f7f7;
}

.podium-name {
  font-size: 1.05rem;
  font-weight: 900;
  margin: 0.25rem 0 0.15rem;
  text-align: left;
}

.podium-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.podium-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

@media (max-width: 420px) {
  .podium-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.podium-stat {
  border: 1px solid rgba(144, 144, 144, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: #fbfbfb;
}

.podium-stat .label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
  font-weight: 700;
}

.podium-stat .value {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: left;
}

/* Champion / Runner variants */
.podium-card.is-champion {
  border-color: #e7c65a;
  box-shadow: 0 4px 18px rgba(210, 170, 60, 0.28);
}
.podium-card.is-runner {
  border-color: #cfd3da;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}
.podium-card.is-champion .podium-icon {
  background: #fff6d6;
}
.podium-card.is-runner .podium-icon {
  background: #f3f4f6;
}

/* By-flight section header helper */
.by-flight-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #e5e7eb;
}
.flight-section-title {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 18px;
}

/* Optional: dim places beyond 10 */
.flight-table tbody tr:nth-child(n + 11) {
  opacity: 0.65;
}
