:root {
  --celeste-primario: var(--primary-color);
  --celeste-claro: var(--primary-light);
  --celeste-oscuro: var(--primary-dark);
  --fondo-secundario: var(--secondary-color);
  --texto-principal: var(--text-color);
  --texto-secundario: var(--light-text);
  --blanco: var(--white);
  --negro: var(--black);
  --verde-positivo: #66bb6a;
  --naranja-neutral: #ffb74d;
  --rojo-negativo: #d62727;
}

/* cards */
.card {
  background: var(--blanco);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* Header */
.historicos-header h1 {
  color: var(--negro);
  font-size: 2.2rem;
  margin-bottom: 2rem;
  font-weight: 600;
}

/* Filtros */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--texto-principal);
  font-weight: 500;
}

.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--fondo-secundario);
  border-radius: 8px;
  background: var(--blanco);
  color: var(--texto-principal);
}

.form-submit {
  display: flex;
  align-items: flex-end;
}

.form-submit button {
  background: var(--celeste-primario);
  color: var(--blanco);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-submit button:hover {
  background: var(--negro);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--celeste-primario);
}

.stats-table th {
  background: var(--celeste-primario);
  color: var(--blanco);
  padding: 1rem;
  text-align: center;
  font-weight: 500;
}

.stats-table td {
  padding: 1rem;
  text-align: center;
  border-top: 1px solid var(--fondo-secundario);
}

.stats-table tbody tr:nth-child(odd) {
  background: var(--fondo-secundario);
}

/* Colores para estadísticas */
.win,
.win-percentage,
.goals-for {
  color: var(--verde-positivo);
  font-weight: 600;
}

.loss,
.goals-against {
  color: var(--rojo-negativo);
}

.draw {
  color: var(--naranja-neutral);
}

/* Tabla de partidos */
.matches-card h2 {
  color: var(--negro);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.table-container {
  overflow-x: auto;
}

.matches-table {
  width: 100%;
  border-collapse: collapse;
}

.matches-table th {
  background: var(--celeste-primario);
  color: var(--blanco);
  padding: 1rem;
  text-align: left;
  font-weight: 500;
}

.matches-table td {
  padding: 1rem;
  border-top: 1px solid var(--fondo-secundario);
}

.matches-table tbody tr:nth-child(odd) {
  background: var(--fondo-secundario);
}

/* Estilos para filas según resultado */
.win-row {
  border-left: 4px solid var(--verde-positivo);
}

.loss-row {
  border-left: 4px solid var(--rojo-negativo);
}

.draw-row {
  border-left: 4px solid var(--naranja-neutral);
}

/* Badges y botones */
.badge {
  padding: 0.375rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
}

.local {
  background: var(--celeste-claro);
  color: var(--negro);
}

.visitor {
  background: var(--fondo-secundario);
  color: var(--texto-principal);
}

.team-goal {
  font-weight: 600;
  color: var(--celeste-primario);
}

.info-btn {
  color: var(--celeste-primario);
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.info-btn:hover {
  color: var(--negro);
  transform: scale(1.1);
}

.no-matches {
  text-align: center;
  padding: 2rem;
  color: var(--texto-secundario);
}

@media (max-width: 768px) {

  .historicos-container {
    padding: 1rem;
  }

  .filter-form {
    flex-direction: column;
    gap: 1rem;
  }

  .form-group,
  .form-submit button {
    width: 100%;
  }

  .form-submit button {
    justify-content: center;
  }

  .botones-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
  }

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

  .matches-table thead {
    display: none;
  }

  .matches-table tr {
    display: block;
    background: var(--blanco);
    text-align: center;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border-left-width: 5px;
    border-left-style: solid;
  }

  .matches-table td:nth-child(4),
  .matches-table td:nth-child(6) {
    display: none;
  }

  .matches-table td {
    display: block;
    border: none;
    padding: 0;
  }

  .matches-table td:nth-child(3) {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--texto-principal);
    margin-bottom: 0.5rem;
  }

  .matches-table td:nth-child(5) {
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: 0.75rem;
  }

  .team-goal {
    font-size: 1.1em;
    color: var(--celeste-primario);
  }

  .matches-table td:nth-child(1),
  .matches-table td:nth-child(2) {
    font-size: 0.9rem;
    color: var(--texto-secundario);
    line-height: 1.4;
  }

  .matches-table td:nth-child(7) {
    margin-top: 1rem;
  }

  .info-btn {
    font-size: 1.5rem;
    color: var(--celeste-primario);
  }

  .stats-table thead {
        display: none;
  }

  .stats-table tr {
      display: block;
      margin-bottom: 1rem;
      border: 1px solid #ddd;
  }

  .stats-table td {
      display: block;
      text-align: right;
      padding-right: 15px;
      position: relative;
  }

  .stats-table td::before { 
      content: attr(data-label);
      position: absolute;
      left: 15px;
      font-weight: bold;
      text-align: left;
  }
}