/* Variables de color para fácil mantenimiento */
:root {
  --color-primary-dark: #5D3FD3; /* Morado Oscuro */
  --color-primary-light: #9966FF; /* Morado Claro/Acento */
  --color-background-dark: #1A1A1A; /* Negro/Fondo principal */
  --color-background-secondary: #333333; /* Gris Oscuro/Filtros, secciones */
  --color-text-light: #FFFFFF; /* Blanco */
  --color-text-secondary: #CCCCCC; /* Gris para textos secundarios */
  --font-family-base: 'Montserrat', sans-serif;
}

/* Estilos generales - Tema Oscuro */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
}

body {
  background-color: var(--color-background-dark);
  color: var(--color-text-light); /* Texto blanco por defecto */
  line-height: 1.6;
}

/* Header mejorado */
header {
  background: var(--color-background-secondary); /* Fondo gris oscuro */
  color: var(--color-text-light);
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5); /* Sombra más oscura */
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-section h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  font-weight: 800; /* Más peso para el título */
}

/* Degradado solo para el texto principal del logo */
.logo-text {
  background: linear-gradient(to right, var(--color-primary-light), var(--color-primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-section p {
  font-size: 1rem;
  opacity: 0.7; /* Texto secundario más sutil */
  color: var(--color-text-secondary);
}

.twitter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-primary-dark);
  color: var(--color-text-light);
  padding: 0.7rem 1.2rem;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.twitter-btn:hover {
  background-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0,0,0,0.3);
}

/* Hero section */
.hero {
  /* Nuevo degradado oscuro sobre la imagen */
  background: linear-gradient(rgba(26, 26, 26, 0.85), rgba(93, 63, 211, 0.5)), url('https://cdn.imgchest.com/files/a734f2cf4140.jpeg');
  background-size: cover;
  background-position: center;
  color: var(--color-text-light);
  padding: 3rem 1.5rem;
  text-align: center;
  border-bottom: 4px solid var(--color-primary-dark); /* Borde acento */
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 800;
}

.hero p {
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
}

main {
  display: flex;
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;
}

/* Filtros - Contraste sobre fondo oscuro */
.filters {
  width: 280px;
  padding: 1.5rem;
  background-color: var(--color-background-secondary); /* Gris oscuro */
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  height: fit-content;
  position: sticky;
  top: 2rem;
}

.filters h2 {
  margin-bottom: 1.5rem;
  color: var(--color-text-light);
  border-bottom: 2px solid var(--color-primary-dark);
  padding-bottom: 0.5rem;
  font-weight: 600;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-text-light);
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #555;
  border-radius: 6px;
  transition: all 0.3s;
  font-size: 1rem;
  background-color: #222; /* Fondo de inputs más oscuro */
  color: var(--color-text-light);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(153, 102, 255, 0.3);
}

.filter-stats {
  padding-top: 1rem;
  border-top: 1px solid #555;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.results-count {
  font-weight: 600;
  color: var(--color-primary-light);
}

.games-container {
  flex: 1;
}

#games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Tarjeta de juego */
.game-card {
  background-color: var(--color-background-secondary); /* Gris oscuro */
  color: var(--color-text-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.5);
}

.game-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--color-primary-light), var(--color-primary-dark));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.game-card:hover::after {
  transform: scaleX(1);
}

.game-image {
  width: 100%;
  height: 200px;
  object-fit: contain; /* Cambiado a cover para mejor visual */
  background-color: #222;
  border-radius: 12px 12px 0 0;
}

.game-info {
  padding: 1.2rem;
}

.game-title {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary-light); /* Título en morado claro */
  font-weight: 600;
}

.game-genre {
  display: inline-block;
  background-color: var(--color-primary-dark);
  color: var(--color-text-light);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
  font-weight: 500;
  /* Quitamos el degradado para que se vea más limpio el tag */
}

.game-description {
  font-size: 0.9rem;
  color: var(--color-text-secondary); /* Descripción gris */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85); /* Fondo más oscuro */
  overflow: auto;
  backdrop-filter: blur(8px); /* Blur más fuerte */
}

.modal-content {
  background-color: var(--color-background-dark); /* Contenido del modal en negro */
  color: var(--color-text-light);
  margin: 5% auto;
  padding: 2.5rem;
  border-radius: 12px;
  width: 80%;
  max-width: 800px;
  position: relative;
  animation: modalopen 0.4s ease-out;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid var(--color-primary-dark); /* Borde para destacar */
}

@keyframes modalopen {
  from {opacity: 0; transform: translateY(-50px) scale(0.9);}
  to {opacity: 1; transform: translateY(0) scale(1);}
}

.close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: color 0.3s;
  z-index: 10;
}

.close:hover {
  color: var(--color-primary-light);
}

/* Estilos para el detalle del juego */
#game-detail-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-detail-header {
  display: flex;
  gap: 2rem;
}

.game-detail-image {
  width: 100%; /* Ocupa el ancho disponible */
  max-width: 400px; /* Pero no te pases de 400px */
  height: auto; /* Altura automática para no deformar */
  border-radius: 12px;
  object-fit: contain; /* Asegura que se vea completa */
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  margin: 0 auto; /* Centrada */
  display: block;
}

.game-detail-info {
  flex: 1;
}

.game-detail-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary-light);
}

.game-detail-genres {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
flex-wrap: wrap;
}

.game-detail-genre {
  background-color: var(--color-primary-dark);
  color: var(--color-text-light);
  /* Quitamos el degradado */
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.game-detail-description {
  line-height: 1.7;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  color: var(--color-text-secondary);
}

.download-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Botones de Descarga General */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-primary-dark); /* Color sólido para mejor impacto */
    color: white;
    padding: 0.9rem 1.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    flex: 1;
    min-width: 200px;
    justify-content: center;
}

.download-btn:hover {
    transform: translateY(-3px);
    background: var(--color-primary-light); /* Hover con morado claro */
    box-shadow: 0 6px 8px rgba(0,0,0,0.3);
}

/* Botón específico para APK - Mantenemos un color diferente para distinguirlo */
.apk-btn {
    background: linear-gradient(to right, #3ddc84, #34a853);
}

.apk-btn:hover {
    background: linear-gradient(to right, #34a853, #2e8b47);
}

/* Estilos para donaciones - CON EFECTO DE RESPIRACIÓN */
.donate-floating-btn {
  /* PROPIEDADES CRÍTICAS PARA QUE SEA FLOTANTE */
  position: fixed; /* Asegura que se mantenga en la vista */
  bottom: 30px;
  right: 30px;
  z-index: 1000; /* Asegura que esté por encima de casi todo */

  /* Estilos visuales */
  background: var(--color-primary-dark);
  color: white;
  padding: 1.2rem 2rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
  transition: all 0.3s;
  font-size: 1.1rem;
  animation: breathe 3s infinite ease-in-out;
}

@keyframes breathe {
  0% {
    transform: scale(1);
    box-shadow: 0 6px 15px rgba(93, 63, 211, 0.4); /* Sombra morada oscura */
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(153, 102, 255, 0.6); /* Sombra morada clara */
  }
  100% {
    transform: scale(1);
    box-shadow: 0 6px 15px rgba(93, 63, 211, 0.4);
  }
}

.donate-floating-btn:hover {
  animation: none;
  transform: scale(1.1);
  box-shadow: 0 10px 25px rgba(153, 102, 255, 0.7);
}

.donate-options {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}

.donate-option {
  text-align: center;
  padding: 2rem;
  background: var(--color-background-secondary); /* Fondo gris oscuro */
  color: var(--color-text-light);
  border-radius: 12px;
  min-width: 250px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform 0.3s;
}

.donate-option:hover {
  transform: translateY(-5px);
  border: 1px solid var(--color-primary-dark); /* Borde sutil al hacer hover */
}

.donate-option h3 {
  color: var(--color-primary-light);
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

.donate-option p {
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

.kofi-btn, .paypal-donate-btn {
  transition: transform 0.3s;
}

.kofi-btn:hover, .paypal-donate-btn:hover {
  transform: scale(1.05);
}

.paypal-donate-btn {
  background: white;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .hero h2 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  main {
    flex-direction: column;
    padding: 1rem;
  }
  
  .filters {
    width: 100%;
    position: static;
    margin-bottom: 1rem;
  }
  
  #games-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
  
  .game-detail-header {
    flex-direction: column;
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 1.5rem;
  }
  
  .donate-floating-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    bottom: 20px;
    right: 20px;
  }
  
  .donate-options {
    flex-direction: column;
    align-items: center;
  }
}

/* Efectos de carga */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #9f7aea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--color-primary-light);
  font-size: 1.2rem;
}

/* Spinner adaptado al color primario */
.loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top: 4px solid var(--color-primary-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}