/* ── PUBLIC WOZCODE LEADERBOARD ────────────────────────────────────── */
/* Used by both the homepage top-5 widget and the standalone /leaderboard
   page. Visual vocabulary mirrors the in-app LeaderboardCard: gold/silver/
   bronze pills for top 3, zebra stripe by rank parity, org subtitle.      */

.lb-section {
  position: relative;
  padding: 1.5rem 0 4rem;
}

.lb-section > * {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.lb-header {
  text-align: center;
  margin-bottom: 2rem;
}

.lb-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--color-brand-green, #93E849);
  margin-bottom: 0.85rem;
  opacity: 0.95;
}

/* Self-contained pulse dot — redeclared so /leaderboard.html (which doesn't
   load styles.css) still gets the pulse. Identical rule in index.html etc.
   is harmless because both define the same animation.                    */
.lb-eyebrow .eyebrow-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-brand-green, #93E849);
  flex-shrink: 0;
  animation: lb-dot-pulse 2.5s ease-in-out infinite;
}
@keyframes lb-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(147,232,73,0.5); opacity: 1; }
  50%      { box-shadow: 0 0 0 7px rgba(147,232,73,0);  opacity: 0.8; }
}

.lb-title {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.lb-title .green {
  color: var(--color-brand-green, #93E849);
}

.lb-sub {
  color: var(--color-grey-400, #B5B1AA);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Card frame ── */

.lb-card {
  background: var(--color-grey-800, #2A2825);
  border: 1px solid rgba(74,72,69,0.5);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}

/* ── Header (window selector on left, metric selector on right) ──
   The metric pills double as column headers — they sit in the same grid
   slot as the data .lb-stats so values align under their selected column. */

.lb-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.5rem 1rem 0.85rem;
  margin-bottom: 0.4rem;
}



/* Column 1–2 placeholders mirror the row layout so col 3 (.lb-stats)
   stays aligned with the data rows below.                              */
.lb-head-rank {
  display: inline-block;
  min-width: 2.1rem;
  height: 1px;
}
.lb-head-name { min-width: 0; }

.lb-window-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Shared tab pill — mirrors .ls-tab / .billing-option visual treatment. */
.lb-tab {
  padding: 0.5rem 0.95rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #78756f;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.lb-tab:hover { color: #d0cdc7; }

.lb-tab.is-active {
  color: var(--color-white, #FDFAF5);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.lb-tab:focus-visible {
  outline: 2px solid rgba(147,232,73,0.55);
  outline-offset: 2px;
}

/* Column-aligned variant for the metric pills above the data rows.     */
.lb-stats > .lb-tab {
  flex: 0 0 calc(90px - 0.4rem);
  text-align: left;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

/* ── List ── */

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lb-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

.lb-row + .lb-row { margin-top: 0.35rem; }

.lb-row-odd  { background: rgba(255,255,255,0.025); }
.lb-row-even { background: transparent; }

.lb-row-first {
  background: rgba(147,232,73,0.06);
  border-color: rgba(147,232,73,0.18);
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

/* ── Rank pills ── */

.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.lb-rank-gold {
  background: #FBE38A;
  color: #5A3F00;
  border-color: #E2B53A;
  box-shadow: 0 0 14px rgba(251,227,138,0.35);
}

.lb-rank-silver {
  background: #D8DEE6;
  color: #2A323D;
  border-color: #A8B0BC;
}

.lb-rank-bronze {
  background: #D9A06C;
  color: #3A2410;
  border-color: #A56C3A;
}

.lb-rank-neutral {
  background: transparent;
  color: var(--color-grey-400, #B5B1AA);
  border-color: rgba(181,177,170,0.3);
}

/* ── Name + org ── */

.lb-name-cell { min-width: 0; }

.lb-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-white, #FDFAF5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-org {
  font-size: 0.78rem;
  color: var(--color-grey-500, #8B877F);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sessions sub-line under name ── */

.lb-sessions {
  font-size: 0.7rem;
  color: var(--color-grey-500, #8B877F);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Stats column (cost / time / tokens) ──
   Header pills and data cells share the same flex basis + gap so their
   columns line up edge-to-edge.                                           */

.lb-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lb-stat {
  text-align: left;
  flex: 0 0 calc(90px - 0.4rem);
  padding: 0 0 0 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-grey-500, #8B877F);
  letter-spacing: -0.005em;
  line-height: 1.2;
}

/* Time values like "23h 45m" need extra room or the active (larger) value
   wraps. Keyed by data-metric so the rule survives column reordering.    */
.lb-stats [data-metric="TIME_SAVED"] {
  flex: 0 0 calc(115px - 0.4rem);
}

.lb-stat-active {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-white, #FDFAF5);
}

.lb-row-first .lb-stat-active {
  color: var(--color-brand-green, #93E849);
  font-size: 1.3rem;
}

/* ── Empty + skeleton states ── */

.lb-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-grey-400, #B5B1AA);
  font-size: 0.95rem;
  line-height: 1.5;
}

.lb-row-skel { opacity: 0.7; }

.lb-skel-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: lb-skel-shimmer 1.4s linear infinite;
  width: 70%;
}

.lb-skel-bar-sm { width: 50%; margin-left: auto; }

@keyframes lb-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── CTA below list ── */

.lb-cta-row {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.lb-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-grey-900, #080C0B);
  background: var(--color-brand-green, #93E849);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
.lb-cta:hover {
  background: #a4f25a;
  transform: translateY(-1px);
}

.lb-footnote {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--color-grey-500, #8B877F);
}

/* ── Mobile ── */

@media (max-width: 600px) {
  .lb-section { padding: 1rem 0 3rem; }
  .lb-section > * { padding-left: 1rem; padding-right: 1rem; }
  .lb-card { padding: 0.85rem; }
  .lb-row { padding: 0.7rem 0.65rem; gap: 0.6rem; }
  .lb-rank { min-width: 1.8rem; height: 1.8rem; font-size: 0.85rem; }
  .lb-name { font-size: 0.92rem; }
  .lb-org { font-size: 0.72rem; }
  .lb-sessions { font-size: 0.62rem; }
  .lb-head { padding: 0.4rem 0.65rem 0.7rem; gap: 0.6rem; }
  .lb-head .lb-stats { gap: 0.3rem; }
  .lb-tab { font-size: 0.7rem; padding: 0.4rem 0.7rem; }
  .lb-stats > .lb-tab { flex: 0 0 auto; padding-left: 0.55rem; padding-right: 0.55rem; }
  .lb-window-pills { gap: 0.3rem; }
  /* Hide inactive metrics on mobile — only the active sort column is shown. */
  .lb-stat { min-width: 0; }
  .lb-stat-inactive,
  .lb-stats > .lb-tab:not(.is-active) { display: none; }
  .lb-stat-active { font-size: 1rem; }
  .lb-row-first .lb-stat-active { font-size: 1.1rem; }
  .lb-controls { gap: 0.5rem; }
  .lb-pill { font-size: 0.7rem; padding: 0.4rem 0.65rem; }
}
