/* ═══════════════════════════════════════════════════════════════════════════
   World Cup 2026 Dashboard — stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0b0f1e;
  --surface:     #131929;
  --surface2:    #1c2438;
  --border:      #252d42;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --accent:      #3b82f6;
  --accent-dim:  #1d4ed8;
  --live:        #ef4444;
  --live-dim:    #7f1d1d;
  --finished:    #6b7280;
  --gold:        #f59e0b;

  /* US colors */
  --us-red:      #b22234;
  --us-blue:     #3c3b6e;
  --us-text:     #fff;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ─── Header ─────────────────────────────────────────────────────────────── */

header {
  background: linear-gradient(135deg, #0b1628 0%, #1a2744 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wc-logo {
  width: 44px;
  height: 44px;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.header-title .subtitle {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--live-dim);
  border: 1px solid var(--live);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--live);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.live-indicator.visible { display: flex; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

.last-updated {
  font-size: .7rem;
  color: var(--text-muted);
}

/* ─── Navigation tabs ────────────────────────────────────────────────────── */

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px 10px;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  padding: 5px 14px;
  white-space: nowrap;
  transition: all .15s;
}

.tab-btn:hover  { color: var(--text); border-color: var(--border); }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Main grid ──────────────────────────────────────────────────────────── */

main {
  padding: 20px 16px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Section headings ───────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .icon { font-size: 1rem; }
.section-title.highlight { color: var(--us-red); }

/* ─── USMNT Feature Card ─────────────────────────────────────────────────── */

#usmnt-section {
  margin-bottom: 28px;
}

.usmnt-banner {
  background: linear-gradient(135deg, var(--us-blue) 0%, #1a1a5e 40%, #2d1919 70%, var(--us-red) 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.usmnt-banner::before {
  content: '🦅';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 4rem;
  opacity: .08;
  pointer-events: none;
}

.usmnt-banner-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.usmnt-flag {
  font-size: 1.8rem;
  line-height: 1;
}

.usmnt-banner-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

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

.usmnt-empty {
  color: rgba(255,255,255,.5);
  font-size: .85rem;
}

/* ─── Match Cards ────────────────────────────────────────────────────────── */

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, transform .1s;
  cursor: default;
}

.match-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.match-card.is-live {
  border-color: var(--live);
  box-shadow: 0 0 0 1px var(--live), var(--shadow);
}

.match-card.is-usmnt {
  border-color: var(--us-red);
}

.match-card.is-usmnt.is-live {
  border-color: var(--live);
  box-shadow: 0 0 0 1px var(--live), 0 0 20px rgba(239,68,68,.2);
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.match-stage {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.match-status-badge {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-live {
  background: var(--live-dim);
  color: var(--live);
  border: 1px solid var(--live);
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

.badge-finished {
  background: rgba(107,114,128,.15);
  color: var(--finished);
  border: 1px solid var(--finished);
}

.badge-scheduled {
  background: rgba(59,130,246,.1);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.3);
}

.match-teams {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.team-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}

.team-name {
  font-size: .78rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.team-name.usmnt { color: #93c5fd; }

.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 64px;
}

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-vs {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.score-home, .score-away { min-width: 20px; text-align: center; }

.score-separator {
  color: var(--text-muted);
  font-size: 1.2rem;
}

.score-detail {
  font-size: .7rem;
  color: var(--text-muted);
  text-align: center;
}

.match-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--text-muted);
}

.match-venue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.match-kickoff { flex-shrink: 0; }

/* ─── USMNT inline cards (inside banner) ────────────────────────────────── */

.usmnt-match-card {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.usmnt-match-card.is-live {
  border-color: var(--live);
  box-shadow: 0 0 12px rgba(239,68,68,.3);
}

.usmnt-match-card .match-meta { margin-bottom: 8px; }
.usmnt-match-card .team-name  { color: rgba(255,255,255,.9); }
.usmnt-match-card .score      { color: #fff; }
.usmnt-match-card .score-vs   { color: rgba(255,255,255,.4); }
.usmnt-match-card .score-detail { color: rgba(255,255,255,.5); }
.usmnt-match-card .match-footer { color: rgba(255,255,255,.4); }

/* ─── Standings ──────────────────────────────────────────────────────────── */

.standings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-name {
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

.standings-table thead th {
  padding: 6px 8px;
  text-align: center;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.standings-table thead th:first-child { text-align: left; }

.standings-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.standings-table tbody tr:last-child { border-bottom: none; }
.standings-table tbody tr:hover { background: var(--surface2); }
.standings-table tbody tr.is-usmnt { background: rgba(58,59,110,.3); }
.standings-table tbody tr.advances { border-left: 3px solid var(--accent); }

.standings-table td {
  padding: 8px 8px;
  text-align: center;
}

.standings-table td:first-child {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 12px;
}

.team-small-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}

.team-small-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pts-cell {
  font-weight: 700;
  color: var(--text);
}

/* ─── Schedule view ──────────────────────────────────────────────────────── */

.schedule-day {
  margin-bottom: 20px;
}

.schedule-day-header {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

/* ─── Loading / Error states ─────────────────────────────────────────────── */

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: .82rem;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: none;
}

.error-banner.visible { display: block; }

/* ─── Empty states ───────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ─── Scrollable section toggle ──────────────────────────────────────────── */

.section-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .75rem;
  padding: 0;
  text-decoration: underline;
}

.section-toggle:hover { color: var(--text); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .matches-grid       { grid-template-columns: 1fr; }
  .standings-grid     { grid-template-columns: 1fr; }
  .usmnt-matches-grid { grid-template-columns: 1fr; }

  .header-title h1 { font-size: 1rem; }
  .score           { font-size: 1.3rem; }
  .team-logo       { width: 28px; height: 28px; }
}

/* ─── Tabs / Panels ──────────────────────────────────────────────────────── */

.tab-panel { display: none; }
.tab-panel.active { display: block; }
