/* ==================================================
   RESULTADOS - EXTENSÃO DO TEMA GLOBAL (CABULOSO NEWS)
   ================================================== */

/* NOTA: Este arquivo depende do 'style.css' ser carregado antes.
   Ele herda: --primary, --accent, --gray-*, --radius-*, etc.
*/

/* ==================================================
   PAGE HERO (Cabeçalho da Página)
   ================================================== */

.page-hero {
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: calc(70px + var(--space-8)) 0 var(--space-8); /* 70px do menu fixo */
  overflow: hidden;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--space-10);
}

.page-hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-image: 
    radial-gradient(circle at 20% 30%, var(--accent) 0%, transparent 20%),
    radial-gradient(circle at 80% 80%, var(--white) 0%, transparent 20%);
}

.page-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.15);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-badge i {
  color: var(--accent); /* Ouro */
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  letter-spacing: 2px;
  line-height: 1;
  margin-bottom: var(--space-2);
  text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--gray-200);
  font-weight: 400;
}

/* ==================================================
   STATS PREVIEW (No Header)
   ================================================== */

.header-stats-preview {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.stat-preview {
  background: rgba(0, 0, 0, 0.25);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 110px;
  backdrop-filter: blur(4px);
  transition: var(--transition);
  text-align: center;
}

.stat-preview:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stat-preview .stat-number {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent); /* Ouro */
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.stat-preview .stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-300);
  font-weight: 500;
}

/* ==================================================
   CONTROLS BAR (Botão Atualizar)
   ================================================== */

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  gap: var(--space-4);
  border: 1px solid var(--gray-100);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9rem;
  color: var(--gray-600);
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ==================================================
   DASHBOARD DE ESTATÍSTICAS
   ================================================== */

.statistics-dashboard {
  margin-bottom: var(--space-8);
}

.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  align-items: flex-start !important;
}

@media (min-width: 768px) {
  .dashboard-header {
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
  }
}

.competition-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: thin;
  margin-top: var(--space-2);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: var(--transition);
  cursor: pointer;
}

.tab-btn:hover {
  background: var(--gray-50);
  color: var(--primary);
  border-color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.tab-btn.active i {
  color: var(--accent);
}

/* Container que recebe os cards gerados via JS */
.stats-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
}

/* Estilo para os cards de estatística individuais (ex: Vitórias, Gols) */
.stat-card-item {
    background: var(--white);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-card-item .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font-display);
}

.stat-card-item .label {
    color: var(--gray-500);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================================================
   HISTÓRICO HORIZONTAL
   ================================================== */

.horizontal-history-section {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.horizontal-history-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.horizontal-matches {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--gray-100);
}

.horizontal-matches::-webkit-scrollbar {
  height: 8px;
}

.horizontal-matches::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--radius-full);
}

.horizontal-matches::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}

.horizontal-match-card {
  flex: 0 0 280px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.horizontal-match-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

/* Barra lateral colorida */
.horizontal-match-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.horizontal-match-card.vitoria::before { background: var(--success); }
.horizontal-match-card.empate::before { background: var(--warning); }
.horizontal-match-card.derrota::before { background: var(--error); }

/* Garantir tamanho uniforme dos escudos */
.team-logo-uniform {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px;
  min-height: 48px;
  object-fit: contain !important;
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 4px;
  border: 1px solid var(--gray-200);
}

/* Estilo para cards em visão horizontal */
.horizontal-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--gray-100);
}

.horizontal-card-teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.horizontal-card-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  width: 40%;
}

.horizontal-card-team span {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horizontal-card-team span.home {
  color: var(--primary);
  font-weight: 700;
}

.horizontal-card-score {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gray-900);
  letter-spacing: 1px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==================================================
   TABELA DE RESULTADOS
   ================================================== */

.results-section {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

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

.view-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--gray-100);
  color: var(--gray-500);
  transition: var(--transition);
}

.view-btn:hover {
  color: var(--primary);
  background: var(--gray-200);
}

.view-btn.active {
  background: var(--primary);
  color: var(--white);
}

/* Layout da Tabela */
.table-container {
  overflow-x: auto;
  margin: var(--space-4) 0;
}

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}

.results-table th {
  background: var(--gray-50);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
}

.results-table th:hover {
  color: var(--primary);
  background: var(--gray-100);
}

.results-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  font-size: 0.95rem;
  vertical-align: middle;
}

.results-table tr:hover td {
  background: var(--gray-50);
}

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

/* Conteúdo da Célula */
.match-teams {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  color: var(--gray-900);
}

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

.vs {
  color: var(--gray-400);
  font-size: 0.8rem;
  font-weight: 400;
}

.team-name.home {
  color: var(--primary);
  font-weight: 700;
}

/* Badges de Resultado */
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 80px;
}

/* Cores Baseadas no styles.css */
.result-badge.vitoria {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.result-badge.empate {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.result-badge.derrota {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* ==================================================
   CARDS VIEW
   ================================================== */

.results-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.match-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.match-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

/* Barra lateral colorida no card */
.match-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.match-card.vitoria::before { background: var(--success); }
.match-card.empate::before { background: var(--warning); }
.match-card.derrota::before { background: var(--error); }

.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--gray-100);
}

.card-teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.card-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  width: 35%;
}

.card-team img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.card-team span {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.card-team span.home {
  color: var(--primary);
  font-weight: 700;
}

.card-score {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gray-900);
  letter-spacing: 2px;
  font-weight: 700;
}

/* ==================================================
   PAGINATION
   ================================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--gray-100);
}

.page-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-600);
  font-weight: 500;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--gray-50);
}

/* ==================================================
   LOADING, ERROR & EMPTY STATES
   ================================================== */

.loading-state, .error-state, .empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--gray-500);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto var(--space-4);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.btn-retry {
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-6);
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-retry:hover {
  background: var(--primary-dark);
}

/* ==================================================
   TOAST NOTIFICATIONS
   ================================================== */

.toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 350px;
}

.toast {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid var(--gray-300);
  animation: slideInRight 0.3s ease-out;
  transform: translateX(0);
  opacity: 1;
  transition: all 0.3s ease;
}

.toast.fade-out {
  transform: translateX(100%);
  opacity: 0;
}

.toast-success {
  border-left-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.toast-error {
  border-left-color: var(--error);
  background: rgba(239, 68, 68, 0.05);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toast-content i {
  font-size: 1.2rem;
}

.toast-success .toast-content i { color: var(--success); }
.toast-error .toast-content i { color: var(--error); }

.toast-close {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius);
  transition: var(--transition);
}

.toast-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ==================================================
   RESPONSIVIDADE
   ================================================== */

@media (max-width: 768px) {
  .horizontal-matches {
    gap: var(--space-3);
  }
  
  .horizontal-match-card {
    flex: 0 0 250px;
    padding: var(--space-3);
  }
  
  .horizontal-card-score {
    font-size: 1.5rem;
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  
  .competition-tabs {
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }
  
  .results-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .header-stats-preview {
    gap: var(--space-3);
  }
  
  .stat-preview {
    min-width: calc(50% - var(--space-3));
    padding: var(--space-2);
  }
  
  .stat-preview .stat-number {
    font-size: 1.5rem;
  }
  
  .view-toggle span {
    display: none;
  }

  .results-table th, 
  .results-table td {
    padding: var(--space-3);
    font-size: 0.85rem;
  }
  
  .horizontal-match-card {
    flex: 0 0 220px;
  }
  
  .team-logo-uniform {
    width: 36px !important;
    height: 36px !important;
  }
}