/* assets/css/style.css - AXN9 Modern Arcade Theme Engine */

/* ==========================================================================
   1. Theme Variables (Dark & Light Mode Support)
   ========================================================================== */
:root,
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --header-bg: rgba(15, 23, 42, 0.9);
  --hero-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --shadow-color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: rgba(0, 0, 0, 0.08);
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.2);
  --header-bg: rgba(255, 255, 255, 0.95);
  --hero-bg: linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%);
  --shadow-color: rgba(0, 0, 0, 0.08);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.cat-pill.active {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 4px 12px var(--accent-glow);
}

a {
  color: inherit;
  text-decoration: none;
}


/* ==========================================================================
   Header, Logo & Responsive Navigation (Dual-Tier Layout)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Tier 1: Top Navbar */
.top-navbar {
  padding: 10px 20px;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  z-index: 1002;
}

.logo-text {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text-main);
}

.logo-text span {
  color: var(--accent);
}

.logo-img {
  max-height: 40px;
  width: auto;
  mix-blend-mode: screen; /* Removes solid black box background */
  object-fit: contain;
}

/* Desktop Main Navigation */
.main-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--bg-secondary);
}

/* Header Actions (Search, Account, Theme Toggle) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Search Form */
.header-actions .search-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions .search-input {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-main);
  outline: none;
}

.header-actions .search-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

/* Account Icon Button */
.account-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.account-btn:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Theme Switcher Toggle */
.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Mobile Hamburger Button */
.menu-toggle-btn {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.4rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1002;
  transition: all 0.2s ease;
}

/* Tier 2: Category Bar - Overflow set to visible to allow dropdown overlay */
.category-navbar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 20px;
  position: relative !important;
  z-index: 1000 !important;
  overflow: visible !important;
}

.category-nav-container {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  overflow: visible !important;
}

.category-pills-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  overflow: visible !important; /* Prevents clipping dropdown */
}

/* Scrollbar Utility for Horizontal Pill Container */
.category-pills-wrapper::-webkit-scrollbar {
  display: none;
}

/* MORE Pill Button & Dropdown Container */
.more-pill-dropdown {
  position: relative;
  display: inline-block;
  overflow: visible !important;
}

.more-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  color: var(--text-main, #f8fafc);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.badge-count {
  background: #0ea5e9;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: bold;
}

/* MORE Dropdown Floating Overlay Menu */
.more-pills-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 8px;
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 9999 !important; /* Highest priority layer */
  flex-direction: column;
  gap: 4px;
}

.more-pills-menu.active {
  display: flex !important;
}

.more-pills-menu .dropdown-item {
  color: var(--text-main, #f8fafc);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.more-pills-menu .dropdown-item:hover,
.more-pills-menu .dropdown-item.active {
  background: linear-gradient(135deg, #00f0ff 0%, #0072ff 100%);
  color: #ffffff;
}

.mobile-pills {
  display: none;
}

/* Primary Header Navigation Links Active Style */
.main-header-nav .nav-link.active {
  color: #00f0ff !important;
  font-weight: 700;
  border-bottom: 2px solid #00f0ff;
}

/* Tier 2 Secondary Category Pills Active Style */
.category-pills-wrapper .cat-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  color: var(--text-main, #f8fafc);
  padding: 8px 12px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-pills-wrapper .cat-pill.active,
.category-pills-wrapper .cat-pill:hover {
  background: linear-gradient(135deg, #00f0ff 0%, #0072ff 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}
/* ==========================================================================
   Game Page Container & Layout Alignment Fixes
   ========================================================================== */
  /* Container Layout */
  .games-page-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 15px;
    box-sizing: border-box;
  }

  /* 1. Category Hero Banner Box */
  .category-hero-banner {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 20px;
    padding: 40px 25px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
  }

  .category-hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
  }

  .hero-banner-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
  }

  .hero-banner-desc {
    font-size: 1.1rem;
    color: var(--text-muted, #94a3b8);
    max-width: 750px;
    margin: 0 auto;
    line-height: 1.6;
  }

  .hero-banner-desc p {
    margin: 0 0 8px 0;
  }

  /* 2. Horizontal Scrollable Category Filter Bar */
  .category-filter-bar {
    display: flex !important;
    gap: 10px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 6px 0 14px 0 !important;
    margin-bottom: 25px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-filter-bar::-webkit-scrollbar {
    display: none;
  }

  /* 3. Collection Header */
  .collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    padding-bottom: 12px;
  }

  /* 4. Fully Responsive Auto-Fit Grid */
  .games-responsive-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 5. Game Card Styling */
  .game-card-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
  }

  .game-card-item:hover {
    transform: translateY(-4px);
    border-color: #00f0ff;
    box-shadow: 0 8px 20px rgba(0, 240, 255, 0.25);
  }

  .game-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #0f172a;
  }

  .game-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
  }

  .game-card-item:hover .game-card-img {
    transform: scale(1.05);
  }

  .game-card-details {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 2;
    background: var(--bg-card, #1e293b);
  }

  .game-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .game-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
  }

  .game-cat-badge {
    color: #00f0ff;
    font-weight: 600;
  }

  /* Small Mobile Viewport Adjustments (< 480px) */
  @media (max-width: 480px) {
    .games-page-container {
      padding: 10px 8px;
    }

    .category-hero-banner {
      padding: 20px 12px;
      margin-bottom: 15px;
      border-radius: 14px;
    }

    .hero-banner-title {
      font-size: 1.5rem;
    }

    .hero-banner-desc {
      font-size: 0.85rem;
    }

    .games-responsive-grid {
      /* Forces 3 equal-width columns on mobile */
      grid-template-columns: repeat(3, 1fr) !important;
      gap: 8px !important;
    }

    .game-card-details {
      padding: 6px 6px;
    }

    .game-card-title {
      font-size: 0.72rem;
      margin-bottom: 3px;
    }

    .game-card-meta {
      font-size: 0.65rem;
    }
  }

/* ==========================================================================
   Global Container & Layout Alignment Fixes
   ========================================================================== */

/* 1. Unify Max-Width Across Header & Page Content */
.main-container,
.hero-section,
.category-pills,
.layout-grid {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

/* 2. Hero Banner Full Width Stretch */
.hero-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
}

/* 3. Responsive Games Grid Fix (5 Columns on Desktop, Auto Fill) */
.layout-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

.content-col {
  width: 100%;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 uniform columns on desktop */
  gap: 18px;
  width: 100%;
}

/* Responsive Grid Adjustments */
@media (max-width: 1100px) {
  .games-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 850px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* 4. Fixed Image Card Sizing (Prevents Broken Image Overflow) */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.game-card .game-link {
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.game-card .game-thumb {
  width: 100%;
  aspect-ratio: 1 / 1; /* Maintains perfect uniform aspect ratio */
  object-fit: cover;
  background-color: #1e293b; /* Placeholder background if image breaks */
  display: block;
}

.game-card .game-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.game-card .game-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card .game-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Mobile Responsive Rules (< 992px)
   ========================================================================== */
@media (max-width: 992px) {
  .menu-toggle-btn {
    display: block; /* Show Hamburger Button */
    order: 1;
  }

  .brand-logo {
    order: 2;
  }

  .header-actions {
    order: 3;
  }

  /* Hide top header search on mobile */
  .header-actions .search-form {
    display: none !important;
  }

  .desktop-pills {
    display: none;
  }

  .mobile-pills {
    display: flex;
  }

  /* Mobile Slide-Out Drawer */
  .main-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 80px 20px 30px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav.active {
    left: 0;
  }

  .mobile-search-form {
    display: block !important;
    width: 100%;
    margin-bottom: 20px;
  }

  .mobile-search-form .search-box-wrapper {
    display: flex;
    gap: 8px;
  }

  .mobile-search-form .search-input {
    flex: 1;
    padding: 10px 2px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
  }

  .mobile-search-form .search-btn {
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
  }

  .nav-list {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .nav-link {
    display: block;
    padding: 12px 16px;
    font-size: 1.05rem;
    border-radius: 10px;
  }

  .nav-link:hover {
    border-color: var(--border-color);
    background: var(--bg-primary);
  }

  .menu-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
  }

  .menu-backdrop.active {
    display: block;
  }
}

/* Hide Mobile Drawer Search Box on Desktop Screens */
@media (min-width: 993px) {
  .mobile-search-form {
    display: none !important;
  }
}

/* ==========================================================================
   3. Hero Banner & Controls
   ========================================================================== */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 25px 15px;
}

.hero-section {
  background: var(--hero-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 20px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px var(--shadow-color);
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 25px auto;
  font-size: 1rem;
}

.search-form {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 12px 26px;
  border-radius: 30px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.search-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Category Pills Horizontal Slider */
.category-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 30px;
  scrollbar-width: thin;
}

.pill-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pill-item:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ==========================================================================
   4. Grid & Game Card Layouts
   ========================================================================== */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 25px;
}

@media (max-width: 992px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
}

.section-block {
  margin-bottom: 35px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 10px 25px var(--accent-glow);
}

.game-thumb {
  width: 100%;
  aspect-ratio: 3/3;
  object-fit: cover;
  background: var(--bg-secondary);
  display: block;
}

.game-info {
  padding: 12px;
}

.game-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-mobile {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: bold;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   5. Footer Styling
   ========================================================================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 20px 20px;
  margin-top: 50px;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 10px;
}

.footer-links a:hover {
  color: var(--accent);
}