/* Variables CSS - Diseño Clean y Profesional */
:root {
  --primary-color: #1f2937;
  --primary-light: #374151;
  --secondary-color: #6b7280;
  --accent-color: #2563eb;
  --success-color: #059669;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-800: #1f2937;
  --white: #ffffff;
  --border-color: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--gray-50);
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

/* Contenedor principal optimizado */
.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.results-section {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
  display: none;
}

.results-section.active {
  display: block;
}

.section-header {
  background: var(--gray-100);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Tabla optimizada - SIN SCROLL VERTICAL */
.table-container {
  overflow-x: auto;
  /* Removido max-height para eliminar scroll vertical */
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  background: var(--white);
  margin: 0;
}

.results-table thead {
  background: var(--primary-color);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.results-table th {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.results-table th:last-child {
  border-right: none;
}

.results-table td {
  padding: 0.6rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-100);
  font-weight: 500;
  white-space: nowrap;
}

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

.results-table tbody tr:nth-child(even) {
  background-color: var(--gray-50);
}

.results-table tbody tr:hover {
  background-color: #e0f2fe;
}

/* Columnas específicas */
.pos-col { width: 50px; font-weight: 700; color: var(--accent-color); }
.dorsal-col { width: 60px; font-weight: 600; }
.categoria-col { width: 50px; font-weight: 600; font-size: 0.9rem; }
.name-col { 
  min-width: 180px; 
  max-width: 250px;
  text-align: left !important; 
  font-weight: 600;
  padding-left: 0.7rem !important;
}
.series-col { width: 45px; font-weight: 600; }
.total-col { 
  width: 60px; 
  font-weight: 700; 
  color: var(--accent-color);
}
.totalseries-col,
.shotoff-col,
.playoff-col,
.finalshotoff-col {
  width: 55px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Posiciones destacadas - Mejorado para mayor visibilidad */
.first td {
  background: linear-gradient(to right, rgba(255, 215, 0, 0.25), rgba(255, 193, 7, 0.1)) !important;
  border-left: 4px solid #ffd700 !important;
  font-weight: 700;
  font-size: 1.05em;
  box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.15);
  color: #b8860b !important;
}

.first .pos-col,
.first .total-col {
  color: #b8860b !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(184, 134, 11, 0.2);
}

.second td {
  background: linear-gradient(to right, rgba(192, 192, 192, 0.25), rgba(169, 169, 169, 0.1)) !important;
  border-left: 4px solid #c0c0c0 !important;
  font-weight: 700;
  font-size: 1.03em;
  box-shadow: inset 0 0 8px rgba(192, 192, 192, 0.15);
  color: #808080 !important;
}

.second .pos-col,
.second .total-col {
  color: #696969 !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(105, 105, 105, 0.2);
}

.third td {
  background: linear-gradient(to right, rgba(205, 127, 50, 0.25), rgba(184, 115, 51, 0.1)) !important;
  border-left: 4px solid #cd7f32 !important;
  font-weight: 700;
  font-size: 1.02em;
  box-shadow: inset 0 0 6px rgba(205, 127, 50, 0.15);
  color: #8b4513 !important;
}

.third .pos-col,
.third .total-col {
  color: #8b4513 !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(139, 69, 19, 0.2);
}

/* Efectos hover para posiciones destacadas */
.first:hover td {
  background: linear-gradient(to right, rgba(255, 215, 0, 0.35), rgba(255, 193, 7, 0.15)) !important;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.second:hover td {
  background: linear-gradient(to right, rgba(192, 192, 192, 0.35), rgba(169, 169, 169, 0.15)) !important;
  transform: scale(1.015);
  transition: all 0.2s ease;
}

.third:hover td {
  background: linear-gradient(to right, rgba(205, 127, 50, 0.35), rgba(184, 115, 51, 0.15)) !important;
  transform: scale(1.01);
  transition: all 0.2s ease;
}

/* Iconos para posiciones destacadas */
.first .pos-col::before {
  content: "🥇 ";
  margin-right: 2px;
}

.second .pos-col::before {
  content: "🥈 ";
  margin-right: 2px;
}

.third .pos-col::before {
  content: "🥉 ";
  margin-right: 2px;
}

/* Mantener colores de puntajes perfectos y cercanos incluso en podio */
.perfect {
  color: var(--danger-color) !important;
  font-weight: 700 !important;
}

.close {
  color: var(--success-color) !important;
  font-weight: 700 !important;
}

/* Asegurar que los 25 y 24 mantengan su color incluso en primeros puestos */
.first .perfect,
.second .perfect,
.third .perfect {
  color: var(--danger-color) !important;
  font-weight: 700 !important;
}

.first .close,
.second .close,
.third .close {
  color: var(--success-color) !important;
  font-weight: 700 !important;
}

/* Modal mejorado */
.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  background: var(--primary-color);
  color: var(--white);
  border-bottom: none;
  padding: 1.5rem 2rem;
  position: relative;
}

.modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #10b981, #f59e0b);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-subtitle {
  font-size: 1rem;
  opacity: 1;
  font-weight: 600;
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

.modal-title-container {
  width: 100%;
}

/* Badges de posición - Discretos */
.position-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.position-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.9;
}

/* Badge para posición general */
.position-badge.general {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.4);
  color: rgba(255, 255, 255, 0.95);
}

/* Badge para posición por categoría */
.position-badge.category {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.4);
  color: rgba(255, 255, 255, 0.95);
}

/* Badges específicos para podio - Oro, Plata, Bronce */
.position-badge.first {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 193, 7, 0.5));
  border-color: rgba(255, 215, 0, 0.6);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.position-badge.second {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.4), rgba(169, 169, 169, 0.5));
  border-color: rgba(192, 192, 192, 0.6);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.position-badge.third {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.4), rgba(184, 115, 51, 0.5));
  border-color: rgba(205, 127, 50, 0.6);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.position-number {
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-body {
  padding: 2rem;
  background: #fafafa;
}

/* Tabla de tiros mejorada - Estilo escuadras */
.shots-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 0 !important;
}

.shots-table tbody {
  background-image: url(/assets/img/areaplato5.jpg);
  background-color: rgba(255, 255, 255, 0.6);
  background-blend-mode: overlay;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
}

.shots-table thead {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

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

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

.shots-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.shots-table th {
  font-size: smaller;
  text-align: center;
  padding: 12px 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.shots-table th:first-child {
  text-align: left;
  border-left: none;
}

.shots-table th:last-child {
  border-right: none;
}

.shots-table td {
  text-align: center;
  height: 65px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(1px);
  transition: all 0.2s ease;
}

.shots-table td:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.02);
  z-index: 1;
  position: relative;
}

.shots-table tr td:first-child {
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  background: var(--gray-50) !important;
  color: var(--text-primary);
  padding-left: 1rem;
  border-left: 3px solid var(--gray-300);
  border-bottom: 1px solid var(--gray-300);
  border-right: 1px solid var(--gray-300);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.shots-table tr td:first-child:hover {
  background: var(--gray-100) !important;
  border-left-color: var(--gray-400);
  border-bottom-color: var(--gray-400);
  border-right-color: var(--gray-400);
}

.shots-table tr td:last-child {
  font-weight: 700;
  font-size: 16px;
  background: var(--gray-50) !important;
  color: var(--text-primary);
  border-right: 3px solid var(--gray-300);
  border-bottom: 1px solid var(--gray-300);
  padding-right: 1rem;
  min-width: 70px;
}

.shots-table tr td:last-child:hover {
  background: var(--gray-100) !important;
  border-right-color: var(--gray-400);
  border-bottom-color: var(--gray-400);
}

.shots-table tr td:not(:first-child):not(:last-child) {
  width: 42px;
  position: relative;
  font-weight: 600;
  font-size: 14px;
  background-color: transparent;
}

.shots-table tr td:not(:first-child):not(:last-child):not(:empty) {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  color: white;
}

.shots-table tr td:not(:first-child):not(:last-child):empty::after {
  content: '·';
  color: rgba(45, 55, 72, 0.3);
  font-size: 20px;
  line-height: 1;
}

/* Eliminar border derecho de la última celda para evitar superposición */
.shots-table td:last-child {
  border-right: none !important;
}

/* Estilos mejorados para los tiros - Estilo escuadras */
.tirofallado { 
  background-color: rgba(255, 0, 0, 0.9) !important;
  color: white !important;
  font-weight: bold;
}

.tiroacertado { 
  background-color: rgba(0, 128, 0, 0.9) !important;
  color: white !important;
  font-weight: bold;
}

.tirodoblado { 
  background-color: rgba(0, 180, 0, 0.9) !important;
  color: white !important;
  font-weight: bold;
}

/* Cargando en modal */
#modalloading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

#modalloading .spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

/* Estados de carga */
#loading, #sinDatos {
  background: var(--gray-100);
}

/* Responsive */
@media (max-width: 768px) {
  .results-table { font-size: 0.95rem; }
  .results-table th, .results-table td { padding: 0.6rem 0.4rem; }
  .results-table th { font-size: 0.85rem; }
  .name-col { min-width: 160px; max-width: 200px; }
  
  /* Modal responsive */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-header {
    padding: 1rem 1.5rem;
  }
  
  .modal-title {
    font-size: 1.1rem;
  }
  
  .modal-subtitle {
    font-size: 0.8rem;
  }
  
  /* Tabla de tiros responsive */
  .shots-table {
    font-size: 0.7rem;
  }
  
  .shots-table th,
  .shots-table td {
    padding: 0.4rem 0.2rem;
  }
  
  .shots-table th {
    font-size: 0.65rem;
  }
  
  /* Position badges responsive */
  .position-badges {
    gap: 0.25rem;
    justify-content: center;
  }
  
  .position-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }
  
  .position-number {
    font-size: 0.8rem;
  }
  
  /* Ajustes para posiciones destacadas en móviles */
  .first td,
  .second td,
  .third td {
    font-size: 0.9rem !important;
  }
  
  .first .pos-col::before,
  .second .pos-col::before,
  .third .pos-col::before {
    font-size: 0.8rem;
  }
  
  /* Mantener efectos hover pero más suaves en móvil */
  .first:hover td,
  .second:hover td,
  .third:hover td {
    transform: scale(1.01);
  }
}

/* Utilidades */
.text-center { text-align: center; }
.font-weight-bold { font-weight: 700; }
.d-none { display: none !important; }
.d-block { display: block !important; }