/* ==================== FIX CRÍTICO: Desactivar grid para el home ==================== */
/* El home se renderiza dentro de .premium-games-grid que tiene display: grid */
/* Esto causa que el carousel se divida en columnas */

.premium-games-grid:has(.home-container) {
  display: block !important;
  grid-template-columns: none !important;
}

/* Asegurar que el home ocupe todo el ancho */
.home-container {
  width: 100% !important;
  max-width: none !important;
  display: block !important;
}

/* ==================== HOME STYLES ==================== */
/* Estilos para el nuevo home con featured content */

.home-container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 20px 40px;
}

.home-content {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* ==================== SECTION HEADERS ==================== */
.section-header-home {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-icon-home {
  font-size: 1.75rem;
}

.section-title-home {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* ==================== FEATURED CAROUSEL ==================== */
.featured-section {
  margin-bottom: 20px;
}

.featured-carousel-container {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  height: 600px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.carousel-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  padding: 60px;
}

.carousel-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.slide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(10, 10, 15, 0.95) 0%, rgba(10, 10, 15, 0.7) 50%, transparent 100%);
  z-index: 1;
}

.slide-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.slide-platform-badge {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.slide-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.1;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}

.slide-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.slide-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-actions {
  display: flex;
  gap: 16px;
}

.slide-btn {
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}

.slide-btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
}

.slide-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(139, 92, 246, 0.4);
}

.slide-btn-secondary {
  background: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
  border: 2px solid #8b5cf6;
}

.slide-btn-secondary:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* Carousel Navigation */
.carousel-nav {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  gap: 12px;
  z-index: 3;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
  width: 32px;
  border-radius: 6px;
  background: #8b5cf6;
}

/* Carousel Empty/Loading States */
.carousel-loading,
.carousel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}

.carousel-empty .empty-icon {
  font-size: 4rem;
  opacity: 0.5;
}

.carousel-empty p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.carousel-empty .empty-hint {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

/* ==================== PLATFORM CAROUSELS ==================== */
.platform-carousel-section {
  margin-bottom: 50px;
}

.platform-carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.see-all-link {
  color: #8b5cf6;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s;
  font-size: 0.9375rem;
}

.see-all-link:hover {
  color: #a78bfa;
}

.games-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: #8b5cf6 rgba(139, 92, 246, 0.1);
}

.games-scroll::-webkit-scrollbar {
  height: 8px;
}

.games-scroll::-webkit-scrollbar-track {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
}

.games-scroll::-webkit-scrollbar-thumb {
  background: #8b5cf6;
  border-radius: 4px;
}

/* ==================== GAME CARDS - RESPONSIVOS ==================== */
.game-card-home {
  /* ⭐ Tamaño adaptativo según viewport */
  flex: 0 0 clamp(220px, 18vw, 320px);
  min-width: 220px;
  background: rgba(30, 30, 46, 0.8);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.2);
  transition: all 0.3s;
  cursor: pointer;
}

.game-card-home:hover {
  transform: translateY(-8px);
  border-color: #8b5cf6;
  box-shadow: 0 20px 40px rgba(139, 92, 246, 0.3);
}

.game-card-image-home {
  width: 100%;
  height: clamp(160px, 14vw, 240px); /* ⭐ Altura adaptativa */
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card-gradient {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.gradient-icon {
  font-size: 3rem;
  opacity: 0.8;
}

.game-card-content-home {
  padding: 16px;
}

.game-card-title-home {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.8em;
}

.game-card-platform-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 6px;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.game-card-btn-home {
  width: 100%;
  padding: 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid #8b5cf6;
  border-radius: 8px;
  color: #a78bfa;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.game-card-btn-home:hover {
  background: rgba(139, 92, 246, 0.2);
  transform: scale(1.05);
}

/* ==================== CLASSICS GRID - RESPONSIVO ==================== */
.classics-section {
  margin-top: 60px;
}

.classics-grid {
  display: grid;
  /* ⭐ Grid adaptativo: más columnas en pantallas anchas */
  grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 20vw, 320px), 1fr));
  gap: 24px;
  margin-bottom: 30px;
}

.classic-card-home {
  background: rgba(30, 30, 46, 0.6);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.2);
  transition: all 0.3s;
  cursor: pointer;
}

.classic-card-home:hover {
  transform: translateY(-4px);
  border-color: #8b5cf6;
  background: rgba(30, 30, 46, 0.8);
}

.classic-card-image-home {
  width: 100%;
  height: clamp(160px, 14vw, 240px); /* ⭐ Altura adaptativa */
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.classic-card-content-home {
  padding: 20px;
}

.classic-card-title-home {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.classics-actions {
  text-align: center;
}

.refresh-classics-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  background: rgba(139, 92, 246, 0.1);
  border: 2px solid #8b5cf6;
  border-radius: 12px;
  color: #a78bfa;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.refresh-classics-btn:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.2);
  transform: scale(1.05);
}

.refresh-classics-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading States */
.grid-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 16px;
}

.grid-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 16px;
}

.grid-empty .empty-icon {
  font-size: 4rem;
  opacity: 0.5;
}

.grid-empty p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
  .slide-title {
    font-size: 2.5rem;
  }
  
  .carousel-slide {
    padding: 40px;
  }
  
  .home-container {
    padding: 20px 30px;
  }
  
  /* Cards un poco más grandes en tablets */
  .game-card-home {
    flex: 0 0 clamp(240px, 25vw, 280px);
  }
}

@media (max-width: 768px) {
  .home-content {
    gap: 40px;
  }
  
  .featured-carousel-container {
    height: 400px;
  }
  
  .carousel-slide {
    padding: 30px;
  }
  
  .slide-title {
    font-size: 2rem;
  }
  
  .slide-actions {
    flex-direction: column;
  }
  
  .slide-btn {
    width: 100%;
    justify-content: center;
  }
  
  .section-title-home {
    font-size: 1.5rem;
  }
  
  .classics-grid {
    grid-template-columns: 1fr;
  }
  
  .carousel-nav {
    bottom: 20px;
    right: 20px;
  }
  
  .home-container {
    padding: 15px 20px;
  }
  
  /* Cards móviles: tamaño fijo */
  .game-card-home {
    flex: 0 0 200px;
  }
}

@media (max-width: 480px) {
  .home-container {
    padding: 10px;
  }
  
  .featured-carousel-container {
    height: 350px;
  }
  
  .carousel-slide {
    padding: 20px;
  }
  
  .slide-title {
    font-size: 1.5rem;
  }
  
  .game-card-home {
    flex: 0 0 180px;
  }
}

/* ==================== PANTALLAS ULTRA WIDE ==================== */
@media (min-width: 1920px) {
  /* En pantallas ultra anchas, las cards pueden ser más grandes */
  .game-card-home {
    flex: 0 0 clamp(280px, 15vw, 360px);
  }
  
  .classics-grid {
    grid-template-columns: repeat(auto-fill, minmax(clamp(280px, 18vw, 360px), 1fr));
  }
}

@media (min-width: 2560px) {
  /* Pantallas 4K: cards aún más grandes para aprovechar el espacio */
  .game-card-home {
    flex: 0 0 clamp(320px, 14vw, 400px);
  }
  
  .game-card-image-home,
  .classic-card-image-home {
    height: clamp(200px, 12vw, 280px);
  }
  
  .classics-grid {
    grid-template-columns: repeat(auto-fill, minmax(clamp(320px, 16vw, 400px), 1fr));
  }
}

/* ==================== ANIMATIONS ==================== */
.home-container {
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Spinner animation */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}