/* ============================================
   2026 FIFA World Cup — Standings Page
   ============================================ */

/* ── Standings Layout ── */
.standings-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.standings-mode-toggle {
  display: flex;
  gap: var(--space-2);
}

/* ── Group Panel ── */
.group-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.group-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

.group-panel-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.group-letter {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--text-on-primary);
  font-weight: var(--font-extrabold);
  font-size: var(--text-base);
}

/* ── Standings Table ── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.standings-table th {
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.standings-table th:first-child {
  text-align: left;
  padding-left: var(--space-6);
}

.standings-table th:not(:first-child) {
  text-align: center;
  min-width: 40px;
}

.standings-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.standings-table td:first-child {
  text-align: left;
  padding-left: var(--space-6);
}

.standings-table tbody tr {
  transition: background var(--duration-fast) var(--ease-default);
}

.standings-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Qualification highlighting */
.standings-table tr.qualified-auto {
  background: rgba(34, 197, 94, 0.06);
}

.standings-table tr.qualified-auto td:first-child {
  border-left: 3px solid var(--color-success);
}

.standings-table tr.qualified-third {
  background: rgba(245, 158, 11, 0.06);
}

.standings-table tr.qualified-third td:first-child {
  border-left: 3px solid var(--color-warning);
}

.standings-table tr.eliminated {
  opacity: 0.5;
}

.standings-table tr.eliminated td:first-child {
  border-left: 3px solid var(--color-danger);
}

/* Team cell */
.standings-team {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.standings-pos {
  font-weight: var(--font-bold);
  color: var(--text-tertiary);
  min-width: 20px;
  font-size: var(--text-sm);
}

.standings-flag {
  font-size: 1.4rem;
  line-height: 1;
}

.standings-name {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  white-space: nowrap;
}

.standings-pts {
  font-weight: var(--font-extrabold);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: var(--text-base);
}

.standings-gd {
  font-weight: var(--font-semibold);
}

.standings-gd.positive { color: var(--color-success); }
.standings-gd.negative { color: var(--color-danger); }
.standings-gd.zero { color: var(--text-tertiary); }

/* ── Qualification Legend ── */
.standings-legend {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.legend-dot {
  width: 12px;
  height: 4px;
  border-radius: var(--radius-full);
}

.legend-dot.auto { background: var(--color-success); }
.legend-dot.third { background: var(--color-warning); }
.legend-dot.out { background: var(--color-danger); }

/* ── Calculator Section ── */
.calculator-section {
  margin-top: var(--space-8);
}

.calculator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.calculator-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.calculator-reset {
  font-size: var(--text-sm);
}

.calc-match-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.calc-match {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.calc-match-teams {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  font-size: var(--text-sm);
}

.calc-match-vs {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.calc-match-result {
  font-weight: var(--font-bold);
  font-family: var(--font-heading);
  min-width: 50px;
  text-align: center;
}

/* ── All Groups Grid View ── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--space-6);
}

/* ── Best Third Place Table ── */
.third-place-section {
  margin-top: var(--space-8);
  padding: var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
}

.third-place-section h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--text-gold);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .groups-grid {
    grid-template-columns: 1fr;
  }

  .standings-table th,
  .standings-table td {
    padding: var(--space-2) var(--space-2);
    font-size: var(--text-xs);
  }

  .standings-table th:first-child,
  .standings-table td:first-child {
    padding-left: var(--space-3);
  }

  .calc-match {
    flex-direction: column;
    gap: var(--space-2);
  }

  .standings-legend {
    gap: var(--space-3);
  }
}
