/* SquadPicks frontend - pages.css */
/* Page-specific styles: hero, crew, upcoming timeline, how-it-works, notify CTA,
 * plus tournament/pool/leaderboard/banter/auth/me page styles. */

/* ============================================================
 * HOME — Hero
 *   Sits behind the fixed transparent navbar.
 *   Image is applied as inline CSS background-image on the <section>
 *   (the URL still comes from admin-uploaded banner config, just rendered
 *   via inline style="background-image: url(...)" — admin still controls it).
 *   No overlay layer — text is positioned in the naturally darker region
 *   of the image (top-left or wherever the banner image is composed for).
 * ============================================================ */
.sp-hero {
  position: relative;
  min-height: 80vh;
  padding: 180px 0 140px;
  display: flex;
  align-items: center;
  background-color: var(--color-slate-900); /* fallback before image loads */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  overflow: hidden;
}
.sp-hero > .container { position: relative; z-index: 1; width: 100%; }
.sp-hero-content { max-width: 640px; }
.sp-hero h1 {
  font-size: 3.5rem;                          /* mobile baseline matches V2 */
  font-weight: var(--font-weight-black);
  color: #ffffff;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}
@media (min-width: 768px) {
  .sp-hero h1 { font-size: 5rem; }            /* desktop matches V2 */
}
.sp-hero h1 .highlight,
.sp-hero h1 .sp-hero-accent { color: var(--color-emerald-500); }
.sp-hero p {
  margin-top: var(--space-6);
  font-size: 1.25rem;
  color: #ffffff;                          /* solid white per spec — no slate tint */
  line-height: 1.7;
  max-width: 540px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}
.sp-hero-actions {
  margin-top: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .sp-hero-actions { flex-direction: row; }
}
.sp-hero-meta {
  margin-top: var(--space-5);
  font-size: var(--font-size-sm);
  color: #ffffff;                          /* solid white per spec — no slate tint */
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* ============================================================
 * Page header — slim top banner for inner pages without hero
 *   Used by /home/me, /home/pool/*, /home/pool/join etc.
 *   Sits below the solid navbar; no full-height image.
 * ============================================================ */
.sp-page-header {
  background: var(--color-slate-100);
  padding: var(--space-8) 0 var(--space-7);
  border-bottom: 1px solid var(--color-slate-200);
}
.sp-page-header .container { max-width: var(--container-xl); }
.sp-page-header h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-slate-900);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}
.sp-page-header p,
.sp-page-header .sp-page-meta {
  font-size: 1.125rem;
  color: var(--color-slate-500);
}
.sp-page-header .sp-page-meta strong { color: var(--color-slate-800); }
.sp-page-header-actions { margin-top: var(--space-5); display: flex; gap: var(--space-3); flex-wrap: wrap; }
/* The section directly after the slate page-header doesn't need the full
 * 80/120px section top padding — the header band already separates them. Trim
 * the gap on both desktop and mobile (PC + phone both showed an oversized blank
 * between the header and the first content section, e.g. the picks page). */
.sp-page-header + .sp-section { padding-top: var(--space-6); }
@media (min-width: 768px) {
  .sp-page-header + .sp-section { padding-top: var(--space-8); }
}
/* Mobile: this in-room sub-nav (Group home / Leaderboard / Picks / Banter) wrapped
 * to a second row at the default button size. Shrink the ghost buttons and keep
 * them on one line; if a locale's labels are too long (or the manage page shows 4
 * items) the row scrolls horizontally in place rather than wrapping or pushing the
 * page off-screen. The scrollbar is hidden for a clean tab-bar look. */
@media (max-width: 640px) {
  /* trim the slate header band's generous desktop padding (64px/48px) so the
   * sub-nav isn't followed by a big empty gap before the page content */
  .sp-page-header {
    padding: var(--space-6) 0 var(--space-4);
  }
  .sp-page-header-actions {
    margin-top: var(--space-4);
    gap: var(--space-2);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;                 /* Firefox */
  }
  .sp-page-header-actions::-webkit-scrollbar { display: none; }   /* WebKit */
  .sp-page-header-actions .sp-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
}

/* ============================================================
 * HOME — Upcoming Tournaments timeline (vertical list, non-card)
 * ============================================================ */
.sp-timeline {
  display: flex;
  flex-direction: column;
  max-width: 920px;
  margin: 0 auto;
}
.sp-timeline-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--color-slate-200);
  transition: padding var(--transition);
  text-decoration: none;
  color: inherit;
}
.sp-timeline-row:last-child { border-bottom: 0; }
.sp-timeline-row:hover { padding-left: var(--space-2); }
.sp-timeline-date {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-emerald-600);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sp-timeline-body h3 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-slate-900);
  margin-bottom: var(--space-1);
  letter-spacing: -0.01em;
}
.sp-timeline-body p {
  font-size: var(--font-size-sm);
  color: var(--color-slate-500);
  margin: 0;
}
.sp-timeline-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: var(--font-size-sm);
  color: var(--color-slate-500);
  white-space: nowrap;
}
.sp-timeline-meta strong {
  color: var(--color-slate-900);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-extrabold);
}
@media (max-width: 575.98px) {
  .sp-timeline-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  .sp-timeline-meta { align-items: flex-start; flex-direction: row; gap: var(--space-3); }
}

/* ============================================================
 * HOME — Crew section (split: left text + invite form / right showcase pool card)
 * ============================================================ */
.sp-crew-split {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
@media (min-width: 992px) {
  .sp-crew-split { flex-direction: row; align-items: center; }
}
.sp-crew-content { flex: 1; }
.sp-crew-content h2 {
  font-size: 2.5rem;                       /* match V2 — fixed */
  font-weight: var(--font-weight-extrabold);
  color: var(--color-slate-900);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.sp-crew-content > p {
  color: var(--color-slate-500);
  margin-top: var(--space-5);
  font-size: 1.25rem;
  line-height: 1.6;
  max-width: 480px;
}
.sp-crew-graphic {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.sp-crew-pool-card {
  background: #ffffff;
  border: 1px solid var(--color-slate-100);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
/* The card ships with [hidden] until crew-hot-pool.js confirms a pool exists.
   Needed because the display:flex above (author origin) would otherwise beat
   the UA [hidden]{display:none}, leaving an empty card visible when no pool. */
.sp-crew-pool-card[hidden] { display: none; }
.sp-crew-pool-card .sp-badge { margin-bottom: var(--space-2); }
.sp-crew-pool-info h4 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-slate-900);
  margin-bottom: var(--space-1);
}
.sp-crew-pool-info p {
  font-size: var(--font-size-sm);
  color: var(--color-slate-500);
}
.sp-crew-figure {
  width: 100%;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  border: 1px solid var(--color-slate-100);
  box-shadow: var(--shadow-lg);
}

/* ============================================================
 * HOME — How it works (3 centered steps on dark)
 * ============================================================ */
.sp-how {
  text-align: center;
}
.sp-how-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 64px;                                /* V2 mobile: 64px */
}
@media (min-width: 768px) {
  .sp-how-grid { grid-template-columns: repeat(3, 1fr); gap: 48px; }
}
.sp-how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sp-how-step-num {
  font-size: 5rem;                          /* V2: 5rem */
  font-weight: var(--font-weight-black);    /* V2: 900 */
  color: var(--color-slate-800);
  margin-bottom: 32px;                      /* V2: 32px */
  line-height: 1;
}
.sp-how-step h3 {
  font-size: 1.5rem;                        /* V2: 1.5rem */
  font-weight: var(--font-weight-bold);     /* V2: 700 */
  color: #ffffff;
  margin-bottom: 16px;                      /* V2: 16px */
}
.sp-how-step p {
  color: var(--color-slate-400);
  font-size: 1.1rem;                        /* V2: 1.1rem */
  line-height: 1.6;
  max-width: 320px;
}

/* ============================================================
 * Pool card (used in Featured Pools, Explore, Tournament detail)
 * ============================================================ */
.sp-pool-card-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}
.sp-pool-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ============================================================
 * Match list + row (tournament detail + pick sheet)
 * ============================================================ */
.sp-match-list {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 880px;
  margin: 0 auto;
}
.sp-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  transition: background var(--transition-fast);
}
.sp-match-row:hover { background: var(--color-slate-50); }
.sp-match-row:last-child  { border-bottom: 0; }
.sp-match-time { font-size: var(--font-size-base); font-weight: var(--font-weight-bold); color: var(--color-slate-900); }

.sp-match-team {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.sp-match-team-home { justify-content: flex-end; }
.sp-match-team-flag { font-size: var(--font-size-2xl); line-height: 1; }
.sp-match-team-name {
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-match-center { text-align: center; font-size: var(--font-size-sm); color: var(--color-text-muted); }
.sp-match-score  { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); color: var(--color-text); }

@media (max-width: 575.98px) {
  .sp-match-row { grid-template-columns: 1fr; gap: var(--space-2); }
  .sp-match-team-home { justify-content: flex-start; }
}

/* ============================================================
 * Pick sheet — round headers, per-match rows with score inputs
 * ============================================================ */
.sp-pick-row {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
}
.sp-pick-row-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}
.sp-pick-row-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
}
.sp-pick-row-locked {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
  text-align: center;
  color: var(--color-warning);
}
.sp-pick-input { display: flex; align-items: center; gap: var(--space-2); justify-content: center; }
.sp-pick-input input[type="number"] {
  width: 56px;
  text-align: center;
  padding: var(--space-2);
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
}
.sp-pick-input input[type="number"]:disabled {
  background: var(--color-slate-100);
  color: var(--color-slate-400);
}
.sp-picks-submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
  padding: var(--space-4);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin: var(--space-6) calc(-1 * var(--space-5)) 0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.04);
}
@media (max-width: 575.98px) {
  .sp-pick-row-teams { grid-template-columns: 1fr; gap: var(--space-2); }
  .sp-picks-submit-bar { flex-direction: column-reverse; }
  .sp-picks-submit-bar .sp-btn { width: 100%; }
}

/* ============================================================
 * Manage pool tabs
 * ============================================================ */
.sp-manage-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-slate-200);
}
.sp-manage-tab {
  padding: var(--space-3) var(--space-5);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-slate-500);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.sp-manage-tab:hover { color: var(--color-slate-800); }
.sp-manage-tab.is-active {
  color: var(--color-emerald-600);
  border-bottom-color: var(--color-emerald-500);
}

/* ============================================================
 * Banter — mine vs others
 * ============================================================ */
.sp-banter-msg-mine {
  background: rgba(16, 185, 129, 0.05);
  border-color: var(--color-emerald-500);
}

/* ============================================================
 * Leaderboard table
 * ============================================================ */
.sp-leaderboard {
  position: relative;          /* anchor for the mobile scroll-hint fade */
  max-width: 880px;
  margin: 0 auto;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sp-leaderboard table { background: transparent; }
.sp-leaderboard-scroll { width: 100%; }   /* plain on desktop; becomes the horizontal scroller on phones */
/* Swipe hint — hidden on desktop (no scroll needed); shown only on phones via
 * the media query below. JS adds .is-hidden after the first horizontal scroll,
 * collapsing the row so it leaves no empty bar behind. */
.sp-leaderboard-hint { display: none; }
.sp-leaderboard-row-me {
  background: rgba(16, 185, 129, 0.06);
  font-weight: var(--font-weight-semibold);
}

/* Mobile: the 5–6 stat columns can't fit a phone width. Rather than clip them
 * (the old overflow:hidden swallowed the last column), scroll horizontally and
 * freeze RANK + PLAYER on the left so every row stays identifiable. A right-edge
 * fade hints there's more to swipe to. The expand-picks row (td[colspan]) is
 * excluded from the frozen-column / nowrap rules via :not([colspan]). */
@media (max-width: 640px) {
  .sp-leaderboard-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sp-leaderboard-hint {
    display: block;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    max-height: 3em;
    font-size: var(--font-size-xs);
    color: var(--color-slate-500);
    text-align: right;
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
  }
  .sp-leaderboard-hint.is-hidden {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }
  .sp-leaderboard table { min-width: 600px; }
  .sp-leaderboard th,
  .sp-leaderboard td:not([colspan]) {
    white-space: nowrap;
    padding: var(--space-3);
  }
  /* col 1 = RANK — fixed width so col 2's sticky offset is predictable */
  .sp-leaderboard th:nth-child(1),
  .sp-leaderboard td:nth-child(1):not([colspan]) {
    position: sticky;
    left: 0;
    z-index: 2;
    box-sizing: border-box;
    width: 56px;
    min-width: 56px;
    padding-left: var(--space-2);
    padding-right: var(--space-2);
    background: var(--color-bg-elevated);
  }
  /* col 2 = PLAYER — offset a hair under col 1's width so no gap shows through */
  .sp-leaderboard th:nth-child(2),
  .sp-leaderboard td:nth-child(2):not([colspan]) {
    position: sticky;
    left: 52px;
    z-index: 2;
    background: var(--color-bg-elevated);
    box-shadow: 1px 0 0 var(--color-border);   /* divider against the scrolling stats */
  }
  /* keep the "your row" tint opaque on the frozen cells (else scrolled cells show through) */
  .sp-leaderboard-row-me td:nth-child(1):not([colspan]),
  .sp-leaderboard-row-me td:nth-child(2):not([colspan]) {
    background: #f1fbf7;
  }
  /* right-edge swipe affordance */
  .sp-leaderboard::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--color-bg-elevated));
    pointer-events: none;
    z-index: 3;
  }
}
.sp-rank-badge {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--color-slate-100);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}
.sp-rank-1 { background: var(--rank-gold);   color: #5a4500; }
.sp-rank-2 { background: var(--rank-silver); color: #4a4a4a; }
.sp-rank-3 { background: var(--rank-bronze); color: #ffffff; }

/* ============================================================
 * Banter board
 * ============================================================ */
.sp-banter-list { display: flex; flex-direction: column; gap: var(--space-3); }
.sp-banter-msg {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.sp-banter-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.sp-banter-msg-author { font-weight: var(--font-weight-semibold); color: var(--color-text); }
.sp-banter-msg-reply {
  border-left: 3px solid var(--color-emerald-500);
  padding-left: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.sp-banter-composer { margin-top: var(--space-4); display: flex; gap: var(--space-2); }
.sp-banter-composer textarea { resize: vertical; min-height: 44px; }

/* ============================================================
 * Auth pages (login/register)
 * ============================================================ */
.sp-auth-wrapper {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
}
.sp-auth-card { width: 100%; max-width: 420px; }
.sp-auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
}
.sp-auth-divider::before,
.sp-auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
 * Profile / Me page
 * ============================================================ */
.sp-me-greeting {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}
.sp-me-list { display: flex; flex-direction: column; gap: var(--space-2); }
