/* ========================================
   BRASILEIRÃO 2026 - TABELA (TEMA WHITE)
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Variables (WHITE THEME) ---------- */
:root {
  --bg-primary: #f0f2f5;
  --bg-secondary: #e8eaef;
  --bg-card: #ffffff;
  --bg-row-hover: #f0f3ff;
  --bg-row-even: #f7f8fb;
  --bg-row-odd: #ffffff;

  --text-primary: #2d3142;
  --text-secondary: #6b7084;
  --text-muted: #9498a8;
  --text-accent: #1a1d2e;

  --green-libertadores: #16a34a;
  --green-libertadores-bg: rgba(22, 163, 74, 0.08);
  --orange-sulamericana: #ea8500;
  --orange-sulamericana-bg: rgba(234, 133, 0, 0.08);
  --red-rebaixamento: #dc2626;
  --red-rebaixamento-bg: rgba(220, 38, 38, 0.08);

  --border-color: #e0e2e9;
  --border-light: #ebedf2;

  --accent-gradient: linear-gradient(135deg, #104b97, #104b97a8);
  --header-gradient: linear-gradient(135deg, #f8f9ff, #eef0ff);

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Loading ---------- */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 24px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

/* ---------- Header ---------- */
.main-header {
  background: var(--header-gradient);
  border-bottom: 1px solid var(--border-color);
  padding: 28px 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(79, 70, 229, 0.06);
}

.main-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(79, 70, 229, 0.05), transparent 70%);
  pointer-events: none;
}

.header-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.header-icon {
  width: 52px;
  height: 52px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25);
}

.header-info h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-accent);
  letter-spacing: -0.5px;
}

.header-info .subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.header-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.8rem;
  color: #104b97;
  font-weight: 500;
}

.header-badge .dot {
  width: 8px;
  height: 8px;
  background: #16a34a;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---------- Main Layout ---------- */
.main-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

/* ---------- Card Base ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(79, 70, 229, 0.02);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ---------- Standings Table ---------- */
.standings-table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table thead th {
  padding: 12px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: #f7f8fb;
  position: sticky;
  top: 0;
  z-index: 2;
}

.standings-table thead th:nth-child(1) { width: 44px; }
.standings-table thead th:nth-child(2) { width: 28px; }
.standings-table thead th:nth-child(3) { text-align: left; padding-left: 0; }

.standings-table tbody tr {
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-light);
}

.standings-table tbody tr:hover {
  background: var(--bg-row-hover);
}

.standings-table tbody tr:nth-child(even) {
  background: var(--bg-row-even);
}
.standings-table tbody tr:nth-child(even):hover {
  background: var(--bg-row-hover);
}

.standings-table tbody td {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Position column */
.pos-cell {
  position: relative;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pos-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: 700;
}

/* Zone indicators */
.zone-libertadores .pos-number {
  background: var(--green-libertadores-bg);
  color: var(--green-libertadores);
  border: 1px solid rgba(22, 163, 74, 0.25);
}
.zone-sulamericana .pos-number {
  background: var(--orange-sulamericana-bg);
  color: var(--orange-sulamericana);
  border: 1px solid rgba(234, 133, 0, 0.25);
}
.zone-rebaixamento .pos-number {
  background: var(--red-rebaixamento-bg);
  color: var(--red-rebaixamento);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

/* Row zone highlight */
tr.zone-libertadores {
  border-left: 3px solid var(--green-libertadores);
}
tr.zone-sulamericana {
  border-left: 3px solid var(--orange-sulamericana);
}
tr.zone-rebaixamento {
  border-left: 3px solid var(--red-rebaixamento);
}

/* Team cell */
.team-cell {
  text-align: left !important;
  padding-left: 0 !important;
}

.team-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.team-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variation cell */
.var-cell { width: 28px; }

.variation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  gap: 1px;
}

.variation.up { color: var(--green-libertadores); }
.variation.down { color: var(--red-rebaixamento); }
.variation.same { color: var(--text-muted); }

.variation .arrow {
  font-size: 0.6rem;
}

/* Points column */
.pts-cell {
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  color: var(--text-accent) !important;
}

.pct-cell {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
}

/* ---------- Zone Legend ---------- */
.zone-legend {
  display: flex;
  gap: 20px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  background: #f7f8fb;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.lib { background: var(--green-libertadores); }
.legend-dot.sula { background: var(--orange-sulamericana); }
.legend-dot.reb { background: var(--red-rebaixamento); }

/* ---------- Stat Legend ---------- */
.stat-legend {
  display: flex;
  gap: 10px;
  padding: 10px 22px;
  border-top: 1px solid var(--border-color);
  background: #f7f8fb;
  flex-wrap: wrap;
}

.stat-legend-item {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.stat-legend-item strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Matches Panel ---------- */
.matches-panel {
  position: sticky;
  top: 24px;
}

.round-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #f7f8fb;
}

.round-nav-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.round-nav-btn:hover {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.3);
  color: #4f46e5;
}

.round-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.round-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Match list */
.matches-list {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.matches-list::-webkit-scrollbar {
  width: 4px;
}
.matches-list::-webkit-scrollbar-track {
  background: transparent;
}
.matches-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.match-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.match-item:hover {
  background: rgba(79, 70, 229, 0.03);
}

.match-item:last-child {
  border-bottom: none;
}

.match-stadium {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.match-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.match-team.home {
  justify-content: flex-end;
}

.match-team.away {
  justify-content: flex-start;
}

.match-team-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
}

.match-team-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: 0.3px;
}

.match-score {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 70px;
  justify-content: center;
}

.match-score .score-number {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-accent);
  min-width: 24px;
  text-align: center;
}

.match-score .score-separator {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.match-score.scheduled {
  /* Scheduled match */
}

.match-score.scheduled .score-number {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.match-datetime {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
  text-transform: uppercase;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .main-container {
    grid-template-columns: 1fr;
  }

  .matches-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  html { font-size: 13px; }

  .main-container {
    padding: 16px 16px 60px 16px;
    gap: 16px;
  }

  .header-content {
    flex-wrap: wrap;
  }

  .header-badge {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .team-name {
    max-width: 120px;
  }

  .standings-table thead th,
  .standings-table tbody td {
    padding: 8px 5px;
    font-size: 0.75rem;
  }

  .zone-legend {
    gap: 12px;
  }
}

@media (max-width: 500px) {
  .hide-mobile {
    display: none !important;
  }

  .standings-table thead th,
  .standings-table tbody td {
    padding: 8px 3px;
    font-size: 0.72rem;
  }

  .team-logo { width: 20px; height: 20px; }
  .team-name { font-size: 0.75rem; max-width: 90px; }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.standings-table tbody tr {
  animation: fadeInUp 0.3s ease both;
}

.standings-table tbody tr:nth-child(1)  { animation-delay: 0.02s; }
.standings-table tbody tr:nth-child(2)  { animation-delay: 0.04s; }
.standings-table tbody tr:nth-child(3)  { animation-delay: 0.06s; }
.standings-table tbody tr:nth-child(4)  { animation-delay: 0.08s; }
.standings-table tbody tr:nth-child(5)  { animation-delay: 0.10s; }
.standings-table tbody tr:nth-child(6)  { animation-delay: 0.12s; }
.standings-table tbody tr:nth-child(7)  { animation-delay: 0.14s; }
.standings-table tbody tr:nth-child(8)  { animation-delay: 0.16s; }
.standings-table tbody tr:nth-child(9)  { animation-delay: 0.18s; }
.standings-table tbody tr:nth-child(10) { animation-delay: 0.20s; }
.standings-table tbody tr:nth-child(11) { animation-delay: 0.22s; }
.standings-table tbody tr:nth-child(12) { animation-delay: 0.24s; }
.standings-table tbody tr:nth-child(13) { animation-delay: 0.26s; }
.standings-table tbody tr:nth-child(14) { animation-delay: 0.28s; }
.standings-table tbody tr:nth-child(15) { animation-delay: 0.30s; }
.standings-table tbody tr:nth-child(16) { animation-delay: 0.32s; }
.standings-table tbody tr:nth-child(17) { animation-delay: 0.34s; }
.standings-table tbody tr:nth-child(18) { animation-delay: 0.36s; }
.standings-table tbody tr:nth-child(19) { animation-delay: 0.38s; }
.standings-table tbody tr:nth-child(20) { animation-delay: 0.40s; }

.match-item {
  animation: fadeInUp 0.25s ease both;
}
