/* =========================================== */
/*       TAGS PAGE - MODERN PREMIUM THEME      */
/* =========================================== */

/* 1. TAGS HERO SECTION */
.section-tags-hero {
  padding: 140px 0 60px;
  margin-top: 0;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.section-tags-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    conic-gradient(from 0deg at 50% 50%, rgba(99, 102, 241, 0.1) 0deg, transparent 60deg, transparent 300deg, rgba(236, 72, 153, 0.1) 360deg);
  filter: blur(60px);
  opacity: 0.6;
  pointer-events: none;
}

.section-tags-hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #f8fafc 20%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
  text-shadow: none;
}

.section-tags-hero p {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

/* 2. TAG GAMES SECTION */
.section-tag-games {
  padding: var(--spacing-3xl) 0;
  background: var(--color-bg-primary);
}

/* 3. MAIN CONTAINER */
.container-tags-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* 2. LOADING AND ERROR STATES */
.state-loading {
  text-align: center;
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  padding: 80px 0;
  font-weight: 500;
}

.container-error {
  text-align: center;
  padding: 60px 20px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  margin: 20px 0;
  border: 1px solid var(--color-border);
}

/* 3. PAGE HEADER */
.header-tags-page {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
}

.header-tags-page h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  background: none;
  -webkit-text-fill-color: initial;
}

.header-tags-page p {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* 4. TAG FILTERS - Modern Pills */
.container-tag-filters {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 12px;
}

.tag-filter {
  padding: 10px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.tag-filter::before {
  display: none;
}

.tag-filter:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  transform: translateY(-2px);
  border-color: var(--color-text-muted);
}

.tag-filter.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}

/* 5. GAME COUNT DISPLAY */
.container-games-count {
  text-align: center;
  margin-bottom: 32px;
  padding: 16px;
  background: transparent;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
  display: inline-block;
  min-width: 200px;
  margin-left: auto;
  margin-right: auto;
  display: block;
  max-width: 300px;
}

/* 6. GAMES GRID */
.grid-games-by-tag {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

/* 7. GAME CARDS (Matches organized-home.css) */
.card-game {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  height: 100%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.card-game:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(255, 255, 255, 0.1);
}

.card-game::after {
  display: none;
}

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

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

.placeholder-content {
  text-align: center;
  color: var(--color-text-muted);
}

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

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

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

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

/* 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;
  position: relative;
  z-index: 2;
  background: var(--color-bg-card);
}

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

.container-game-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-warning);
  font-size: 0.85rem;
  font-weight: 600;
}

.container-game-genre {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 0.75rem;
}

.tag-genre {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  border: none;
  transition: all var(--transition-normal);
}

.card-game:hover .tag-genre {
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary-light);
}

.badge-featured {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--color-primary);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 2;
  box-shadow: var(--shadow-md);
}

/* 8. EMPTY STATE */
.container-empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  margin: 40px 0;
  border: 1px solid var(--border-color);
}

.container-empty-state h3 {
  font-size: 1.5rem;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  font-weight: 700;
}

.container-empty-state p {
  color: var(--color-text-secondary);
  font-size: 1rem;
  margin-bottom: 24px;
}

.button-go-home {
  display: inline-block;
  padding: 12px 32px;
  background: var(--color-primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: all var(--transition-normal);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.button-go-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
  background: var(--color-primary-dark);
}

/* 9. LOAD MORE BUTTON */
.container-load-more {
  text-align: center;
  margin-top: 60px;
  padding-bottom: 40px;
}

.button-load-more {
  padding: 14px 32px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-load-more::before {
  display: none;
}

.button-load-more:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.button-load-more:active {
  transform: translateY(0);
}

.button-load-more.loading {
  pointer-events: none;
  opacity: 0.8;
}

.button-load-more.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 12px;
}

@keyframes spin {
  0% {transform: rotate(0deg); }
  100% {transform: rotate(360deg); }
}

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

/* 11. LOADING ANIMATION */
.animation-loading-shimmer {
  background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-bg-tertiary) 50%, var(--color-bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {background-position: -200% 0; }
  100% {background-position: 200% 0; }
}

/* 12. MOBILE RESPONSIVE */
@media (max-width: 768px) {
  .container-tags-page {
    padding: 15px;
  }

  .section-tags-hero {
    padding: 100px 0 40px;
  }

  .section-tags-hero h1 {
    font-size: 2rem;
  }

  .header-tags-page {
    margin-bottom: 30px;
  }

  .header-tags-page h1 {
    font-size: 2rem;
  }

  .header-tags-page p {
    font-size: 1rem;
  }

  .container-tag-filters {
    margin-bottom: 24px;
    gap: 8px;
  }

  .tag-filter {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .container-games-count {
    margin-bottom: 24px;
    padding: 12px;
    font-size: 0.9rem;
  }

  .grid-games-by-tag {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
  }

  .container-empty-state {
    padding: 40px 15px;
  }

  .button-go-home {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .container-load-more {
    margin-top: 30px;
  }

  .button-load-more {
    padding: 12px 24px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .section-tags-hero h1 {
    font-size: 1.75rem;
  }

  .header-tags-page h1 {
    font-size: 1.5rem;
  }

  .grid-games-by-tag {
    gap: 10px;
  }
  
  .card-game {
    box-shadow: none;
    border: none;
    background: transparent;
  }
  
  .container-game-info {
    padding: 8px 0;
    background: transparent;
  }
  
  .tag-filter {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* Empty state for no results */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  margin: 40px 0;
  min-height: 300px;
  width: 100%;
  box-sizing: border-box;
  grid-column: 1 / -1;
}

.no-results::before {
  content: '🔍';
  font-size: 3rem;
  margin-bottom: 20px;
  filter: none;
}

.no-results h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--color-text-primary);
  background: none;
  -webkit-text-fill-color: initial;
}

.no-results p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 0;
  max-width: 500px;
  line-height: 1.6;
}
