/* =========================================== */
/*    HOME PAGE - MODERN PREMIUM THEME STYLES  */
/* =========================================== */

/* 1. PAGE HEADER */
.page-header {
  text-align: center;
  position: relative;
  padding: 2rem 0;
}

.page-header h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  text-shadow: none;
}

.page-header .module-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  text-shadow: none;
}


/* 2. SECTION TITLES AND STYLES */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: left;
  position: relative;
  padding-bottom: 0;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
  text-shadow: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::before {
  content: '';
  display: block;
  width: 6px;
  height: 24px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

.section-title::after {
  display: none;
}

/* 3. SECTION STYLING - Clean Backgrounds */
.section-featured {
  padding: var(--spacing-1xl) 0;
  background: transparent; /* Let body bg show through or set specifically */
}

/* Alternating backgrounds for visual separation */
.section-featured {background: var(--color-bg-primary); }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-md);
}

/* 5. GAME GRID AND CARDS */
.grid-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); /* Larger cards */
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.grid-featured {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Even larger for featured */
}

/* 6. GAME CARD COMPONENT - Modern Premium Style */
.card-game {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.32);
  height: 100%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.card-game:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.45);
  border-color: rgba(34, 211, 238, 0.38);
}

/* Remove old neon effects */
.card-game::before {display: none; }

.container-image {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  overflow: hidden;
  background: var(--color-bg-tertiary);
}

.container-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.08) 0%, rgba(2, 6, 23, 0.42) 100%);
  pointer-events: none;
}

.game-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card-game:hover .game-image {
  transform: scale(1.05);
}

.placeholder-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-tertiary);
  flex-direction: column;
}

.placeholder-icon {
  font-size: 2rem;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xs);
}

.placeholder-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Image loading logic classes */
.placeholder-image {display: none; }
.game-image.loading + .placeholder-image {display: flex; }
.game-image.error {display: none; }
.game-image.error + .placeholder-image {display: flex; }

.container-game-info {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.9));
  position: relative;
  z-index: 2;
}

.title-game {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1; /* Allow 2 lines */
  overflow: hidden;
  margin-bottom: 0.25rem;
}


.card-game:hover .title-game {
  color: #e2e8f0;
  text-shadow: none;
}

.card-cta {
  margin-top: auto;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.32);
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  transition: all var(--transition-normal);
  opacity: 0;
  transform: translateY(3px);
}

.card-game:hover .card-cta {
  color: #0f172a;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  border-color: transparent;
  opacity: 1;
  transform: translateY(0);
}

/* Hero intro (policy-friendly copy: no unverified counts) */
.hero-kicker {
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 0 0 var(--spacing-md);
}

.hero .hero-slogan {
  margin: 0 auto 1.1rem;
  max-width: 46rem;
  font-size: clamp(1.05rem, 1.55vw, 1.28rem);
  line-height: 1.35;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0;
}

.hero .hero-headline {
  margin: 0 auto 0.9rem;
  max-width: 46rem;
  font-size: clamp(1.45rem, 2.45vw, 2.05rem);
  line-height: 1.25;
  font-weight: 800;
  color: rgba(241, 245, 255, 0.96);
}

.hero-summary {
  margin: 0 auto 1.35rem;
  max-width: 40rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.hero-highlights {
  list-style: none;
  margin: var(--spacing-lg) auto 0;
  padding: 0;
  width: fit-content;
  max-width: 32rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text-secondary);
}

/* Keep comfortable rhythm when highlights are above actions */
.hero-content .hero-highlights + .hero-actions {
  margin-top: var(--spacing-xl);
  margin-bottom: 0;
}

.hero-content .hero-actions {
  justify-content: center;
}

.hero-highlights li {
  position: relative;
  padding-left: 1.35rem;
  text-align: left;
}

.hero-highlights li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary-light);
  opacity: 0.85;
}

/* 7. HERO STATS - Clean Dashboard Style */
.stats-hero,
.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-2xl);
  flex-wrap: wrap;
  width: 100%;
  max-width: 1000px;
}

.stat-item,
.stat {
  flex: 1;
  text-align: center;
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  min-width: 160px;
  transition: all var(--transition-normal);
}

.stat-item:hover,
.stat:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
  text-shadow: none;
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Color specific stats overrides if needed, keeping it clean for now */
.stat:nth-child(2) .stat-number {
  /* color: var(--color-secondary); */
}

.section-description {
  text-align: left;
  color: var(--color-text-secondary);
  font-size: 1rem;
  max-width: 800px;
}

/* 8. ANIMATIONS - Subtle */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 9. LOADING STATES */
.state-loading {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-secondary);
  font-size: 1rem;
  font-weight: 500;
  background: transparent;
  border-radius: var(--radius-lg);
  margin: var(--spacing-lg) 0;
  border: 1px dashed var(--border-color);
  animation: none;
}

/* 10. CATEGORY SPECIFIC STYLES - Clean Colors */
/* Just simple colored bars/accents instead of glowing text */

/* 10. Module variations for richer section styles */
.page-header-rich {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 10px 0 0;
  margin-bottom: 10px;
  text-align: left;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.page-header-description p{
  text-align: left;
  margin-bottom: 10px;
}
.page-header-rich h2::after {
  content: '';
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 999px;
  margin-top: 0.8rem;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
}

.page-header-rich h2 {
  font-size: clamp(1.6rem, 2.3vw, 2.2rem);
  margin-bottom: 0;
  letter-spacing: -0.01em;
  flex: 1;
}

.page-header-rich .module-title {
  font-size: clamp(1.6rem, 2.3vw, 2.2rem);
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}

.page-header-rich .module-description {
  margin: 0.5rem 0 0 0;
  max-width: 760px;
  color: #9ca3af;
  font-size: 0.98rem;
  line-height: 1.6;
  flex-basis: 100%;
}

.module-header-actions {
  margin-top: 0;
  margin-left: auto;
}

.module-link-more {
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.module-link-more::after {
  content: " →";
  display: inline-block;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
}
.module-link-more:hover::after {
  transform: translateX(2px);
}

.module-link-more:hover {
  color: #dbeafe;
  text-decoration: none;
}

.grid-featured-rich .card-game {
  overflow: visible;
}

.grid-featured-rich .description-game {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Module mood by style: stronger game identity */
.module-style-hero .page-header-rich::after {
  background: linear-gradient(90deg, #a855f7, #22d3ee);
}

.module-style-alt .page-header-rich::after {
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.module-style-split .page-header-rich::after {
  background: linear-gradient(90deg, #f97316, #eab308);
}

.module-style-list .page-header-rich::after {
  background: linear-gradient(90deg, #34d399, #14b8a6);
}

.module-style-split .card-game-split:nth-child(1) {
  border-color: rgba(249, 115, 22, 0.45);
}

.module-style-split .card-game-split:nth-child(1):hover {
  box-shadow: 0 22px 36px rgba(2, 6, 23, 0.6), 0 0 0 1px rgba(249, 115, 22, 0.45);
}

.module-style-list .card-game-list:nth-child(4n + 1) {
  border-color: rgba(52, 211, 153, 0.42);
}

.module-style-hero .page-header-rich {
  background: transparent;
}

.module-style-alt .page-header-rich {
  background: transparent;
}

.module-style-split .page-header-rich {
  background: transparent;
}

.module-style-list .page-header-rich {
  background: transparent;
}

/* Layout A: hero + card wall */
.grid-featured-split {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 1rem;
}

.grid-featured-split .card-game-split {
  min-height: 220px;
}

.grid-featured-split .card-game-split:nth-child(1) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 1.25fr) 1fr;
  min-height: 280px;
}

.grid-featured-split .card-game-split .container-image {
  padding-top: 58%;
}

.grid-featured-split .card-game-split .container-game-info {
  padding: 1rem 1.05rem 1.1rem;
}

.grid-featured-split .card-game-split:nth-child(1) .container-image {
  padding-top: 0;
  height: 100%;
}

.grid-featured-split .card-game-split:nth-child(1) .title-game {
  font-size: 1.28rem;
  -webkit-line-clamp: 2;
}

.grid-featured-split .card-game-split:nth-child(1) .description-game {
  -webkit-line-clamp: 3;
}

/* Layout B: compact card wall */
.grid-featured-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-featured-list .card-game-list {
  min-height: 0;
  position: relative;
}

.grid-featured-list .card-game-list .container-image {
  padding-top: 56.25%;
}

.grid-featured-list .card-game-list .container-game-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 0.85rem 0.85rem 0.8rem;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0) 0%, rgba(2, 6, 23, 0.88) 48%, rgba(2, 6, 23, 0.96) 100%);
  min-height: 48%;
  justify-content: flex-end;
  border-top: none;
}

.grid-featured-list .card-game-list .title-game {
  font-size: 0.88rem;
  line-height: 1.35;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}

.grid-featured-list .card-game-list .description-game {
  display: none;
}

.grid-featured-list .card-game-list:nth-child(4n + 1) {
  border-color: rgba(99, 102, 241, 0.34);
}

.grid-featured-list .card-game-list .card-cta {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  margin-top: 0;
  opacity: 1;
  transform: none;
  font-size: 0.66rem;
  padding: 0.26rem 0.55rem;
  background: rgba(2, 6, 23, 0.72);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.45);
}

.grid-featured-list .card-game-list:hover .card-cta {
  background: #22d3ee;
  color: #0f172a;
}

/* 13. MOBILE RESPONSIVE */
@media (max-width: 768px) {
  /* Prevent horizontal overflow on small screens */
  .section-featured,
  .section-featured .container,
  .grid-games,
  .grid-featured,
  .grid-featured-split,
  .grid-featured-list {
    width: 100%;
    max-width: 100%;
  }

  .card-game,
  .container-image,
  .game-image,
  .lazyload {
    max-width: 100%;
  }

  .game-image,
  .lazyload {
    display: block;
  }

  /* Hero Section */
  .page-header {
    padding: 10px 0;
  }

  .page-header-rich {
    padding: 1rem 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .module-header-actions {
    margin-left: auto;
    margin-top: 0;
    flex-shrink: 0;
  }
  .page-header h2{
    font-size: 1.5rem;
    margin-bottom: 0;
  }
  .page-header-rich h2 {
    flex: 1;
    width: auto;
  }
  
  .section-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
  
  /* Stats */
  .stats-hero {
    gap: 12px;
    margin-top: 24px;
  }

  .stat-item,
  .stat {
    padding: 16px;
    min-width: 0; /* Allow shrinking */
  }
  
  .stat-number {
    font-size: 1rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  /* Grid adjustments */
  .grid-games,
  .grid-featured {
    gap: 16px;
    grid-template-columns: repeat(2, 1fr); /* Force 2 columns on mobile */
  }

  .grid-featured-split,
  .grid-featured-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .grid-featured-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-featured-split .card-game-split,
  .grid-featured-list .card-game-list {
    min-height: unset;
    grid-column: auto;
  }

  .grid-featured-split .card-game-split:nth-child(1) {
    grid-column: span 2;
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .grid-featured-split .card-game-split .container-image,
  .grid-featured-list .card-game-list .container-image {
    padding-top: 56.25%;
    height: auto;
  }

  .grid-featured-list .card-game-list .container-game-info {
    position: static;
    min-height: unset;
    padding: 0.75rem 0.8rem 0.85rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.9));
  }

  .grid-featured-list .card-game-list .description-game {
    display: -webkit-box;
    -webkit-line-clamp: 2;
  }

  .grid-featured-list .card-game-list .card-cta {
    position: static;
    margin-top: auto;
    font-size: 0.72rem;
    padding: 0.3rem 0.62rem;
  }

  /* Mobile touch devices: show CTA by default (no hover needed) */
  .card-cta {
    opacity: 1;
    transform: none;
    color: #0f172a;
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    border-color: transparent;
  }

  .card-game:hover .game-image {
    transform: none;
  }

  /* Ensure split layout first card keeps visible cover image on mobile */
  .grid-featured-split .card-game-split:nth-child(1) .container-image {
    padding-top: 56.25%;
    height: auto;
  }

  /* Unified rich module image sizing (for all rotating module styles) */
  .grid-featured-rich {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-featured-rich .card-game {
    width: 100%;
    min-width: 0;
  }

  .grid-featured-rich .container-image {
    width: 100%;
    max-width: 100%;
    padding-top: 56.25%;
    height: auto;
  }

  .grid-featured-rich .game-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .card-game {
    border-radius: var(--radius-md);
  }
  
  .container-game-info {
    padding: 12px;
    gap: 4px;
  }
  
  .title-game {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }
  
  .section-featured{
    padding: 0 0  var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .grid-games,
  .grid-featured {
    grid-template-columns: repeat(2, 1fr); /* Still 2 columns for game density */
    gap: 10px;
  }

  .grid-featured-split,
  .grid-featured-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .grid-featured-split .card-game-split:nth-child(1) {
    grid-column: span 2;
  }

  .grid-featured-rich {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-featured-list .card-game-list .container-game-info {
    position: static;
    min-height: unset;
    padding: 0.7rem 0.75rem 0.8rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.9));
  }

  .grid-featured-list .card-game-list .description-game {
    display: none;
  }

  .grid-featured-list .card-game-list .card-cta {
    position: static;
    margin-top: auto;
    font-size: 0.68rem;
    padding: 0.26rem 0.55rem;
  }

  /* Keep CTA visible on small touch screens */
  .card-cta {
    opacity: 1;
    transform: none;
    color: #0f172a;
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    border-color: transparent;
  }

  .grid-featured-split .card-game-split:nth-child(1) .container-image {
    padding-top: 56.25%;
    height: auto;
  }
  
  .card-game {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: var(--color-bg-card);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
  }

  /* Touch devices: keep style stable, disable hover zoom/pop */
  .card-game:hover {
    transform: none;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.18);
  }

  .card-game:hover .game-image {
    transform: none;
  }
  
  .container-image {
    border-radius: var(--radius-md);
  }
  
  .container-game-info {
    padding: 10px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.9));
  }
  
  .stat-number {
    font-size: 1rem;
  }
}

/* Unified single-line truncation for game titles in lists */
.game-title,
.title-game,
.title-similar-game,
.card-title,
.sidebar-game-title,
.recommended-name,
.new-game-title {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-info,
.container-game-info,
.sidebar-game-info,
.card-content,
.recommended-info,
.game-meta {
  min-width: 0;
}

.container-game-info .game-star {
  margin: 4px 0 2px;
  color: #ffb300;
  font-size: 0.84rem;
  line-height: 1;
}
