/* ============================================================
   FIFA World Cup 2026 - Styles
   ============================================================ */

:root {
  --primary: #5b0a3a;
  --primary-light: #8b1a5a;
  --accent: #e8a838;
  --accent-light: #f5c563;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6c757d;
  --border: #dee2e6;
  --success: #28a745;
  --win: #d4edda;
  --draw: #fff3cd;
  --loss: #f8d7da;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 2rem 1rem 0;
  text-align: center;
}

.header-content h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 1rem;
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding-bottom: 0;
}

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
  color: var(--primary);
  background: var(--bg);
}

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

/* Groups Grid */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.group-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.group-card:hover {
  box-shadow: var(--shadow-hover);
}

.group-card h3 {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.group-card ul {
  list-style: none;
  padding: 0.5rem 0;
}

.group-card li {
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.group-card li:last-child {
  border-bottom: none;
}

.country-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Standings Table */
.standings-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 0;
}

.standings-card h3 {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.standings-table th {
  background: var(--bg);
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-weight: 700;
  color: var(--text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.standings-table th:first-child {
  text-align: left;
  padding-left: 1rem;
}

.standings-table td {
  padding: 0.5rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.standings-table td:first-child {
  text-align: left;
  padding-left: 1rem;
  font-weight: 600;
}

.standings-table tr:last-child td {
  border-bottom: none;
}

.standings-table .points {
  font-weight: 800;
  color: var(--primary);
}

/* Matches */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.match-card .team-home {
  text-align: right;
  font-weight: 600;
}

.match-card .team-away {
  text-align: left;
  font-weight: 600;
}

.match-score {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--bg);
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
}

.match-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.stage-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Vote */
.vote-description {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.vote-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.vote-btn:hover {
  border-color: var(--accent);
  background: #fffbf0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

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

.vote-btn.voted {
  border-color: var(--success);
  background: var(--win);
}

.feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
}

.feedback.success {
  background: var(--win);
  color: #155724;
}

.feedback.error {
  background: var(--loss);
  color: #721c24;
}

.hidden {
  display: none;
}

/* Results */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.result-bar .bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(232, 168, 56, 0.15), rgba(232, 168, 56, 0.05));
  border-radius: var(--radius);
  transition: width 0.5s ease;
}

.result-bar .team-name {
  font-weight: 600;
  z-index: 1;
  flex: 1;
}

.result-bar .vote-count {
  font-size: 0.85rem;
  color: var(--text-light);
  z-index: 1;
}

.result-bar .percentage {
  font-weight: 800;
  color: var(--primary);
  z-index: 1;
  min-width: 50px;
  text-align: right;
}

.no-results {
  text-align: center;
  color: var(--text-light);
  padding: 3rem;
  font-size: 1.1rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

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

/* Responsive */
@media (max-width: 600px) {
  .header-content h1 {
    font-size: 1.6rem;
  }

  .nav-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
  }

  .match-card {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.5rem;
  }

  .match-card .team-home,
  .match-card .team-away {
    text-align: center;
  }

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

  .vote-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
