/* Apple-style clean design - Compact version */
:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: #d2d2d7;
  --shadow: rgba(0, 0, 0, 0.04);
  --shadow-hover: rgba(0, 0, 0, 0.08);
  --gold: #af9500;
  --silver: #6b6b6b;
  --bronze: #6a3805;
  --success: #34c759;
  --warning: #ff9500;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  padding: 20px;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1400px;
}

h1 {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1 i {
  background: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation menu */
.nav-menu {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 20px;
  margin-left: -20px;
  margin-right: -20px;
  z-index: 100;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 980px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-item i {
  font-size: 0.8rem;
}

/* Two column grid */
.two-column-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.left-column section {
  margin-bottom: 0;
}

/* Próximos partidos */
.proximos-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.proximos-jornada {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 980px;
  font-size: 1rem;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  align-self: flex-start;
}

.proximos-fecha {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: capitalize;
}

.proximos-fecha i {
  color: #667eea;
  margin-right: 6px;
}

.partido-proximo {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.05));
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: all 0.2s ease;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.partido-proximo:last-child {
  margin-bottom: 0;
}

.partido-proximo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.4);
}

.partido-equipo {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
  flex: 1;
  text-align: center;
}

.partido-vs {
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 980px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.no-proximos {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.no-proximos i {
  font-size: 3rem;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  display: block;
}

.no-proximos p {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Partidos grid */
.partidos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.partidos-column {
  min-width: 0;
}

/* Section compact */
.section-compact {
  padding: 20px;
  margin-bottom: 16px;
}

.section-compact h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
}

/* Accordion */
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.accordion-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
}

.accordion-icon {
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.accordion-icon.rotated {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding-top: 16px;
}

.accordion-content.collapsed {
  max-height: 0;
  padding-top: 0;
}

/* Rules grid */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.rule-card {
  background: var(--bg-primary);
  padding: 16px;
  border-radius: 12px;
  border-top: 3px solid;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rule-card:nth-child(1) {
  border-top-color: #667eea;
}

.rule-card:nth-child(2) {
  border-top-color: #11998e;
}

.rule-card:nth-child(3) {
  border-top-color: #fc4a1a;
}

.rule-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

.rule-card h5 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.rule-card:nth-child(1) h5 i {
  color: #667eea;
  margin-right: 6px;
}

.rule-card:nth-child(2) h5 i {
  color: #11998e;
  margin-right: 6px;
}

.rule-card:nth-child(3) h5 i {
  color: #fc4a1a;
  margin-right: 6px;
}

.rule-card ul {
  padding-left: 16px;
  margin: 0;
}

.rule-card li {
  padding: 3px 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Subsection titles */
.subsection-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #667eea, #764ba2) border-box;
  border-bottom: 2px solid;
  border-image: linear-gradient(135deg, #667eea, #764ba2) 1;
}

.subsection-title i {
  margin-right: 6px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

section {
  scroll-margin-top: 70px;
}

h2 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: none;
}

h2 i {
  margin-right: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

section {
  background-color: var(--bg-secondary);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

section:hover {
  box-shadow: 0 4px 16px var(--shadow-hover);
}

/* Tables - Compact */
table {
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: none;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

th {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-primary);
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: var(--bg-primary);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Results styles */
.resultado-ganador {
  background-color: rgba(52, 199, 89, 0.1);
  color: var(--success);
  font-weight: 600;
}

/* Classification styles */
.clasificacion-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 193, 7, 0.1));
  border-left: 4px solid #ffd700;
}

.clasificacion-1 td:first-child {
  color: #d4a800;
  font-weight: 700;
  font-size: 1.1em;
}

.clasificacion-1 td:nth-child(2) {
  color: #b8860b;
  font-weight: 600;
}

.clasificacion-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(169, 169, 169, 0.1));
  border-left: 4px solid #c0c0c0;
}

.clasificacion-2 td:first-child {
  color: #808080;
  font-weight: 700;
  font-size: 1.05em;
}

.clasificacion-2 td:nth-child(2) {
  color: #696969;
  font-weight: 600;
}

.clasificacion-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(184, 115, 51, 0.1));
  border-left: 4px solid #cd7f32;
}

.clasificacion-3 td:first-child {
  color: #8b4513;
  font-weight: 700;
}

.clasificacion-3 td:nth-child(2) {
  color: #a0522d;
  font-weight: 600;
}

/* Stats cards - Compact & Aligned */
#estadisticas-content .row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

#estadisticas-content .row > div {
  width: 100%;
}

.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 12px;
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
  border: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100px;
  box-sizing: border-box;
}

#estadisticas-content .row > div:nth-child(1) .stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#estadisticas-content .row > div:nth-child(2) .stats-card {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

#estadisticas-content .row > div:nth-child(3) .stats-card {
  background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%);
}

#estadisticas-content .row > div:nth-child(4) .stats-card {
  background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.stats-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stats-number {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  line-height: 1;
}

.stats-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  word-wrap: break-word;
  max-width: 100%;
}

/* Buttons - Compact */
.btn {
  border-radius: 980px;
  padding: 8px 16px;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-outline-primary {
  background: transparent;
  color: #667eea;
  border: 1px solid #667eea;
}

.btn-outline-primary:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Button groups */
.btn-group {
  gap: 6px;
  display: flex;
  flex-wrap: wrap;
}

.btn-group .btn {
  margin-right: 0;
}

/* Badges */
.badge {
  border-radius: 980px;
  font-weight: 500;
  padding: 4px 10px;
  font-size: 0.7rem;
}

.badge.bg-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.badge.bg-warning {
  background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%) !important;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Form controls - Compact */
.form-control {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

/* Alerts */
.alert {
  border-radius: 10px;
  border: none;
  box-shadow: 0 4px 12px var(--shadow);
  font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section {
  animation: fadeIn 0.3s ease-out;
}

/* Responsive design */
@media (max-width: 1024px) {
  .two-column-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 1.5rem;
  }

  section, .section-compact {
    padding: 12px;
    border-radius: 12px;
  }

  /* Stats cards en móvil - 2x2 grid */
  #estadisticas-content .row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stats-card {
    min-height: 80px;
    padding: 12px 8px;
  }

  .stats-number {
    font-size: 1.6rem;
  }

  .stats-label {
    font-size: 0.6rem;
  }

  /* Tabla de clasificación en móvil */
  #clasificacion-content table {
    font-size: 0.7rem;
  }

  #clasificacion-content th,
  #clasificacion-content td {
    padding: 6px 4px;
    white-space: nowrap;
  }

  /* Ocultar columnas menos importantes en móvil */
  #clasificacion-content th:nth-child(7),
  #clasificacion-content td:nth-child(7),
  #clasificacion-content th:nth-child(8),
  #clasificacion-content td:nth-child(8),
  #clasificacion-content th:nth-child(9),
  #clasificacion-content td:nth-child(9) {
    display: none;
  }

  table {
    font-size: 0.75rem;
  }

  th, td {
    padding: 6px 4px;
  }

  .btn-group {
    justify-content: center;
  }

  .nav-menu {
    padding: 10px 12px;
    margin-left: -10px;
    margin-right: -10px;
  }

  .nav-item {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .partidos-search {
    max-width: 100%;
  }

  .search-box .form-control {
    font-size: 0.85rem;
  }
}

/* Filter buttons active state */
.btn-filtrar.btn-primary {
  background: var(--accent);
  color: white;
}

/* Table sorting */
th[onclick], .btn-ordenar {
  cursor: pointer;
  user-select: none;
}

th[onclick]:hover, .btn-ordenar:hover {
  color: var(--accent);
}

th i {
  margin-left: 4px;
  opacity: 0.5;
  font-size: 0.7em;
}

th:hover i {
  opacity: 1;
}

/* Highlighted rows */
tbody tr[style*="background-color"] {
  background-color: rgba(0, 113, 227, 0.08) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Hide search in compact mode */
#clasificacion-content .mb-3 {
  display: none;
}

/* Partidos search box */
.partidos-search {
  max-width: 500px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  z-index: 1;
}

.search-box .form-control {
  padding-left: 40px;
  padding-right: 40px;
  border-radius: 980px;
  border: 2px solid var(--border);
  transition: all 0.3s ease;
}

.search-box .form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.search-box .form-control::placeholder {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  background: var(--text-secondary);
  border: none;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.2s ease;
}

.btn-clear-search:hover {
  background: #667eea;
}

.search-info {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-left: 14px;
}

.search-info .highlight-count {
  color: #667eea;
  font-weight: 600;
}

.search-info .search-term {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 980px;
  font-size: 0.75rem;
  margin-left: 4px;
}

/* Highlighted search results */
#calendario tbody tr.search-highlight,
#resultados tbody tr.search-highlight {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.05)) !important;
  border-left: 3px solid #667eea;
}

#calendario tbody tr.search-hidden,
#resultados tbody tr.search-hidden {
  display: none;
}
