/* ============================================================
   PyramidLive — Main Stylesheet
   Dark-first design, mobile-first layout
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1923;
  --bg2:       #161f2c;
  --bg3:       #1c2840;
  --border:    rgba(255,255,255,.08);
  --border2:   rgba(255,255,255,.14);
  --text:      #e8edf2;
  --text2:     #8a9bb0;
  --text3:     #5a6a7e;
  --accent:    #2979ff;
  --accent2:   #1565c0;
  --live:      #f44336;
  --live-bg:   rgba(244,67,54,.12);
  --ht-bg:     rgba(255,152,0,.12);
  --ht:        #ff9800;
  --ft:        #607d8b;
  --green:     #4caf50;
  --red:       #f44336;
  --yellow:    #ffc107;
  --amber:     #ff9800;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 2px 12px rgba(0,0,0,.4);
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ── Layout ───────────────────────────────────────────── */
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.layout-2col { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 720px) { .layout-2col { grid-template-columns: 1fr; } }

/* ── Header ───────────────────────────────────────────── */
.site-header { background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.site-header .container { display: flex; align-items: center; gap: 20px; height: 52px; }
.logo { font-size: 1.1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.logo-pyramid { color: var(--accent); font-size: 1rem; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { padding: 6px 12px; border-radius: var(--radius); color: var(--text2); font-size: .875rem; transition: background .15s, color .15s; }
.site-nav a:hover, .site-nav a.active { background: var(--bg3); color: var(--text); }
.search-form { margin-left: auto; }
.search-form input { background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: .875rem; color: var(--text); width: 180px; outline: none; transition: border-color .15s, width .2s; }
.search-form input:focus { border-color: var(--accent); width: 220px; }
@media (max-width: 540px) { .site-nav { display: none; } .search-form input { width: 140px; } }

/* ── Page hero / title ────────────────────────────────── */
.page-title { padding: 24px 0 16px; }
.page-title h1 { font-size: 1.4rem; font-weight: 700; }
.page-title .sub { color: var(--text2); font-size: .875rem; margin-top: 4px; }

/* ── Cards ────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: .8rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; justify-content: space-between; }
.card-head a { color: var(--accent); font-size: .8rem; font-weight: 500; }

/* ── Section label ────────────────────────────────────── */
.section-label { font-size: .75rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; padding: 20px 0 8px; }

/* ── Live badge ───────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge.live  { background: var(--live-bg); color: var(--live); }
.badge.live::before { content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--live); animation: pulse 1.4s infinite; }
.badge.ht    { background: var(--ht-bg); color: var(--ht); }
.badge.ft    { background: rgba(96,125,139,.15); color: var(--ft); }
.badge.sched { background: transparent; color: var(--text3); font-weight: 500; }
.badge.ppd   { background: rgba(255,152,0,.1); color: var(--amber); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Match row (used on hub + club page) ──────────────── */
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background .12s; cursor: pointer; }
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: var(--bg3); }
.match-row .team { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; }
.match-row .team.away { flex-direction: row-reverse; text-align: right; }
.match-row .badge-img { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.match-row .score-centre { text-align: center; min-width: 80px; }
.match-row .score { font-size: 1.1rem; font-weight: 700; display: block; letter-spacing: .04em; }
.match-row .time { font-size: .78rem; color: var(--text2); }

/* ── Organisation group ───────────────────────────────── */
.org-group { margin-bottom: 28px; }
.org-group-title { font-size: .72rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; padding: 0 0 6px; }
.comp-group { margin-bottom: 12px; }
.comp-group-title { font-size: .78rem; font-weight: 600; color: var(--text2); padding: 8px 16px 4px; background: var(--bg3); border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--border); border-bottom: none; display: flex; align-items: center; justify-content: space-between; }
.comp-group-title a { color: var(--accent); font-size: .75rem; }
.comp-group .card { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.comp-group .match-row:first-child { border-radius: 0; }

/* ── Match page ───────────────────────────────────────── */
.match-hero { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 20px 20px; text-align: center; margin-bottom: 20px; }
.match-hero .competition-label { font-size: .78rem; color: var(--text2); margin-bottom: 20px; }
.match-hero .teams-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.match-hero .team-block { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.match-hero .team-block.away { }
.match-hero .team-badge { width: 64px; height: 64px; object-fit: contain; }
.match-hero .team-name { font-size: 1rem; font-weight: 600; }
.match-hero .score-block { }
.match-hero .score-main { font-size: 2.6rem; font-weight: 800; letter-spacing: .04em; line-height: 1; }
.match-hero .score-ht { font-size: .78rem; color: var(--text3); margin-top: 4px; }
.match-hero .status-row { margin-top: 16px; display: flex; justify-content: center; }

/* ── Timeline / events ────────────────────────────────── */
.timeline { padding: 8px 0; }
.event-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: .875rem; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: none; }
.event-item.home { flex-direction: row; }
.event-item.away { flex-direction: row-reverse; text-align: right; }
.event-item .ev-min { font-size: .75rem; font-weight: 700; color: var(--text3); min-width: 32px; flex-shrink: 0; }
.event-item .ev-icon { font-size: 1rem; flex-shrink: 0; }
.event-item .ev-desc { flex: 1; }
.event-item .ev-player { font-weight: 500; }
.event-item .ev-sub { font-size: .78rem; color: var(--text2); }
.event-item.social-event { background: rgba(41,121,255,.04); }
.event-item .social-badge { font-size: .68rem; background: var(--bg3); color: var(--text3); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }

/* ── League table ─────────────────────────────────────── */
.league-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.league-table th { font-size: .72rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.league-table th:first-child,
.league-table th:nth-child(2) { text-align: left; }
.league-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.league-table td:first-child { color: var(--text3); font-size: .8rem; width: 28px; }
.league-table td:nth-child(2) { text-align: left; font-weight: 500; }
.league-table tr:last-child td { border-bottom: none; }
.league-table tr:hover td { background: var(--bg3); }
.league-table tr.highlight td { background: rgba(41,121,255,.07); }
.league-table .club-cell { display: flex; align-items: center; gap: 8px; }
.league-table .club-cell img { width: 18px; height: 18px; object-fit: contain; }
.league-table .pts { font-weight: 700; }
.league-table .pos-up   { color: var(--green); font-size: .65rem; }
.league-table .pos-down { color: var(--red);   font-size: .65rem; }
.league-table .live-ind { font-size: .68rem; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.live-ind.W { background: rgba(76,175,80,.15); color: var(--green); }
.live-ind.D { background: rgba(255,152,0,.15); color: var(--amber); }
.live-ind.L { background: rgba(244,67,54,.15); color: var(--red); }

/* ── Top scorers ──────────────────────────────────────── */
.scorers-list { }
.scorer-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: .875rem; }
.scorer-row:last-child { border-bottom: none; }
.scorer-rank { font-size: .8rem; color: var(--text3); width: 20px; flex-shrink: 0; }
.scorer-name { flex: 1; font-weight: 500; }
.scorer-club { font-size: .78rem; color: var(--text2); }
.scorer-goals { font-weight: 700; font-size: 1rem; }

/* ── Form dots ────────────────────────────────────────── */
.form-dots { display: flex; gap: 3px; }
.form-dots .dot { width: 18px; height: 18px; border-radius: 50%; font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.form-dots .dot.w { background: rgba(76,175,80,.2);  color: var(--green); }
.form-dots .dot.d { background: rgba(255,152,0,.2);  color: var(--amber); }
.form-dots .dot.l { background: rgba(244,67,54,.2);  color: var(--red);   }

/* ── Club page hero ───────────────────────────────────── */
.club-hero { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 20px; display: flex; gap: 20px; align-items: center; margin-bottom: 20px; }
.club-hero img { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; }
.club-hero .club-info h1 { font-size: 1.4rem; font-weight: 700; }
.club-hero .club-meta { font-size: .875rem; color: var(--text2); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.club-hero .position-pill { background: var(--bg3); border: 1px solid var(--border2); border-radius: 6px; padding: 3px 10px; font-size: .8rem; font-weight: 600; color: var(--text); }

/* ── Sentiment ────────────────────────────────────────── */
.sentiment-box { padding: 14px 16px; }
.sentiment-label { font-size: .78rem; color: var(--text2); margin-bottom: 8px; }
.sentiment-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.sentiment-btn { flex: 1; padding: 8px; border: 1px solid var(--border2); border-radius: var(--radius); background: transparent; color: var(--text); font-size: .875rem; cursor: pointer; transition: background .15s, border-color .15s; font-family: inherit; }
.sentiment-btn:hover { background: var(--bg3); }
.sentiment-btn.voted-bullish { background: rgba(76,175,80,.12); border-color: var(--green); color: var(--green); }
.sentiment-btn.voted-bearish { background: rgba(244,67,54,.12); border-color: var(--red); color: var(--red); }
.sentiment-bar { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.sentiment-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .4s; }
.sentiment-counts { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text3); margin-top: 5px; }

/* ── Comments ─────────────────────────────────────────── */
.comments-list { }
.comment-item { padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: .875rem; }
.comment-item:last-child { border-bottom: none; }
.comment-meta { font-size: .75rem; color: var(--text3); margin-bottom: 3px; }
.comment-form { padding: 12px 16px; border-top: 1px solid var(--border); }
.comment-form input, .comment-form textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; color: var(--text); font-size: .875rem; font-family: inherit; margin-bottom: 8px; outline: none; resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }
.comment-form button { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 8px 18px; font-size: .875rem; cursor: pointer; font-family: inherit; font-weight: 500; }

/* ── H2H ──────────────────────────────────────────────── */
.h2h-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.h2h-row:last-child { border-bottom: none; }
.h2h-team { display: flex; align-items: center; gap: 6px; }
.h2h-team.away { flex-direction: row-reverse; justify-content: flex-start; }
.h2h-score { text-align: center; font-weight: 700; min-width: 48px; }
.h2h-date { font-size: .72rem; color: var(--text3); }

/* ── Stat grid ────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); }
.stat-cell { background: var(--bg2); padding: 12px 10px; text-align: center; }
.stat-cell .val { font-size: 1.2rem; font-weight: 700; }
.stat-cell .lbl { font-size: .72rem; color: var(--text3); margin-top: 3px; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--bg3); border-radius: var(--radius); padding: 3px; margin-bottom: 16px; }
.tab-btn { flex: 1; padding: 7px 10px; border: none; background: transparent; color: var(--text2); font-size: .82rem; font-weight: 500; border-radius: 6px; cursor: pointer; font-family: inherit; transition: background .15s, color .15s; }
.tab-btn.active { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Polling indicator ────────────────────────────────── */
.poll-indicator { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text3); padding: 8px 16px; }
.poll-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }

/* ── Footer ───────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; margin-top: 48px; font-size: .8rem; color: var(--text3); text-align: center; }
.site-footer a { color: var(--text2); }
.footer-data { margin-top: 4px; }

/* ── Utility ──────────────────────────────────────────── */
.mb12 { margin-bottom: 12px; }
.mb20 { margin-bottom: 20px; }
.mt16 { margin-top: 16px; }
.text-muted { color: var(--text2); }
.text-small { font-size: .8rem; }
.empty-state { padding: 32px 16px; text-align: center; color: var(--text3); font-size: .9rem; }

/* ── Predictions ──────────────────────────────────────────── */
.prediction-card { transition: background .12s; }
.prediction-card:last-child { border-bottom: none !important; }

/* predict buttons hover handled inline for flexibility */

/* ── Leaderboard ──────────────────────────────────────────── */
.page-leaderboard .card { }

/* ── Badge image fallback ─────────────────────────────────── */
.badge-img, .team-badge { background: var(--bg3); }
.badge-img[src=""], .team-badge[src=""] { visibility: hidden; }

/* ── Pyramid Diagram ──────────────────────────────────── */
.pyramid-diagram { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 20px 20px; margin-bottom: 20px; text-align: center; }
.pyramid-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); letter-spacing: .02em; }
.pyramid-level { margin-bottom: 10px; }
.pyramid-level:last-child { margin-bottom: 0; }
.pyramid-label { font-size: .68rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.pyramid-boxes { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pyramid-box { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius); padding: 8px 16px; font-size: .82rem; font-weight: 600; color: var(--text); cursor: pointer; transition: background .15s, border-color .15s, color .15s; text-decoration: none; }
.pyramid-box:hover { background: rgba(76,175,80,.12); border-color: var(--green); color: var(--green); }
.pyramid-box-more { color: var(--text3); font-weight: 400; cursor: default; }
.pyramid-box-more:hover { background: var(--bg3); border-color: var(--border2); color: var(--text3); }
@media (max-width: 540px) {
  .pyramid-box { padding: 6px 10px; font-size: .75rem; }
}

/* ── Filter Nav ───────────────────────────────────────── */
.filter-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 0; position: sticky; top: 52px; z-index: 90; background: var(--bg); padding-bottom: 8px; margin-bottom: 4px; }
.filter-btn { background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: .82rem; font-weight: 500; color: var(--text2); cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.filter-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.filter-btn.active { background: rgba(76,175,80,.15); border-color: var(--green); color: var(--green); font-weight: 600; }
@media (max-width: 540px) {
  .filter-nav { gap: 4px; }
  .filter-btn { padding: 5px 10px; font-size: .75rem; }
}

/* ── Club badge in match rows ─────────────────────────── */
.club-badge { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.club-badge-lg { width: 64px; height: 64px; object-fit: contain; }
