/* Unifica la altura del input de búsqueda y el select */
#IdJuego, #filtroPrestamo {
  height: 38px;
  font-size: 1rem;
  box-sizing: border-box;
}
/* Test comentario para verificar autenticación - Andrea Carballido */
/* Spinner y mensaje de carga */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
  margin-top: 40px;
}
.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #8C7AE6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-text {
  font-size: 1.2rem;
  color: #8C7AE6;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Footer siempre al fondo */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#main-content {
  flex: 1 0 auto;
}
footer {
  flex-shrink: 0;
}
/* Evita que los títulos de los juegos se corten en mitad de una palabra */
.card-title {
  word-break: keep-all;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Estilo general para el cuerpo de la página */
body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  padding-top: 45px;
  position: relative;
  color: #4B4453;  /* Texto principal en lila oscuro */
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(145deg, #8C7AE6, #A29BFE); /* Lila degradado */
  color: white;
  padding: 10px 30px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  height: 60px; /* Ajusta la altura del header */
  display: flex;
  justify-content: space-between; /* Distribuye los elementos a los extremos */
  align-items: center; /* Centra verticalmente el texto y el botón */
}

header h3 {
  margin: 0;  /* Eliminar márgenes por defecto */
  flex: 1;  /* Permite que el h1 ocupe el espacio disponible y se alinee al centro */
  text-align: center; /* Centra el texto */
}

/* Estilo para las tarjetas */
.card {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  box-shadow: 0 6px 20px rgba(140, 122, 230, 0.2);
  padding: 15px;
  margin: 5px; /* Margen entre tarjetas */
  text-align: center;
  max-width: 180px;
  min-width: 170px; /* Evita que la tarjeta sea muy delgada */
  transition: transform 0.3s ease;
}

/* Contenedor de las tarjetas */
#tarjetasJuegos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Centra horizontalmente las filas */
  gap: 10px; /* Espacio entre tarjetas */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 1200px; /* Para controlar el ancho máximo del contenedor */
}

/* Para las tarjetas de la última fila */
#tarjetasJuegos .card {
  flex: 0 0 calc(25% - 10px); /* Asegura que haya 4 tarjetas por fila, con espacio */
}

.card-img-top {
  width: 100%;
  height: 150px;
  object-fit: contain;  /* La imagen se ajusta dentro del contenedor sin recortarse */
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

.card .badge {
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Inputs del formulario */
input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #A29BFE;
  border-radius: 8px;
}

/* Contenedor de resultados */
#resultadoBusqueda {
  padding: 20px;
  border: 2px solid #A29BFE;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.95);
  margin: 30px auto;
  max-width: 800px;
}

/* Modal Estilo */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 90%;  /* Ancho por defecto para móviles */
  max-width: 500px;  /* Ancho máximo del modal en desktop */
  max-height: 90%;  /* Altura máxima del modal */
  margin: 30px auto; /* Centrado vertical y horizontal */
  background-color: white;
  border-radius: 8px;
  overflow: hidden; /* Evita que los elementos sobresalgan */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modal-body {
  max-height: 80%; /* Altura máxima del cuerpo del modal */
  overflow-y: auto;  /* Habilita el desplazamiento vertical si es necesario */
  padding: 20px;
}

.modal-header {
  background: linear-gradient(145deg, #8C7AE6, #A29BFE);
  padding: 15px;
  color: white;
  font-size: 16px;
  text-align: center;
  position: relative;
}

.modal-header h2 {
  margin: 0;
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  color: #ffffff;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #F1EFFF;
}

.botones-container {
  display: flex;           
  justify-content: start;
  gap: 15px;                 
  margin-top: 20px; 
}

/* Animación sutil de aparición */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

#linkmanual {
  display: block; 
  margin-top: 10px; 
  margin-bottom: 20px; 
}

/* Enlace de descarga */
#linkmanual a {
  color: #007bff;
  text-decoration: underline; 
  font-weight: bold;
}


@media (max-width: 767px) {
  #tarjetasJuegos .card {
    flex: 0 0 calc(50% - 10px); /* En pantallas pequeñas, 2 tarjetas por fila */
  }
  
  .modal-content {
    width: 95%;  /* En móviles el modal ocupa más ancho */
    max-width: none;  /* Sin límite máximo en móviles */
  }
}

@media (max-width: 480px) {
  #tarjetasJuegos .card {
    flex: 0 0 100%; /* En pantallas muy pequeñas, 1 tarjeta por fila */
  }
  
  .modal-content {
    width: 98%;  /* En pantallas muy pequeñas casi todo el ancho */
    margin: 10px auto;  /* Menor margen en pantallas pequeñas */
  }
}

/* Estilos adicionales para desktop */
@media (min-width: 768px) {
  .modal-content {
    width: 450px;  /* Ancho fijo más estrecho en desktop */
    max-width: 500px;
  }
}

@media (min-width: 1200px) {
  .modal-content {
    width: 480px;  /* Ligeramente más ancho en pantallas grandes */
    max-width: 550px;
  }
}