/* ============================================
   AceLab - Tennis Tactical Analysis
   Design Tokens from Landing Page
   ============================================ */

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

:root {
  --court-green: #1a5c38;
  --deep-green: #0d2e1c;
  --ball-yellow: #ccff00;
  --chalk-white: #f5f5f0;
  --warm-gray: #8a8a80;
  --line-white: #ffffff;
  --card-bg: rgba(26, 92, 56, 0.15);
  --card-border: rgba(204, 255, 0, 0.1);
  --card-hover: rgba(204, 255, 0, 0.05);
  --danger: #ff4444;
  --surface-clay: #c4622d;
  --surface-hard: #3a7bd5;
  --surface-grass: #2ecc71;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--deep-green);
  color: var(--chalk-white);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ============================================
   Navigation
   ============================================ */

nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(13, 46, 28, 0.85);
  border-bottom: 1px solid rgba(204, 255, 0, 0.08);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ball-yellow);
  letter-spacing: -0.5px;
  cursor: pointer;
}

.logo span {
  color: var(--chalk-white);
  font-weight: 400;
}

.nav-tag {
  font-size: 0.7rem;
  color: var(--warm-gray);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--chalk-white);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 1;
  color: var(--ball-yellow);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem 2rem 4rem;
  position: relative;
  overflow: hidden;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-glow {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204, 255, 0, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(204, 255, 0, 0.08);
  border: 1px solid rgba(204, 255, 0, 0.15);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--ball-yellow);
  margin-bottom: 2rem;
  letter-spacing: 0.5px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--ball-yellow);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -1px;
}

.highlight {
  color: var(--ball-yellow);
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--warm-gray);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.8rem;
  background: var(--ball-yellow);
  color: var(--deep-green);
  border: none;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.2px;
}

.btn-primary:hover {
  background: #d9ff33;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(204, 255, 0, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.8rem;
  background: transparent;
  color: var(--chalk-white);
  border: 1px solid rgba(245, 245, 240, 0.2);
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--ball-yellow);
  color: var(--ball-yellow);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--warm-gray);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-back:hover {
  color: var(--ball-yellow);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(204, 255, 0, 0.08);
  color: var(--ball-yellow);
  border: 1px solid rgba(204, 255, 0, 0.15);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: rgba(204, 255, 0, 0.15);
}

.btn-analyze {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  background: var(--ball-yellow);
  color: var(--deep-green);
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-analyze:hover {
  background: #d9ff33;
}

/* ============================================
   Hero Stats
   ============================================ */

.hero-stats {
  display: flex;
  gap: 2rem;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(26, 92, 56, 0.2);
  border: 1px solid rgba(204, 255, 0, 0.08);
  border-radius: 12px;
  max-width: fit-content;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ball-yellow);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--warm-gray);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(204, 255, 0, 0.15);
}

/* ============================================
   Court Animation
   ============================================ */

.hero-court {
  position: absolute;
  bottom: 0;
  right: -5%;
  width: 500px;
  height: 300px;
  opacity: 0.06;
  pointer-events: none;
}

.court-line {
  position: absolute;
  background: var(--ball-yellow);
}

.court-line-1 {
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 2px;
}

.court-line-2 {
  bottom: 0;
  left: 10%;
  width: 2px;
  height: 200px;
}

.court-line-3 {
  bottom: 0;
  right: 10%;
  width: 2px;
  height: 200px;
}

.court-ball {
  position: absolute;
  bottom: 120px;
  left: 45%;
  width: 12px;
  height: 12px;
  background: var(--ball-yellow);
  border-radius: 50%;
  animation: bounce 3s ease-in-out infinite;
}

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

/* ============================================
   Matches Section
   ============================================ */

.matches-section {
  min-height: 100vh;
  padding: 6rem 2rem 4rem;
  max-width: 1000px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
}

/* ============================================
   Match Cards
   ============================================ */

.tournament-group {
  margin-bottom: 2.5rem;
}

.tournament-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(204, 255, 0, 0.1);
}

.tournament-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ball-yellow);
}

.tournament-surface {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.surface-terre-battue, .surface-clay {
  background: rgba(196, 98, 45, 0.2);
  color: var(--surface-clay);
  border: 1px solid rgba(196, 98, 45, 0.3);
}

.surface-dur, .surface-hard {
  background: rgba(58, 123, 213, 0.2);
  color: var(--surface-hard);
  border: 1px solid rgba(58, 123, 213, 0.3);
}

.surface-gazon, .surface-grass {
  background: rgba(46, 204, 113, 0.2);
  color: var(--surface-grass);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.tour-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.tour-atp {
  background: rgba(0, 102, 204, 0.2);
  color: #4da6ff;
  border: 1px solid rgba(0, 102, 204, 0.3);
}

.tour-wta {
  background: rgba(180, 50, 150, 0.2);
  color: #e066c0;
  border: 1px solid rgba(180, 50, 150, 0.3);
}

.match-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.match-card:hover {
  background: var(--card-hover);
  border-color: rgba(204, 255, 0, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.match-players {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.player {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.player-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--chalk-white);
}

.player-info {
  font-size: 0.8rem;
  color: var(--warm-gray);
}

.player-right {
  text-align: right;
}

.vs-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ball-yellow);
  padding: 0 1rem;
  opacity: 0.6;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.match-round {
  font-size: 0.8rem;
  color: var(--warm-gray);
}

.match-h2h {
  font-size: 0.8rem;
  color: var(--warm-gray);
}

.match-h2h strong {
  color: var(--chalk-white);
}

.analysis-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  font-weight: 500;
}

.analysis-ready {
  background: rgba(204, 255, 0, 0.1);
  color: var(--ball-yellow);
  border: 1px solid rgba(204, 255, 0, 0.2);
}

.analysis-pending {
  background: rgba(138, 138, 128, 0.1);
  color: var(--warm-gray);
  border: 1px solid rgba(138, 138, 128, 0.2);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5rem 1rem 2rem;
  overflow-y: auto;
}

.modal {
  background: #0f3d24;
  border: 1px solid rgba(204, 255, 0, 0.12);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  padding: 2rem;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--warm-gray);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(204, 255, 0, 0.1);
  color: var(--ball-yellow);
}

.modal-match-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(204, 255, 0, 0.1);
}

.modal-tournament {
  font-size: 0.85rem;
  color: var(--ball-yellow);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-players {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal-info {
  font-size: 0.85rem;
  color: var(--warm-gray);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.analysis-section {
  margin-bottom: 1.5rem;
}

.analysis-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ball-yellow);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analysis-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--ball-yellow);
  border-radius: 2px;
}

.analysis-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: rgba(245, 245, 240, 0.85);
}

.tactical-keys {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tactical-key {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: rgba(245, 245, 240, 0.85);
  padding: 0.6rem 0.8rem;
  background: rgba(204, 255, 0, 0.04);
  border-radius: 8px;
  border-left: 2px solid rgba(204, 255, 0, 0.3);
}

.tactical-key::before {
  content: '>';
  color: var(--ball-yellow);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  flex-shrink: 0;
}

.strengths-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.strengths-col h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--chalk-white);
}

.strength-item {
  font-size: 0.85rem;
  color: rgba(245, 245, 240, 0.75);
  padding: 0.35rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.strength-item::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--ball-yellow);
  border-radius: 50%;
  flex-shrink: 0;
}

.factors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.factor-tag {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  background: rgba(204, 255, 0, 0.06);
  border: 1px solid rgba(204, 255, 0, 0.12);
  border-radius: 100px;
  color: rgba(245, 245, 240, 0.8);
}

.no-analysis {
  text-align: center;
  padding: 2rem;
  color: var(--warm-gray);
}

.no-analysis p {
  margin-bottom: 1rem;
}

/* ============================================
   Loading / Empty States
   ============================================ */

.loading-state, .empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  color: var(--warm-gray);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--warm-gray);
  margin-bottom: 1.5rem;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(204, 255, 0, 0.15);
  border-top-color: var(--ball-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.loader-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

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

/* ============================================
   Refresh Overlay
   ============================================ */

.refresh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-modal {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.refresh-modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.refresh-modal p {
  color: var(--warm-gray);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  padding: 3rem 2rem;
  border-top: 1px solid rgba(204, 255, 0, 0.06);
  text-align: center;
}

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
}

.footer-text {
  color: var(--warm-gray);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  nav {
    padding: 0.8rem 1rem;
  }

  .nav-tag {
    display: none;
  }

  .hero {
    padding: 6rem 1.2rem 3rem;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stat-divider {
    width: 40px;
    height: 1px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .matches-section {
    padding: 5rem 1rem 3rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .match-players {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .player, .player-right {
    text-align: center;
  }

  .vs-badge {
    padding: 0.3rem 0;
  }

  .modal {
    padding: 1.2rem;
    margin: 0 0.5rem;
  }

  .modal-players {
    font-size: 1.2rem;
  }

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

  .hero-court {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .match-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
