/* Prevenir pull-to-refresh y mejorar scroll en móviles */
html {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed;
  background: #1a1a1a; /* Color de respaldo */
  font-family: 'Roboto', sans-serif;
}

body {
  font-family: 'Roboto', sans-serif;
  background-image: url('images/graficas/FONDO.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: #1a1a1a; /* Color de respaldo */
  color: white;
  text-align: center;
  padding: 20px;
  margin: 0;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: fixed;
  padding-bottom: 70px !important;
}

/* Asegurar que todos los elementos heredan la fuente Roboto */
* {
  font-family: 'Roboto', sans-serif;
}

/* Contenedor principal para el scroll */
.main-container {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 0 140px 0;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 70px !important;
}

/* Overlay para mejorar la legibilidad */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Estilos para las imágenes del header */
.header {
  position: static;
  background: none;
  width: 100%;
  margin-left: 0;
  padding-left: 0;
  z-index: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 32px 12px 24px;
  box-sizing: border-box;
}

.header .logo {
  max-width: 90%;
  width: auto;
  max-height: 400px;
  object-fit: contain;
}

.texto-historico {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10px 20px;
  box-sizing: border-box;
}

.texto-historico .logo {
  max-width: 85%;
  height: auto;
  max-height: 140px;
  width: auto;
  object-fit: contain;
}

.estrellas {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 5px 20px;
  box-sizing: border-box;
}

.estrellas .logo {
  max-width: 80%;
  height: auto;
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

.header-title {
  color: #fff;
  font-size: 1.1em;
  font-weight: 500;
  letter-spacing: 1px;
  margin-right: 32px;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  gap: 22px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.main-nav a {
  color: #ccc;
  text-decoration: none;
  font-size: 1em;
  font-weight: 400;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: #fff;
}

.header-social {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-left: auto;
}

.header-social a {
  color: #bbb;
  font-size: 1.1em;
  transition: color 0.2s;
}

.header-social a:hover {
  color: #fff;
}

@media (max-width: 900px) {
  .header {
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
  }

  .header .logo {
    max-width: 95%;
    max-height: 60px;
  }

  .texto-historico {
    padding: 8px 15px;
  }

  .texto-historico .logo {
    max-width: 90%;
    max-height: 150px;
  }

  .estrellas {
    padding: 3px 15px;
  }

  .estrellas .logo {
    max-width: 85%;
    max-height: 100px;
  }

  .main-nav {
    display: none !important;
  }

  .header-social {
    margin-top: 10px;
    margin-left: auto;
    align-self: flex-start;
  }
}


h1 {
  font-size: 1.5em;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin: 0.5 rem;
  flex-grow: 1;
}

select {
  padding: 6px;
  font-size: 0.9em;
  margin: 10px auto;
  display: block;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Cancha con fondo */
.pitch {
  background-image: url('images/Cancha test1.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  width: calc(100% - 40px);
  max-width: 700px;
  max-height: 650px;
  height: auto;
  aspect-ratio: 9 / 16;
  padding: 20px 0;
  margin: 20px auto;
  position: relative;
}

.pitch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('images/Cancha test1.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.7;
  border-radius: 15px;
  z-index: 0;
}

/* Fila de jugadores */
.row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Contenedor de cada posición */
.position {
  position: absolute;
  width: clamp(110px, 100vw, 200px);
  height: clamp(110px, 100vw, 200px);
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transform: translate(-50%, -50%);
  transition: none;
  backdrop-filter: none !important;
  z-index: 1;
}

.position:hover {
  background-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Animaciones para las formaciones */
.position.transitioning {
  transform: translate(-50%, -50%) scale(0.9);
}

.position.grouping {
  top: 50% !important;
  left: 50% !important;
}

.position.entering {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) scale(0.9);
}

.position.spreading-out {
  transform: translate(-50%, -50%) scale(1);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.position.preserve {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Efecto de aparición para nuevas posiciones */
@keyframes appearPosition {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.position.appearing {
  animation: appearPosition 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Imagen del jugador */
.player {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.player img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 0 !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.player:hover img {
  transform: scale(1.1);
}

/* Nombre en hover */
.player::after {
  content: attr(data-name);
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.7em;
  padding: 4px;
  text-align: center;
  backdrop-filter: none;
}

/* Modal para galería */
.modal {
  display: none;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0,0,0,0.9);
  transition: background-color 0.3s ease;
}

.modal.active {
  display: block;
  opacity: 1;
}

.modal-content {
  background: #1a1b1f;
  backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 10% auto;
  padding: 20px;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 80vh;
  padding-top: 48px !important;
  padding-right: 24px !important;
}

.modal.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.close {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: white;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  z-index: 10;
}

.close:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Galería de jugadores */
.gallery-description {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 10px;
  margin: 20px auto;
  max-width: 800px;
  width: 90%;
  text-align: center;
}

.gallery-grid-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  overflow: hidden;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 jugadores por fila */
  grid-auto-rows: 150px; /* Altura generosa para imagen + apellido */
  gap: 18px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.gallery-img-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  min-width: 90px;
  min-height: 140px;
}

.gallery-img-container img {
  width: 100%;
  height: 80%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.player-apellido {
  margin-top: 6px;
  color: #fff;
  font-weight: bold;
  font-size: 1.1em;
  text-align: center;
  width: 100%;
  background: none;
  padding-bottom: 4px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-height: 28px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  transform: scale(1);
}

.gallery-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.gallery-grid img.selected {
  transform: scale(1.05);
  border: 3px solid #2d2d2d;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.cerrar-galeria {
  margin-top: 15px;
  padding: 8px 14px;
  background-color: #fff;
  color: black;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background-color 0.2s;
}

.cerrar-galeria:hover {
  background-color: #444;
}

/* Contenedor para los controles superiores */
.controls-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.enviar-btn, .exportar-btn {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.enviar-btn {
  background-color: #fff;
  color: black;
  font-weight: bold;
}

.exportar-btn {
  background-color: #28a745;
  color: white;
}

.enviar-btn:hover {
  background-color: #0056b3;
}

.exportar-btn:hover {
  background-color: #218838;
}

/* Animación para cuando se agrega un jugador */
@keyframes playerAdded {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
}

.position.player-added {
  animation: playerAdded 0.5s ease-in-out;
}

/* Nombre del jugador debajo de la posición */
.player-name {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: nowrap;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Botón para quitar selección */
.quitar-seleccion {
  background-color: #d32f2f;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
  margin-top: 10px;
}

.quitar-seleccion:hover {
  background-color: #b71c1c;
}

/* Estilos para la opción de quitar jugador en la galería */
.gallery-grid img.quitar {
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.2s ease;
}

.gallery-grid img.quitar:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(255, 0, 0, 0.3);
}

/* Modal de envío */
.send-modal {
  display: none;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: #1a1b1f;
  transition: background-color 0.3s ease;
  opacity: 0;
}

.send-modal.active {
  display: block;
  opacity: 1;
  background-color: rgba(0,0,0,0.8);
}

.send-modal-content {
  background: #1a1b1f;
  backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 15% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 400px;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.send-modal.active .send-modal-content {
  transform: translateY(0);
  opacity: 1;
}

.send-modal h2 {
  margin-bottom: 20px;
  color: white;
}

.send-modal input[type="email"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 20px;
  border: none;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.9);
  font-size: 1em;
}

.send-modal .buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.send-modal button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
}

.send-modal .confirm-btn {
  background-color: #fff;
  color: rgb(27, 26, 26);
  font-weight: bold;
}

.send-modal .download-btn {
  background-color: #181717;
  color: white;
  font-weight: bold;
  border-color: white;
  border-width: 1px;
  border-style: solid;
}
.send-modal .confirm-btn:hover {
  background-color: #0056b3;
}

.send-modal .cancel-btn {
  background-color: #941111;
  color: white;
  font-weight: bold;
}

.send-modal .cancel-btn:hover {
  background-color: #808080;
}

.send-modal .message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9em;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.send-modal .message.error {
  background-color: rgba(211, 47, 47, 0.2);
  color: #ff5252;
  border: 1px solid #ff5252;
}

.send-modal .message.success {
  background-color: rgba(76, 175, 80, 0.2);
  color: #69f0ae;
  border: 1px solid #69f0ae;
}

.send-modal .message[style*="display: block"] {
  opacity: 1;
}

/* Media queries para dispositivos móviles */
@media screen and (max-width: 768px) {
  body {
    padding: 5px;
  }

  .main-container {
    padding: 5px 0 160px 0;
  }

  .header {
    padding: 0 10px;
    gap: 10px;
    justify-content: center;
  }

  .header .logo {
    max-width: 98%;
    max-height: 4500px;
  }

  .texto-historico {
    padding: 5px 10px;
  }

  .texto-historico .logo {
    max-width: 95%;
    max-height: 120px;
  }

  .estrellas {
    padding: 2px 10px;
  }

  .estrellas .logo {
    max-width: 90%;
    max-height: 80px;
  }

  .controls-container {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 0 5px;
    margin-bottom: 30px;
  }
  .controls-container button {
    width: 160px;
    max-width: 160px;
    min-width: 160px;
    margin: 0;
    box-sizing: border-box;
    flex: 0 0 160px;
  }

  h1 {
    font-size: 1.2em;
  }

  .controls-container {
    gap: 20px;
    padding: 0 5px;
    margin-bottom: 30px;
  }

  .formation-control {
    width: 100%;
    justify-content: center;
  }

  .enviar-btn {
    width: calc(100% - 20px);
    max-width: 300px;
    margin: 0 auto;
  }

  /* Ajustes para la cancha en móvil */
  .pitch {
    width: calc(100% - 20px);
    aspect-ratio: 3 / 4;
    padding-bottom: 20px;
  }

  /* Ajustes para las posiciones de jugadores */
  .position {
    width: clamp(40px, 14vw, 55px);
    height: clamp(40px, 14vw, 55px);
  }

  /* Ajustar el espacio entre jugadores */
  .position[style*="top: 73%"] {
    transform: translate(-50%, -50%) scale(0.9);
  }

  .position[style*="top: 110%"] {
    transform: translate(-50%, -50%) scale(0.9);
  }

  .player-name {
    font-size: 0.65em;
    bottom: -18px;
    padding: 2px 4px;
  }

  /* Ajustes para el título de suplentes */
  .position-title {
    font-size: 0.9em;
    white-space: nowrap;
  }

  /* Ajustes para el modal de galería */
  .modal-content {
    width: calc(100% - 20px);
    margin: 5% auto;
    padding: 15px;
    max-height: 90vh;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important; /* 3 por fila en mobile */
    gap: 5px !important;
    width: 90vw;
    max-width: 100vw;
    box-sizing: border-box;
    padding: 0px;
  }

  .gallery-img-container {
    min-width: 0 !important;
    width: 75% !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .gallery-img-container img {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
  }
  .player-apellido {
    font-size: 1em;
    min-height: 24px;
    margin-top: 4px;
    padding-bottom: 2px;
  }

  .selected-player-container.active {
    flex-direction: row;
    gap: 4px;
    align-items: center;
    padding: 10px;
  }

  .selected-player-image {
    width: 120px;
    height: 120px;
  }

  .selected-player-info {
    width: 100%;
    padding: 10px;
  }

  .selected-player-name {
    font-size: 1.1em;
    margin-bottom: 10px;
  }

  .selected-player-description {
    font-size: 0.85em;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  .agregar-jugador-btn {
    padding: 12px;
    font-size: 1em;
  }

  .cerrar-galeria {
    margin-top: 20px;
    padding: 12px;
    font-size: 1em;
  }

  .selected-player-container {
    margin: 10px 5px;
  }

  /* Ajustar el tamaño de los botones y contenedores */
  .filter-buttons {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 10px 0;
    padding: 0 5px;
  }

  .filter-btn {
    padding: 6px 10px;
    font-size: 0.8em;
    flex: 0 1 auto;
  }

  .pitch-wrapper {
    width: 100vw;
    max-width: 100vw;
  }

  .gallery-img-container {
    min-height: 130px;
    height: 130px;
  }
  .gallery-img-container img {
    height: 85px;
    max-height: 85px;
  }
  .player-apellido {
    font-size: 1.1em;
    min-height: 32px;
    margin-top: 6px;
    padding-bottom: 4px;
  }

  .close {
    right: 6px;
    top: 6px;
    width: 26px;
    height: 26px;
    font-size: 20px;
  }
  .modal-content {
    padding-top: 38px !important;
    padding-right: 12px !important;
  }

  .instrucciones-modal-content {
    margin: 10% auto;
    padding: 1rem;
    width: 95%;
  }

  .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .step-content img {
    max-width: 100%;
  }

  .sponsors-grid {
    grid-template-columns: repeat(6, 1fr); /* 2 columnas visibles, con padding para centrar */
    padding: 0 32px;
    gap: 24px;
    justify-items: center;
  }

  .send-modal-content {
    width: 98vw !important;
    max-width: 98vw !important;
    min-width: unset !important;
    margin: 2vw auto !important;
    padding: 10px 4vw !important;
    box-sizing: border-box !important;
    left: 0 !important;
    right: 0 !important;
  }
  .send-modal {
    padding: 0 !important;
  }
}

/* Contenedor para jugador seleccionado */
.selected-player-container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 18px;
  align-items: start;
  margin: 0 auto 20px;
  padding: 15px;
  background-color: #1f202599;
  border-radius: 10px;
  max-width: 700px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  box-sizing: border-box;
  width: 100%;
}

.selected-player-container.active {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

.selected-player-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  grid-row: 1 / span 2;
  grid-column: 1;
}

.selected-player-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  margin-top: 25px;
  margin-bottom: 5px;
  margin-left: 10px;
  margin-right: 8px;
}

.selected-player-stats {
  display: flex;
  background: #1f202599;
  flex-direction: row;
  justify-content: flex-start;
  margin-top: 10px;
  margin-bottom: 10px;
}

.selected-player-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #2d2f36;
  color: #fff;
  margin: 0px 5px;
  border-radius: 3px;
  text-align: center;
  font-size: 0.95em;
  width: 35px;
}

.selected-player-info {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: black;
  text-align: center;
  padding: 15px;
  background-color: #2d2f36;
  border-radius: 8px;
  margin-top: 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 225px;
  max-height: 225px;
  min-width: 220px;
  width: 100%;
  max-width: 420px;
  overflow-y: auto;
  box-sizing: border-box;
}

.selected-player-name {
  color: #fff;
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 8px;
  font-family: "Roboto", sans-serif;
  width: 100%;
  text-align: center;
}

.selected-player-description {
  color: #fff;
  font-size: 0.9em;
  line-height: 1.4;
  font-family: "Roboto", sans-serif;
  margin-bottom: 15px;
  flex-grow: 1;
  width: 100%;
  text-align: justify;
  overflow-y: auto;
  padding-right: 5px;
}



.selected-player-stat-label {
  font-size: 0.85em;
  color: #ccc;
  margin-bottom: 2px;
  font-weight: bold;
  letter-spacing: 1px;
}

.selected-player-stat-value {
  font-size: 1.1em;
  font-weight: bold;
  color: #fff;
}

.agregar-jugador-btn {
  background-color: #fff;
  color: black;
  font-weight: bold;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
  margin-top: auto;
}

.agregar-jugador-btn:hover {
  background-color: #444;
}

.agregar-jugador-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

@media screen and (max-width: 768px) {
  .selected-player-container.active {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 10px;
  }

  .selected-player-image {
    width: 100px;
    height: 100px;
  }

  .selected-player-info {
    width: 100%;
    padding: 10px;
    max-height: 150px;
  }

  .selected-player-name {
    color: #fff;
    font-size: 1em;
    margin-bottom: 8px;
  }

  .selected-player-description {
    font-size: 0.85em;
    line-height: 1.4;
    margin-bottom: 10px;
  }

  .gallery-grid {
    margin-top: 15px;
  }
}

/* Estilizar la barra de desplazamiento para la descripción */
.selected-player-info::-webkit-scrollbar {
  width: 6px;
}

.selected-player-info::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.selected-player-info::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.selected-player-info::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.pitch-container {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 20px;
  padding: 0 20px;
}

.pitch-wrapper {
  padding-top: 0;
  margin-top: 0;
  padding-bottom: 0;
  box-shadow: 0 20px 32px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.coach-section {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.bench-section {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.coach-title, .bench-title {
  color: white;
  font-size: 0.9em;
  text-align: center;
  margin-bottom: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.bench-positions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.coach-position, .bench-position, .position {
  width: clamp(90px, 10vw, 100px);
  height: clamp(90px, 10vw, 100px);
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@media screen and (max-width: 768px) {
  .pitch-container {
    grid-template-columns: 1fr;
  }

  .coach-section, .bench-section {
    padding: 10px;
  }

  .bench-positions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .coach-position, .bench-position, .position {
    width: clamp(80px, 18vw, 120px);
    height: clamp(80px, 18vw, 120px);
  }
}

.position-title {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #ccc;
  font-weight: 500;
  text-shadow: 1px 1px 2px #1f2025;
  background-color: #292a30;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 2;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background-color: rgba(45, 45, 45, 0.8);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: rgba(68, 68, 68, 0.9);
}

.filter-btn.active {
  background-color: #fff;
  color: black;
  font-weight: bold;
}

@media screen and (max-width: 768px) {
  .filter-buttons {
    gap: 5px;
  }

  .filter-btn {
    padding: 6px 10px;
    font-size: 0.8em;
  }
}

.gallery-img-container:hover img {
  transform: scale(1.05);
  z-index: 3;
}

.jugador-en-uso {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(169, 32, 46, 0.879);
  color: white;
  padding: 6px 8px;
  font-weight: bold;
  font-size: 0.85em;
  pointer-events: none;
  text-align: center;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 10;
}

@media screen and (max-width: 768px) {
  .jugador-en-uso {
    font-size: 0.75em;
    padding: 4px 6px;
  }
}

#mainNav, #headerSocial {
  transition: none;
}

.logo-fixed {
  position: static;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}

.banner-publicitario {
  margin-top: 10px;
  text-align: center;
}

.banner-publicitario img {
  max-width: 100%;
  max-height: 100px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  .instrucciones-modal-content {
    margin: 10% auto;
    padding: 1rem;
    width: 95%;
  }

  .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .step-content img {
    max-width: 100%;
  }

  .sponsors-grid {
    grid-template-columns: repeat(6, 1fr); /* 2 columnas visibles, con padding para centrar */
    padding: 0 32px;
    gap: 24px;
    justify-items: center;
  }

}

.sponsors-section {
  margin-top: 40px;
  text-align: center;
  padding: 20px;
}

.sponsors-title {
  font-size: 24px;
  font-weight: 600;
  color: white;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sponsors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  justify-items: center;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
}

.sponsors-grid img {
  max-width: 100%;
  height: 70px;
  object-fit: contain;
  filter: grayscale(80%) brightness(80%);
  transition: filter 0.3s ease;
}

@media (max-width: 768px) {
  .sponsors-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columnas visibles */
    gap: 16px;
    padding: 0 32px; /* Centrado para que no queden logos cortados */
    justify-items: center;
    max-width: 100%;
    max-height: 80%;
  }

  .sponsors-grid img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }

  .sponsors-grid img[src*="smart-fit"] {
    max-height: 80px;
  }
}

.sponsors-section-header {
  margin-top: 40px;
  text-align: center;
  padding: 20px;
}

.sponsors-title-header {
  font-size: 24px;
  font-weight: 600;
  grid-template-columns: repeat(3, 1fr); /* 3 columnas visibles */
  color: white;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sponsors-grid-header {
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* Cambiado a 3 columnas */
  justify-items: center;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.sponsors-grid-header img {
  max-width: 100%;
  object-fit: contain;
  filter: none !important;
  opacity: 1 !important;
}

.sponsors-grid-header img[src*="linea1"] {
  width: 18px;
  min-width: 12px;
  max-width: 22px;
  height: 80px;
  padding: 0 10px;
  object-fit: contain;
  filter: none !important;
  opacity: 1 !important;
}

.sponsors-grid-header img[src*="JETOUR"] {
  max-width: 180px;
  height: 80px;
  object-fit: contain;
}

.sponsors-grid-header img[src*="CONEXION"] {
  max-width: 180px;
  height: 80px;
  object-fit: contain;
}

.sponsors-grid-header img[src*="ADIDAS"] {
  max-width: 180px;
  height: 80px;
  object-fit: contain;
}

.instrucciones-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.instrucciones-modal.active {
  display: block;
  opacity: 1;
}

.instrucciones-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  color: #000;
  position: relative;
}

.instrucciones-modal .close {
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 24px;
  cursor: pointer;
}

.instrucciones-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 15px;
}

.step-number {
  background-color: #000;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.step-content h3 {
  margin: 0;
  font-size: 1.1rem;
}

.step-content p {
  margin: 5px 0;
}

.step-content img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}

.cerrar-instrucciones {
  margin-top: 20px;
  padding: 10px 20px;
  background: #000;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.instrucciones-btn {
  background-color: transparent;
  border: 2px solid white;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.instrucciones-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.suplentes-entrenador {
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 15px 10px;
}

.banca-grid {
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  align-items: center;
  margin: 30px 0 20px 0;
  overflow-x: auto;
  padding-bottom: 10px;
  max-width: 100%;
  /* Opcional: oculta la barra de scroll en algunos navegadores */
  scrollbar-width: thin;
  scrollbar-color: #888 #222;
}

.banca-grid::-webkit-scrollbar {
  height: 8px;
}

.banca-grid::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.banca-grid::-webkit-scrollbar-track {
  background: #222;
  border-radius: 4px;
}

/* Estilos para la exportación de plantilla */
.export-container {
  background: #18191c;
  padding: 24px 6px;
  border-radius: 16px;
  width: 1080px;
  height: 1920px;
  /* max-width: 100vw; */
  /* max-height: 100vh; */
  /* aspect-ratio: 9/16; */
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.export-title {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 1.5em;
  color: #ccc;
  text-align: center;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}
.export-sponsors {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
}
.export-sponsors img {
  height: 28px;
  object-fit: contain;
}
.export-pitch {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  width: 1000px !important;
  height: 1100px !important;
  max-width: 1000px !important;
  max-height: 1100px !important;
  margin: 0 auto 10px auto !important;
  padding-bottom: 50px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}
.export-pitch .pitch,
.export-pitch > div[style*="position: relative"] {
  width: 1000px !important;
  height: 1100px !important;
  max-width: 1000px !important;
  max-height: 1100px !important;
  margin: 0 auto !important;
  display: block !important;
}
.export-bench {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 0 !important;
  margin-bottom: 18px;
  width: 900px;
  max-width: 900px;
  height: 400px;
  max-height: 400px;
}

/* Forzar que los elementos dentro de export-bench se muestren en filas separadas */
.export-bench > div {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 18px;
  width: 100%;
}
.export-bench-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  height: 120px;
  max-width: 120px;
  max-height: 120px;
}
.export-bench-item img {
  width: 120px;
  height: 120px;
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}
.export-bench-item span {
  color: #ccc;
  font-size: 0.8em;
  margin-top: 3px;
  text-align: center;
  background: transparent;
  border-radius: 4px;
  padding: 2px 5px;
}

.banca-grid .gallery-img-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border-radius: 8px;
  overflow: hidden;
  height: auto;
  min-width: 90px;
  min-height: 110px;
}

.banca-grid .gallery-img-container img {
  width: 80px;
  height: 80px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.banca-grid .player-apellido {
  margin-top: 4px;
  color: #ccc;
  font-weight: bold;
  font-size: 0.95em;
  text-align: center;
  width: 100%;
  background: none;
  padding: 0;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-height: unset;
  align-items: unset;
  justify-content: unset;
}

@media (max-width: 768px) {
  .banca-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    justify-items: center;
    align-items: center;
    margin: 20px 0 10px 0;
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 0;
  }
  .banca-grid .gallery-img-container {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
}

.export-header-graphics img[src*="PORTADA FUNDADORES.png"] {
  max-width: 90%;
  max-height: 400px;
  display: block;
  margin: 0 auto;
  z-index: 10;
  padding-top: 50px;
}

@media (max-width: 768px) {
  .sponsors-grid-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    max-width: 100vw !important;
    padding: 0 8px !important;
  }
  .sponsors-grid-header img[src*="linea1"] {
    width: 14px !important;
    min-width: 8px !important;
    max-width: 18px !important;
    height: 60px !important;
    object-fit: contain;
    margin: 0 2px !important;
    padding: 0 !important;
  }
  .sponsors-grid-header a img,
  .sponsors-grid-header img:not([src*="linea1"]) {
    max-width: 120px !important;
    height: 60px !important;
    object-fit: contain;
  }
}

.footer-social-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
  padding-bottom: 4px;
}


.footer-social-icon {
  height: 15px;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.footer-social-icon:hover {
  opacity: 1;
}

.footer-bases-row {
  color: #575757;
  font-size: 1em;
  display: flex;
  font-weight: bold;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 0 auto;
  padding: 10px 18px;
  border-radius: 8px;
  width: fit-content;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

.footer-bases-row a {
  color: #575757;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-bases-row a:hover {
  color: #fff;
}

.bases-modal-content {
  background: #1a1b1f;
  color: #fff;
  border-radius: 12px;
  padding: 36px 28px;
  max-width: 95vw;
  max-height: 90vh;
  width: 100%;
  margin: 5vh auto;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 1.1em;
}

.main-footer {
  width: 100%;
  background: transparent;
  color: #bcd6e7;
  font-size: 1em;
  text-align: center;
  padding: 18px 0 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

@media (max-width: 768px) {
  #btnDescargarExport {
    display: none !important;
  }
}

.suplentes-texto {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  z-index: 10;
}

.suplentes-texto img {
  max-width: 90%;
  height: 70px;
  max-height: 70px;
  display: block;
  margin: 0 auto;
  padding-top: 10px;
  z-index: 10;
}

@media (max-width: 768px) {
  .suplentes-texto img {
    height: 70px;
    max-height: 70px;
    margin-top: -70px;
  }

  .export-pitch {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    width: 1000px !important;
    height: 1100px !important;
    max-width: 1000px !important;
    max-height: 1100px !important;
    margin: 0 auto 10px auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  .export-bench {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 0 !important;
    margin-bottom: -18px;
    width: 900px;
    max-width: 900px;
    height: 400px;
    max-height: 400px;
  }
}

#basesText {
  text-align: justify;
  margin: 0 auto;
  max-width: 800px;
  padding: 0 10px;
}
#basesText h2, #basesText h3 {
  text-align: left;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
#basesText ul, #basesText ol {
  margin-left: 1.5em;
  padding-left: 1.2em;
  margin-top: 0.2em;
  margin-bottom: 0.8em;
}
#basesText li {
  margin-bottom: 0.2em;
  text-align: left;
  padding-left: 0.1em;
}
#basesText p {
  text-align: justify;
  margin-top: 0.2em;
  margin-bottom: 0.8em;
}
