/* ==========================================================================
   FBS Top 25 Live Tracker - Modern Sports Dashboard Styling
   ========================================================================== */

:root {
  --bg-main: #0a0d14;
  --bg-card: #121824;
  --bg-card-hover: #182030;
  --bg-surface: #1e2638;
  --bg-subtle: #141b29;
  
  --border-color: #243048;
  --border-focus: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-live: #ef4444;
  --color-live-glow: rgba(239, 68, 68, 0.25);
  --color-final: #10b981;
  --color-gold: #f59e0b;
  --color-gold-glow: rgba(245, 158, 11, 0.2);
  --color-blue: #38bdf8;
  --color-purple: #a855f7;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* Background mesh subtle lighting */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 450px;
  background: radial-gradient(circle at 50% -20%, rgba(37, 99, 235, 0.15), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 2.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 2px;
}

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

.delay-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fbbf24;
  box-shadow: var(--shadow-sm);
}

.delay-indicator .icon {
  width: 14px;
  height: 14px;
  color: #fbbf24;
}

.tz-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: #93c5fd;
  box-shadow: var(--shadow-sm);
}

.tz-indicator .icon {
  width: 14px;
  height: 14px;
  color: var(--color-blue);
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.sync-timer {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-blue);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-final);
  box-shadow: 0 0 8px var(--color-final);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-dot.red {
  background-color: var(--color-live);
  box-shadow: 0 0 10px var(--color-live);
}

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

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-nav {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
}
.btn-nav:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-pill {
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 6px 14px;
}
.btn-pill:hover,
.btn-pill.active {
  background: #1d4ed8;
  color: #fff;
  border-color: #3b82f6;
}

/* ==========================================================================
   Controls Card (Date & Filters)
   ========================================================================== */
.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.date-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.current-date-picker-wrapper {
  position: relative;
}

.date-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.date-display-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.date-display-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.date-display-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--color-blue);
}

.quick-jump-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Filters & Search */
.filter-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

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

.filter-tab.active {
  background: var(--bg-surface);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.badge-count {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: var(--bg-main);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.badge-count.count-live {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-count.count-ranked {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.search-box {
  position: relative;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 14px 8px 36px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   Live Banner
   ========================================================================== */
.live-banner {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.live-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: #fecaca;
}

.live-banner-title {
  color: #ffffff;
  letter-spacing: 0.02em;
}

.live-banner-hint {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Main Section & Grid
   ========================================================================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* ==========================================================================
   Scoreboard Card
   ========================================================================== */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: var(--shadow-md);
}

.game-card.live-game {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-card) 60px);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.15);
}

.game-card.ranked-showdown {
  border-color: rgba(245, 158, 11, 0.5);
}

.game-card.ranked-showdown::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.game-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.game-status-badge.live {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.game-status-badge.pending-complete {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.game-status-badge.final {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.game-status-badge.scheduled {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.card-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.meta-chip.broadcast {
  color: var(--color-blue);
  border-color: rgba(56, 189, 248, 0.3);
}

.meta-chip.odds {
  color: #fbbf24;
}

.meta-chip.ranked-matchup-chip {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Teams & Scores */
.card-teams {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.team-row.winner {
  font-weight: 700;
}

.team-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.team-rank-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  min-width: 32px;
  text-align: center;
}

.team-rank-badge.top-5 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  box-shadow: 0 0 10px var(--color-gold-glow);
}

.team-rank-badge.top-10 {
  background: #3b82f6;
  color: #fff;
}

.team-rank-badge.top-25 {
  background: var(--bg-surface);
  border: 1px solid #38bdf8;
  color: #38bdf8;
}

.team-rank-badge.unranked {
  background: transparent;
  color: transparent;
  width: 32px;
}

.team-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  flex-shrink: 0;
}

.team-name-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-name {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-row.winner .team-name {
  font-weight: 700;
}

.possession-ball {
  font-size: 0.8rem;
  animation: bounce 1.4s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

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

.team-score {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

.team-row.winner .team-score {
  color: #ffffff;
  font-weight: 800;
}

.team-row.leading .team-score {
  color: #ffffff;
}

/* ==========================================================================
   States: Loading, Empty, Errors
   ========================================================================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: var(--text-secondary);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 60px 24px;
  max-width: 540px;
  margin: 40px auto;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   App Footer
   ========================================================================== */
.app-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dot-separator {
  color: var(--border-color);
}

.footer-deploy-hint {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: inline-block;
  margin: 0 auto;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.footer-deploy-hint code {
  background: var(--bg-main);
  color: var(--color-blue);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .quick-jump-group {
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
  }
  
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    width: 100%;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }
}
