/* Modern Flash Games Hub Styles */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --accent-color: #ec4899;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --border-color: #e5e7eb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
}

/* Header & Navigation */
.header {
  background: linear-gradient(135deg, #f8f9ff 0%, #faf5ff 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-link {
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 40px 20px 50px;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Categories Section Container */
#categories {
  background: linear-gradient(135deg, #fefefe 0%, #f8f9ff 100%);
  padding: 24px 20px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.08);
}

/* Mobile: Compact category section */
@media (max-width: 768px) {
  #categories {
    padding: 16px;
    margin-bottom: 16px !important;
  }
}

/* Category Buttons */
.category-btn {
  background: white;
  border: 2px solid var(--border-color);
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  color: var(--text-dark);
  transition: all 0.2s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.category-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

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

/* Game Cards */
.game-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.game-thumbnail {
  width: 100%;
  aspect-ratio: 3/2;  /* 修改为 3:2 以匹配 300x200 尺寸 */
  object-fit: cover;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-description {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.game-category-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-light);
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.featured-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ad Containers */
.ad-container {
  background: #f8f9fa;
  border: 1px dashed #dee2e6;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 0.875rem;
}

.ad-container.has-content {
  background: transparent;
  border: none;
  padding: 0;
}

/* Section Headers */
.section-header {
  margin-bottom: 32px;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-light);
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Search Box */
.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto 20px;
}

.search-input {
  width: 100%;
  padding: 16px 56px 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  font-size: 1rem;
  transition: all 0.2s;
  background: white !important;
  color: #1f2937 !important; /* 确保输入文字是深色 - 使用!important强制覆盖 */
}

.search-input::placeholder {
  color: var(--text-light); /* placeholder颜色 */
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1.25rem;
  pointer-events: none; /* Allow click-through to input */
}

/* Footer */
.footer {
  background: var(--text-dark);
  color: white;
  padding: 60px 20px 30px;
  margin-top: 80px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-section {
    padding: 30px 20px 40px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .game-title {
    font-size: 1rem;
  }
}

/* Button Styles */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 600;
  border: 2px solid var(--primary-color);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 40px;
}

.pagination-btn {
  padding: 10px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.pagination-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

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

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compact Search Box in Header */
.search-input-compact {
  width: 280px;
  padding: 8px 36px 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.search-input-compact:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon-compact {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

/* Sticky Header */
.header.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
  .search-input-compact {
    width: 200px;
  }
}

/* ==================== Category Cards Style ==================== */
.category-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.category-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.15);
}

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

.category-card-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 16px;
  transition: all 0.3s;
}

.category-card.active .category-card-icon {
  background: rgba(255, 255, 255, 0.2);
}

.category-card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

/* Mobile category cards */
@media (max-width: 640px) {
  .category-card {
    padding: 16px 12px;
    gap: 8px;
  }
  
  .category-card-icon {
    width: 48px;
    height: 48px;
  }
  
  .category-card-name {
    font-size: 12px;
  }
}

/* ==================== Dynamic Game Card Sizing ==================== */
:root {
  --card-width: 250px;
  --card-thumbnail-height: 188px;
  --card-title-size: 16px;
  --card-padding: 16px;
  --games-per-row-xl: 4;
  --games-per-row-lg: 3;
  --games-per-row-sm: 2;
}

/* Apply dynamic sizing to game cards */
.game-card {
  min-width: var(--card-width);
}

.game-thumbnail {
  height: var(--card-thumbnail-height);
}

.game-title {
  font-size: var(--card-title-size);
}

.game-info {
  padding: var(--card-padding);
}

/* ==================== Header Layout Variants ==================== */
.header-compact {
  padding: 12px 0;
}

.header-full {
  padding: 24px 0;
}

.header-full .logo {
  font-size: 2rem;
}

.header-full .nav-link {
  font-size: 1.125rem;
  padding: 12px 20px;
}

/* ==================== Carousel Styles ==================== */
.carousel-container {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  margin-bottom: 32px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.carousel-slide {
  display: none;
  animation: fadeIn 0.5s;
}

.carousel-slide.active {
  display: block;
}

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

.carousel-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s;
}

.carousel-dot.active {
  background: white;
  width: 32px;
  border-radius: 6px;
}

/* ==================== Mobile Optimizations ==================== */
@media (max-width: 768px) {
  :root {
    --card-width: 180px;
    --card-padding: 12px;
    --card-title-size: 14px;
  }
}
