/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e17;
  --bg-card: #131926;
  --bg-card-hover: #1a2236;
  --bg-surface: #0f1520;
  --text: #e8edf5;
  --text-muted: #7a869a;
  --text-dim: #4a5568;
  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.15);
  --warning: #f6ad55;
  --danger: #fc5c65;
  --live: #ff4757;
  --live-glow: rgba(255, 71, 87, 0.3);
  --nfl: #013369;
  --nba: #c9082a;
  --mlb: #002d72;
  --nhl: #000;
  --mls: #5d2e8c;
  --ufc: #d20a0a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 100px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 72px;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

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

.logo { font-size: 24px; }

.app-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #00ffcc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

.icon-btn:hover { color: var(--text); background: var(--bg-card-hover); }

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--live);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* ===== Date Nav ===== */
.date-nav {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 4px;
}

.date-arrow {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.date-arrow:hover { color: var(--text); background: var(--bg-card); }

.date-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.date-tabs::-webkit-scrollbar { display: none; }

.date-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
  min-width: 54px;
}

.date-tab:hover { background: var(--bg-card); }

.date-tab.active {
  background: var(--accent);
  color: var(--bg);
}

.date-tab .day-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.date-tab .day-num {
  font-size: 16px;
  font-weight: 700;
}

/* ===== Sport Filter ===== */
.sport-filter {
  display: flex;
  gap: 6px;
  padding: 4px 20px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sport-filter::-webkit-scrollbar { display: none; }

.sport-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--bg-card-hover);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--font);
}

.sport-chip:hover { border-color: var(--accent); color: var(--text); }

.sport-chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}

/* ===== Games List ===== */
.games-list {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Game Card ===== */
.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  border-color: rgba(0, 212, 170, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.game-card.live {
  border-color: var(--live);
  box-shadow: 0 0 20px var(--live-glow);
}

.game-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.game-league {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.game-league.nfl { background: var(--nfl); color: #fff; }
.game-league.nba { background: var(--nba); color: #fff; }
.game-league.mlb { background: var(--mlb); color: #fff; }
.game-league.nhl { background: var(--nhl); color: #fff; border: 1px solid #333; }
.game-league.mls { background: var(--mls); color: #fff; }
.game-league.ufc { background: var(--ufc); color: #fff; }

.game-network {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.game-matchup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.team {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.team.away { justify-content: flex-start; }
.team.home { justify-content: flex-end; flex-direction: row-reverse; }

.team-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.team-info {
  display: flex;
  flex-direction: column;
}

.team-name {
  font-size: 14px;
  font-weight: 600;
}

.team-record {
  font-size: 11px;
  color: var(--text-dim);
}

.game-vs {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

/* Time Block */
.time-block {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.time-scheduled {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.time-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.time-value {
  font-size: 16px;
  font-weight: 700;
}

.time-scheduled .time-value {
  text-decoration: line-through;
  color: var(--text-dim);
}

.time-predicted {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  border: 1px solid rgba(0, 212, 170, 0.2);
}

.time-predicted .time-label {
  color: var(--accent);
}

.time-predicted .time-value {
  color: var(--accent);
}

.time-diff {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(246, 173, 85, 0.1);
  border: 1px solid rgba(246, 173, 85, 0.2);
}

.time-diff-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--warning);
}

/* Live indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 71, 87, 0.1);
}

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

@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--live-glow); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

.live-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--live);
}

.crowd-reports {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Confidence bar */
.confidence {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.confidence-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.confidence-fill.high { background: var(--accent); }
.confidence-fill.med { background: var(--warning); }
.confidence-fill.low { background: var(--danger); }

.confidence-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 24px 20px 40px;
  animation: slide-up 0.3s ease;
  position: relative;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-surface);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover { color: var(--text); }

/* Modal Content */
.modal-header {
  margin-bottom: 20px;
}

.modal-league {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.modal-teams {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.modal-venue {
  font-size: 13px;
  color: var(--text-dim);
}

.modal-time-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.modal-time-box {
  text-align: center;
}

.modal-time-box .label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.modal-time-box .value {
  font-size: 24px;
  font-weight: 800;
}

.modal-time-box.scheduled .value {
  text-decoration: line-through;
  color: var(--text-dim);
}

.modal-time-box.predicted .value {
  color: var(--accent);
}

.modal-arrow {
  font-size: 20px;
  color: var(--text-dim);
}

.modal-delay-badge {
  text-align: center;
  margin-top: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: rgba(246, 173, 85, 0.15);
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
}

/* Timeline */
.timeline {
  margin-bottom: 20px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 28px;
  bottom: -8px;
  width: 2px;
  background: var(--bg-surface);
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-dot.done { background: var(--accent); }
.timeline-dot.active { background: var(--live); animation: pulse-live 1.5s ease infinite; }
.timeline-dot.pending { background: var(--bg-surface); border: 2px dashed var(--text-dim); }

.timeline-content {
  flex: 1;
}

.timeline-event {
  font-size: 13px;
  font-weight: 600;
}

.timeline-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Historical */
.historical {
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.historical-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.historical-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.historical-stat:last-child { border-bottom: none; }

.historical-stat .stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.historical-stat .stat-value {
  font-size: 14px;
  font-weight: 700;
}

/* Notify Button */
.notify-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.notify-btn:hover { opacity: 0.9; transform: scale(1.01); }
.notify-btn.active { background: var(--bg-surface); color: var(--accent); border: 2px solid var(--accent); }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 60;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.nav-item.active { color: var(--accent); }
.nav-item:hover { color: var(--text-muted); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Stats View ===== */
.stats-view, .report-view {
  padding: 0 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.delay-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.delay-bar-label {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.delay-bar-track {
  flex: 1;
  height: 28px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.delay-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  transition: width 0.8s ease;
}

.network-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.network-name {
  font-size: 14px;
  font-weight: 600;
}

.network-delay {
  font-size: 14px;
  font-weight: 700;
  color: var(--warning);
}

/* ===== Report View ===== */
.report-game-card {
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.report-game-card:hover { border-color: var(--accent); }
.report-game-card.selected { border-color: var(--accent); background: var(--accent-glow); }

.report-game-name {
  font-size: 14px;
  font-weight: 600;
}

.report-game-time {
  font-size: 12px;
  color: var(--text-dim);
}

.milestone-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.milestone-btn:hover { border-color: var(--accent); }

.milestone-btn.reported {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.milestone-icon {
  font-size: 20px;
}

.milestone-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.empty-state .desc { font-size: 13px; }

/* Animations */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-card { animation: fade-in 0.3s ease both; }
.game-card:nth-child(2) { animation-delay: 0.05s; }
.game-card:nth-child(3) { animation-delay: 0.1s; }
.game-card:nth-child(4) { animation-delay: 0.15s; }
.game-card:nth-child(5) { animation-delay: 0.2s; }
.game-card:nth-child(6) { animation-delay: 0.25s; }
