/* ============================================
   GAME PORTAL - Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0b0e;
  --bg-secondary: #12141a;
  --bg-card: #1a1d26;
  --bg-card-hover: #22263a;
  --bg-glass: rgba(26, 29, 38, 0.7);
  --bg-input: #1e2130;
  
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #5c6178;
  
  --accent-primary: #7c5cff;
  --accent-secondary: #5ce0d8;
  --accent-tertiary: #ff6b9d;
  --accent-gold: #ffd700;
  
  --gradient-hero: linear-gradient(135deg, #7c5cff 0%, #5ce0d8 50%, #ff6b9d 100%);
  --gradient-card: linear-gradient(145deg, rgba(124, 92, 255, 0.1), rgba(92, 224, 216, 0.05));
  --gradient-glow: radial-gradient(ellipse at center, rgba(124, 92, 255, 0.15) 0%, transparent 70%);
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(124, 92, 255, 0.3);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(124, 92, 255, 0.2);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background glow effect */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: var(--gradient-glow);
  animation: bgPulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.3; transform: translate(0, 0); }
  50% { opacity: 0.6; transform: translate(-5%, 5%); }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { 
  background: var(--accent-primary); 
  border-radius: 3px; 
}
::-webkit-scrollbar-thumb:hover { background: #9178ff; }

/* --- Layout --- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 11, 14, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-hero);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.logo-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search Bar */
.search-bar {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition-normal);
}

.search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
  background: var(--bg-card);
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.nav-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.stat-badge .stat-number {
  font-weight: 700;
  color: var(--accent-secondary);
}

/* --- Hero Section --- */
.hero {
  padding: 48px 0 32px;
  text-align: center;
  position: relative;
}

.hero h1 {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 12px;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: heroGradient 4s ease infinite;
  background-size: 200% 200%;
}

@keyframes heroGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* --- Category Pills --- */
.categories-bar {
  padding: 8px 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-bar::-webkit-scrollbar { display: none; }

.categories-list {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-normal);
  white-space: nowrap;
  text-decoration: none;
}

.category-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.category-pill.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.category-pill .cat-count {
  font-size: 11px;
  opacity: 0.6;
}

/* --- Game Grid --- */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .title-icon {
  font-size: 22px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding-bottom: 32px;
}

/* --- Game Card --- */
.game-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-normal);
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.game-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.game-card:hover .game-thumb img {
  transform: scale(1.08);
}

.game-card:hover .game-play-overlay {
  opacity: 1;
}

.game-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 */
  overflow: hidden;
  background: var(--bg-secondary);
}

.game-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-normal);
}

.play-btn {
  width: 56px;
  height: 56px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 0 30px rgba(124, 92, 255, 0.5);
  transform: scale(0.8);
  transition: var(--transition-spring);
}

.game-card:hover .play-btn {
  transform: scale(1);
}

.game-info {
  padding: 12px 14px;
}

.game-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.game-developer {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.game-category-badge {
  padding: 2px 8px;
  background: rgba(124, 92, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 500;
}

.downloaded-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  background: rgba(92, 224, 216, 0.2);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-secondary);
  border: 1px solid rgba(92, 224, 216, 0.3);
  z-index: 2;
}

/* --- Game Player Page --- */
.game-player-wrapper {
  padding: 20px 0;
}

.game-player {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}

.game-player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.game-player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: var(--transition-normal);
}

.game-player:hover .game-player-controls {
  opacity: 1;
}

.btn-fullscreen {
  padding: 8px 16px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-normal);
  font-family: inherit;
}

.btn-fullscreen:hover {
  background: #9178ff;
  transform: scale(1.05);
}

.game-detail-info {
  max-width: 1000px;
  margin: 24px auto 0;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.game-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.game-detail-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.game-detail-developer {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}

.game-tag {
  padding: 4px 12px;
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: var(--radius-xl);
  font-size: 12px;
  color: var(--accent-primary);
  transition: var(--transition-fast);
}

.game-tag:hover {
  background: rgba(124, 92, 255, 0.2);
}

.game-description {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* Related Games */
.related-section {
  max-width: 1000px;
  margin: 32px auto;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0;
}

.page-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  font-family: inherit;
}

.page-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.page-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.page-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 15px;
  max-width: 400px;
  margin: 0 auto;
}

/* --- Footer --- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
  z-index: 1;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Loading Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* --- Fullscreen Game --- */
.game-player.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  z-index: 9999;
  border: none;
}

/* --- Back Button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  margin-bottom: 16px;
}

.back-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar-inner { padding: 0 16px; height: 56px; }
  .nav-stats { display: none; }
  .search-bar { max-width: 100%; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .container { padding: 0 16px; }
  .categories-list { flex-wrap: nowrap; justify-content: flex-start; }
  .game-detail-title { font-size: 22px; }
  .game-player { border-radius: var(--radius-sm); }
}

@media (max-width: 480px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .logo-text { display: none; }
  .game-info { padding: 8px 10px; }
  .game-title { font-size: 13px; }
}

/* --- Featured Games Carousel --- */
.featured-section {
  margin-bottom: 32px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.featured-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.featured-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.featured-card:hover img {
  transform: scale(1.1);
}

.featured-card .featured-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

.featured-card .featured-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.featured-card .featured-cat {
  font-size: 12px;
  color: var(--accent-secondary);
  margin-top: 4px;
}

@media (max-width: 768px) {
  .featured-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .featured-grid { grid-template-columns: 1fr; }
}
