/* =========================================================
   BetAnalyzer Pro - Styles
   ========================================================= */

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

:root {
  --bg-primary: #0a0e17;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --bg-accent: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.12);
  --border: #1e293b;
  --radius: 14px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- HEADER ---- */
.header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-badge {
  font-size: 10px;
  background: var(--red-bg);
  color: var(--red);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

.header-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--red);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.refresh-btn {
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.refresh-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--blue);
}

/* ---- TABS ---- */
.tabs-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px 0;
}

.league-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.league-tabs::-webkit-scrollbar { display: none; }

.league-tab {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s;
  user-select: none;
}

.league-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.league-tab.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--blue);
  color: var(--text-primary);
}

.tab-live {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---- CONTAINER ---- */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 20px;
}

/* ---- SECTIONS ---- */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.badge-live { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-upcoming { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-picks { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.2); }

/* ---- GAMES GRID ---- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

/* ---- GAME CARD ---- */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s;
}

.game-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

.game-card.live-card {
  border-color: rgba(239, 68, 68, 0.25);
}

.game-card.live-card:hover {
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.1);
}

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

.game-league {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-status {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

.status-live { background: var(--red-bg); color: var(--red); }
.status-ht { background: var(--yellow-bg); color: var(--yellow); }
.status-upcoming { background: var(--bg-accent); color: var(--text-secondary); }

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

.team {
  flex: 1;
  text-align: center;
}

.team-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  margin: 0 auto 6px;
  background: var(--bg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  overflow: hidden;
}

.team-logo img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.team-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

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

.score-display {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  justify-content: center;
}

.score-num {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.score-sep {
  color: var(--text-muted);
  font-size: 18px;
}

.vs-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.game-detail {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- PROBABILITY BAR ---- */
.prob-bar-wrap {
  margin-top: 10px;
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

.prob-bar {
  height: 6px;
  background: var(--bg-accent);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}

.prob-home {
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 3px 0 0 3px;
}

.prob-draw {
  background: var(--text-muted);
}

.prob-away {
  background: linear-gradient(90deg, var(--purple), #a78bfa);
  border-radius: 0 3px 3px 0;
}

/* ---- ODDS DISPLAY ---- */
.odds-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.odds-chip {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  font-size: 11px;
  border: 1px solid var(--border);
}

.odds-chip-label {
  color: var(--text-muted);
  font-size: 10px;
  margin-bottom: 2px;
}

.odds-chip-value {
  font-weight: 700;
  color: var(--text-primary);
}

.odds-chip-value.positive { color: var(--green); }
.odds-chip-value.negative { color: var(--red); }

/* ---- ANALYSIS CARD ---- */
.analysis-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), rgba(59, 130, 246, 0.04));
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.analysis-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.06);
}

.analysis-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.analysis-match {
  font-size: 14px;
  font-weight: 700;
}

.analysis-sport {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.confidence {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.conf-high { background: var(--green-bg); color: var(--green); }
.conf-medium { background: var(--yellow-bg); color: var(--yellow); }
.conf-low { background: var(--red-bg); color: var(--red); }

.analysis-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.pick-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  padding: 3px 10px;
  border-radius: 6px;
}

.pick-value {
  font-size: 14px;
  font-weight: 600;
}

.analysis-details {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  font-size: 11px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.detail-label { color: var(--text-muted); }
.detail-value { font-weight: 600; }

.analysis-reason {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

/* ---- TICKET SECTION ---- */
.ticket-section {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}

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

.ticket-title {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ticket-controls select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.ticket-controls label {
  font-size: 12px;
  color: var(--text-secondary);
}

.ticket-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
}

.ticket-item-match {
  font-size: 13px;
  font-weight: 600;
}

.ticket-item-pick {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  padding: 3px 10px;
  border-radius: 6px;
}

.ticket-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ticket-summary-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.ticket-summary-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
}

.ticket-disclaimer {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ---- STANDINGS ---- */
.standings-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.standings-row {
  display: flex;
  align-items: center;
  padding: 7px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.standings-row:last-child { border-bottom: none; }

.standings-row.header-row {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.st-rank { width: 28px; color: var(--text-muted); font-weight: 600; }
.st-team { flex: 1; font-weight: 600; }
.st-stat { width: 36px; text-align: center; color: var(--text-secondary); }
.st-pts { width: 36px; text-align: center; font-weight: 700; color: var(--green); }

.st-form {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

.form-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.form-w { background: var(--green); }
.form-d { background: var(--yellow); }
.form-l { background: var(--red); }

/* ---- TWO COLUMN ---- */
.two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

/* ---- LOADING & ERROR ---- */
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--red);
}

.error-state .refresh-btn {
  margin: 16px auto 0;
}

/* ---- FOOTER ---- */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  line-height: 1.8;
}

/* ---- UTILITIES ---- */
.hidden { display: none !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .games-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .container { padding: 12px; }
  .tabs-container { padding: 10px 12px 0; }
  .header { padding: 12px 14px; }
}
