/* ===========================
   WORLD CUP 2026 TRACKER
   Main Stylesheet
   =========================== */

:root {
  --bg: #0a0f1e;
  --bg2: #111827;
  --bg3: #1a2235;
  --surface: #1e2d42;
  --surface2: #243350;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #f0f4ff;
  --text2: #9ba8c0;
  --text3: #5a6a85;
  --gold: #f5a623;
  --gold2: #e8941a;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #3b82f6;
  --live-pulse: #ef4444;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- HEADER ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,15,30,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.header-logo span {
  background: linear-gradient(135deg, var(--gold), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-logo .trophy { font-size: 20px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lang {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.btn-lang:hover { background: var(--surface2); color: var(--text); }

.btn-notif {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}
.btn-notif:hover { background: var(--surface2); color: var(--text); }
.btn-notif.active { border-color: var(--gold); color: var(--gold); }
.btn-notif .badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 8px; height: 8px;
  background: var(--live-pulse);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ---- NAVIGATION ---- */
.nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-inner {
  display: flex;
  padding: 0 12px;
  min-width: max-content;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text3);
  padding: 14px 16px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
}
.nav-btn:hover { color: var(--text2); }
.nav-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.nav-btn .nav-icon { font-size: 15px; }

/* ---- MAIN CONTENT ---- */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.view { display: none; }
.view.active { display: block; }

/* ---- DATE STRIP ---- */
.date-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 12px;
  margin-bottom: 4px;
}
.date-strip::-webkit-scrollbar { display: none; }

.date-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  min-width: 70px;
  text-align: center;
}
.date-pill:hover { border-color: var(--border2); color: var(--text); }
.date-pill.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
  font-weight: 700;
}
.date-pill small { display: block; font-size: 10px; opacity: 0.7; margin-top: 1px; }

/* ---- MATCH CARD ---- */
.match-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
}
.match-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}
.match-card.live-match {
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 0 0 1px rgba(239,68,68,0.2);
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text3);
}

.match-status {
  font-weight: 700;
  font-size: 11px;
}
.match-status.live {
  color: var(--live-pulse);
  display: flex;
  align-items: center;
  gap: 5px;
}
.match-status.live::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--live-pulse);
  border-radius: 50%;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.match-status.finished { color: var(--text3); }
.match-status.scheduled { color: var(--gold); }

.match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 14px;
  gap: 10px;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.match-team.home { align-items: flex-end; }
.match-team.away { align-items: flex-start; }

.team-flag {
  font-size: 28px;
  line-height: 1;
}
.team-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.team-name-abbr {
  font-size: 11px;
  color: var(--text3);
}

.match-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}
.match-score {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}
.match-score.live { color: var(--gold); }
.match-time {
  font-size: 11px;
  color: var(--text3);
}
.match-venue-mini {
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  padding: 0 10px;
}

.match-events-strip {
  padding: 0 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.event-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.event-pill.goal { background: rgba(34,197,94,0.15); color: var(--green); }
.event-pill.yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.event-pill.red { background: rgba(239,68,68,0.15); color: var(--red); }
.event-pill.sub { background: rgba(59,130,246,0.15); color: var(--blue); }

/* ---- MODAL DETAIL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: var(--surface);
  border: none;
  color: var(--text2);
  width: 30px; height: 30px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body { padding: 16px 20px 24px; }

.modal-score-hero {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.modal-score-hero .match-team { align-items: center; }
.modal-score-hero .team-flag { font-size: 40px; }
.modal-score-hero .team-name { font-size: 15px; }
.modal-score-hero .match-score { font-size: 42px; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text3);
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.tab-btn.active {
  background: var(--surface);
  color: var(--text);
}

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

/* ---- EVENTS LIST ---- */
.events-list { display: flex; flex-direction: column; gap: 6px; }
.event-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 13px;
}
.event-min {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-align: center;
}
.event-icon { font-size: 14px; }
.event-detail { color: var(--text2); font-size: 12px; }

/* ---- LINEUP ---- */
.lineup-pitch {
  background: linear-gradient(180deg, #14532d 0%, #166534 40%, #14532d 100%);
  border-radius: 10px;
  padding: 12px;
  position: relative;
  min-height: 300px;
  margin-bottom: 12px;
  overflow: hidden;
}
.pitch-lines {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
}
.pitch-center-circle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 80px; height: 80px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
}
.pitch-midline {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.15);
}
.lineup-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.player-token {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 50px;
}
.player-num {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.9);
  color: #14532d;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 800;
}
.player-token-name {
  font-size: 9px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  text-align: center;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- GROUPS VIEW ---- */
.group-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.group-nav::-webkit-scrollbar { display: none; }
.group-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.group-pill:hover { border-color: var(--border2); }
.group-pill.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.standings-table th {
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.standings-table th:first-child { text-align: left; }

.standings-table td {
  padding: 10px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.standings-table td:first-child { text-align: left; }
.standings-table tr:last-child td { border-bottom: none; }

.standings-table tr { transition: background 0.15s; cursor: pointer; }
.standings-table tr:hover td { background: var(--bg3); }
.standings-table tr.qualified td:first-child {
  border-left: 3px solid var(--green);
}
.standings-table tr.playoff td:first-child {
  border-left: 3px solid var(--yellow);
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-flag-sm { font-size: 18px; }
.pts-badge {
  background: var(--surface2);
  color: var(--text);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
}

.standings-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.standings-card-header {
  background: var(--bg3);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- BRACKET VIEW ---- */
.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 12px;
}
.bracket-grid {
  display: flex;
  gap: 0;
  min-width: 680px;
  position: relative;
}
.bracket-round {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 0 8px;
}
.bracket-round-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 0 12px;
}
.bracket-match {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 6px 0;
  cursor: pointer;
  transition: border-color 0.2s;
}
.bracket-match:hover { border-color: var(--border2); }
.bracket-match.winner-match { border-color: var(--gold); }

.bracket-team {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s;
}
.bracket-team + .bracket-team {
  border-top: 1px solid var(--border);
}
.bracket-team.winner {
  background: rgba(245,166,35,0.12);
  color: var(--gold);
  font-weight: 700;
}
.bracket-team .flag { font-size: 14px; }
.bracket-team .score {
  margin-left: auto;
  font-weight: 700;
  font-size: 13px;
}

/* ---- STATS / SCORERS ---- */
.stats-header {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-card .stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.stat-card .stat-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scorers-list { display: flex; flex-direction: column; gap: 6px; }
.scorer-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.scorer-row:hover { border-color: var(--border2); }
.scorer-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-align: center;
}
.scorer-rank.top1 { color: var(--gold); font-size: 14px; }
.scorer-rank.top2 { color: #94a3b8; }
.scorer-rank.top3 { color: #b45309; }
.scorer-info { display: flex; flex-direction: column; gap: 2px; }
.scorer-name { font-weight: 600; }
.scorer-team { font-size: 11px; color: var(--text3); }
.scorer-flag { font-size: 20px; }
.scorer-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

/* ---- VENUES ---- */
.venues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.venue-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.venue-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.venue-img {
  width: 100%;
  height: 120px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.venue-info { padding: 12px 14px; }
.venue-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.venue-city { font-size: 12px; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.venue-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text3);
}

/* ---- INSTALL BANNER ---- */
.install-banner {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  display: none;
}
.install-banner.show { display: flex; }
.install-banner-text { flex: 1; font-size: 13px; }
.install-banner-text strong { color: var(--gold); }
.btn-install {
  background: var(--gold);
  color: var(--bg);
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background 0.2s;
}
.btn-install:hover { background: var(--gold2); }
.btn-banner-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ---- SECTION TITLE ---- */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- TOAST NOTIFICATION ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- BOTTOM NAV (mobile) ---- */
@media (max-width: 600px) {
  .nav { display: none; }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(10,15,30,0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text3);
    padding: 8px 4px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: color 0.2s;
    font-family: var(--font);
  }
  .bottom-nav-btn .bn-icon { font-size: 20px; }
  .bottom-nav-btn.active { color: var(--gold); }
  .main { padding: 12px 12px 80px; }
}
@media (min-width: 601px) {
  .bottom-nav { display: none; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ---- LOADING ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--surface) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ---- RESPONSIVE ---- */
@media (min-width: 600px) {
  .match-body { padding: 20px 20px; }
  .team-flag { font-size: 36px; }
  .match-score { font-size: 36px; }
  .modal { border-radius: var(--radius-xl); margin: 20px; max-height: calc(90vh - 40px); }
  .modal-overlay { align-items: center; }
}
