/* Custom styles beyond Tailwind */

/* ============= CATEGORY TABS & FILTERS ============= */
.category-tabs {
  display: flex;
  gap: 10px;
  margin: 30px 0 20px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sort-options {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  justify-content: center;
}

.sort-options label {
  color: #ffffff;
  font-weight: 500;
}

.sort-options select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.sort-options select option {
  background: #2a5298;
  color: #ffffff;
}

/* ============= PAGE STRUCTURE OPTIMIZATIONS ============= */

/* Dark theme for main page */
.dark-theme {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh !important;
}

/* Navigation glass effect */
.nav-glass {
  background: rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(15px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Enhanced buttons */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  padding: 12px 24px !important;
  border-radius: 50px !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: all 0.3s ease !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
}

.btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(10px) !important;
  color: white !important;
  padding: 12px 24px !important;
  border-radius: 50px !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: all 0.3s ease !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px) !important;
}

/* Enhanced glass cards */
.glass-card {
  background: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(10px) !important;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  overflow: hidden !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.glass-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2) !important;
}

/* Navigation items */
.nav-item {
  color: white !important;
  text-decoration: none !important;
  padding: 12px 20px !important;
  border-radius: 10px !important;
  transition: all 0.3s ease !important;
  font-weight: 500 !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  transform: translateY(-2px) !important;
}

/* Text gradient */
.text-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

/* GitHub badge */
.github-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #1e293b;
  margin: 0;
  padding: 0;
}

/* CSS Variables */
:root {
  --primary-blue: #3b82f6;
  --primary-purple: #8b5cf6;
  --primary-teal: #06b6d4;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --shadow-light: 0 8px 32px rgba(31, 38, 135, 0.2);
  --shadow-medium: 0 12px 40px rgba(31, 38, 135, 0.25);
  --blur-amount: 12px;
  --border-radius: 16px;
  --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Language Switcher */
.language-switcher {
  appearance: none;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #333;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.language-switcher:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.language-switcher:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* RTL Support for Arabic */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] .container {
  direction: rtl;
}

html[dir="rtl"] nav ul {
  flex-direction: row-reverse;
}

html[dir="rtl"] .games-grid,
html[dir="rtl"] .category-grid {
  direction: rtl;
}

html[dir="rtl"] .game-card {
  text-align: right;
}

html[dir="rtl"] .footer-content {
  text-align: right;
}

/* Glass morphism effects */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(31, 38, 135, 0.3);
}

/* Navigation styles */
.nav-glass {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-item {
  position: relative;
  padding: 12px 20px;
  border-radius: 12px;
  transition: all 0.2s ease;
  color: #1e293b;
  text-decoration: none;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-blue);
  transform: translateY(-1px);
}

/* Button styles */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 50%, var(--primary-teal) 100%);
  border: none;
  color: white;
  padding: 14px 28px;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(59, 130, 246, 0.3);
  color: #1e293b;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--primary-blue);
  transform: translateY(-2px);
}

/* Hero section */
.hero-gradient {
  background: linear-gradient(135deg, 
    rgba(102, 126, 234, 0.8) 0%, 
    rgba(118, 75, 162, 0.8) 50%, 
    rgba(255, 154, 158, 0.8) 100%
  );
  position: relative;
  overflow: hidden;
}

/* Search styles */
.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 16px 24px 16px 50px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  color: inherit;
  font-size: 16px;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
}

/* Game container */
.game-container {
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Dropdown menu */
.dropdown-menu {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  padding: 8px;
}

.dropdown-item {
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

/* Floating animation */
.floating {
  animation: float 6s ease-in-out infinite;
}

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

/* Text gradient */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Typography */
.heading-large {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
}

.heading-medium {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
}

/* Search Styles */
.search-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 16px 60px 16px 24px;
  font-size: 1.125rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

.search-button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.search-button:hover {
  color: var(--primary-blue);
  background: rgba(255, 255, 255, 0.1);
}

.category-quick-btn {
  padding: 16px;
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.category-quick-btn:hover {
  transform: translateY(-4px) scale(1.05);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.filter-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(66, 165, 245, 0.3);
}

.filter-select option {
  background: #1a1a1a;
  color: white;
}

.game-card {
  transition: all 0.3s ease;
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.search-results-container {
  min-height: 400px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
}

.results-count {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Footer */
.footer-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border-top: 1px solid var(--glass-border);
}

/* Section background */
.section-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-light);
}

/* Statistics cards */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
}

/* Animations */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.slide-up {
  animation: slideUp 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Accessibility */
*:focus {
  outline: 3px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 100%);
    color: #f8fafc;
  }
  
  :root {
    --glass-bg: rgba(0, 0, 0, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  :root {
    --border-radius: 12px;
    --blur-amount: 8px;
  }
  
  .glass-card:hover {
    transform: translateY(-2px);
  }
  
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

/* ============= PERFORMANCE OPTIMIZATIONS ============= */

/* Critical rendering optimizations */
.critical-render {
  contain: layout style paint;
  will-change: transform;
}

/* Lazy loading images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Enhanced focus indicators */
.focus-visible:focus {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Optimized transforms */
.transform-gpu {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
} 