/* ========================================
   H5 Game Portal - Main Styles
   ======================================== */

/* CSS Variables */
:root {
  /* Brand Colors */
  --primary-color: #6366f1; /* Indigo 500 */
  --primary-hover: #4f46e5; /* Indigo 600 */
  --secondary-color: #ec4899; /* Pink 500 */
  --accent-color: #8b5cf6; /* Violet 500 */
  
  /* Gradients */
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --surface-gradient: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.7) 100%);
  
  /* Backgrounds */
  --bg-body: #0f172a; /* Slate 900 */
  --bg-surface: #1e293b; /* Slate 800 */
  --bg-surface-hover: #334155; /* Slate 700 */
  --bg-glass: rgba(15, 23, 42, 0.8);
  
  /* Text */
  --text-primary: #f8fafc; /* Slate 50 */
  --text-secondary: #94a3b8; /* Slate 400 */
  --text-muted: #64748b; /* Slate 500 */
  
  /* Borders & Shadows */
  --border-color: rgba(148, 163, 184, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  /* Dimensions */
  --header-height: 72px;
  --max-width: 1280px;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ambient Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 25%);
  pointer-events: none;
  z-index: -1;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   Header
   ======================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.logo span:last-child {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-menu {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.nav-link.active {
  color: #fff;
  background: var(--primary-color);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* Language Selector */
.language-selector {
  position: relative;
  margin-left: 1rem;
}

.language-selector select {
  appearance: none;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.language-selector select:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.5);
}

.language-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ========================================
   Layout
   ======================================== */
main {
  flex: 1;
  padding-bottom: 4rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========================================
   New Games Grid
   ======================================== */
.new-games-section {
  margin-top: 3rem;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.section-title-icon {
  font-size: 1.5rem;
}

.games-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

.game-card-small {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.game-card-small:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--primary-color);
}

.game-card-small-thumb {
  aspect-ratio: 16/10;
  width: 100%;
  object-fit: cover;
  background: #2a2a4a;
  transition: transform 0.5s ease;
}

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

.game-card-small-info {
  padding: 1rem;
  background: var(--bg-surface);
  z-index: 1;
}

.game-card-small-title {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  margin-top: auto;
  background: #0b1120;
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 320px;
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
}

.footer-link {
  display: block;
  padding: 0.4rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--primary-color);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 1024px) {
  .nav-menu {
    display: none; /* Hide for now, can implement drawer later */
  }
  
  .nav-menu.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .games-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Utility */
.hidden {
  display: none !important;
}