/* ============================================================
   GamesHub - Premium Arcade Theme CSS
   Complete mobile-first responsive design
   ============================================================ */

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

:root {
  --cg-bg: #0A0A0F;
  --cg-surface: #181922;
  --cg-surface-hover: #1e2030;
  --cg-primary: #9b51e0;
  --cg-primary-hover: #b478f1;
  --cg-primary-glow: rgba(155, 81, 224, 0.15);
  --cg-text: #ffffff;
  --cg-text-muted: #a0a0B0;
  --cg-border: #232533;
  --cg-success: #00e88f;
  --cg-danger: #ff4466;
  --cg-warning: #ffaa00;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --bottom-nav-height: 0px;
  --cg-radius: 14px;
  --cg-radius-sm: 10px;
}

body.light-mode {
  --cg-bg: #f0f2f5;
  --cg-surface: #ffffff;
  --cg-surface-hover: #f7f8fa;
  --cg-primary: #8b3fd4;
  --cg-primary-hover: #a35ce6;
  --cg-primary-glow: rgba(139, 63, 212, 0.1);
  --cg-text: #1a1a2e;
  --cg-text-muted: #6b6f85;
  --cg-border: #e2e4ea;
  --cg-success: #00c974;
  --cg-danger: #e63950;
  --cg-warning: #e69500;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: var(--cg-bg) !important;
  color: var(--cg-text) !important;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--cg-text);
  text-decoration: none;
  transition: 0.2s color;
}
a:hover {
  color: var(--cg-primary);
}

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

/* ============================================================
   Base Layout
   ============================================================ */
.cg-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar (Desktop only, hidden on mobile)
   ============================================================ */
.cg-sidebar {
  width: var(--sidebar-width);
  background-color: var(--cg-bg);
  border-right: 1px solid var(--cg-border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: 0.3s transform ease-in-out;
}
.cg-sidebar::-webkit-scrollbar { width: 5px; }
.cg-sidebar::-webkit-scrollbar-track { background: transparent; }
.cg-sidebar::-webkit-scrollbar-thumb { background: var(--cg-border); border-radius: 4px; }

.cg-logo-area {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--cg-border);
  flex-shrink: 0;
}
.cg-logo-area img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.cg-nav-list {
  list-style: none;
  padding: 10px 12px;
  margin: 0 0 10px 0;
}
.cg-nav-list li {
  margin-bottom: 3px;
}
.cg-nav-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--cg-radius-sm);
  color: var(--cg-text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s all;
}
.cg-nav-list a:hover, .cg-nav-list a.active {
  background-color: var(--cg-primary-glow);
  color: var(--cg-primary);
}
.cg-nav-list a i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}
.cg-nav-title {
  padding: 15px 26px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--cg-text-muted);
  margin: 0;
  font-weight: 700;
}

/* Sidebar overlay for mobile */
.cg-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.6);
  z-index: 999;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cg-sidebar-overlay.active {
  display: block;
}

/* ============================================================
   Content Wrapper
   ============================================================ */
.cg-content-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   Topbar
   ============================================================ */
.cg-topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  background-color: var(--cg-bg);
  position: sticky;
  top: 0;
  z-index: 900;
  border-bottom: 1px solid var(--cg-border);
}

/* Mobile menu button - hidden on desktop */
.cg-mobile-menu-btn {
  display: none !important;
}

.cg-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}
.cg-search input {
  width: 100%;
  background-color: var(--cg-surface);
  border: 1px solid var(--cg-border);
  color: var(--cg-text);
  padding: 10px 18px 10px 42px;
  border-radius: 40px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: 0.2s border-color, 0.2s box-shadow;
}
.cg-search input::placeholder {
  color: var(--cg-text-muted);
}
.cg-search input:focus {
  border-color: var(--cg-primary);
  box-shadow: 0 0 0 3px var(--cg-primary-glow);
}
.cg-search button {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--cg-text-muted);
  z-index: 10;
  font-size: 15px;
}
.cg-search button:hover {
  color: var(--cg-primary);
}

.cg-user-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.cg-btn {
  background-color: var(--cg-surface);
  color: var(--cg-text);
  border: 1px solid var(--cg-border);
  padding: 9px 18px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s all;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.cg-btn:hover {
  background-color: var(--cg-surface-hover);
  border-color: var(--cg-primary);
  color: var(--cg-text);
}
.cg-btn-primary {
  background: linear-gradient(135deg, var(--cg-primary), var(--cg-primary-hover));
  border-color: var(--cg-primary);
  color: white;
  box-shadow: 0 4px 15px var(--cg-primary-glow);
}
.cg-btn-primary:hover {
  background: linear-gradient(135deg, var(--cg-primary-hover), var(--cg-primary));
  border-color: var(--cg-primary-hover);
  color: white;
  box-shadow: 0 6px 20px var(--cg-primary-glow);
  transform: translateY(-1px);
}

/* ============================================================
   Main Content
   ============================================================ */
.cg-main {
  padding: 24px;
  padding-bottom: calc(24px + var(--bottom-nav-height));
  flex: 1;
}

/* ============================================================
   Hero Section
   ============================================================ */
.cg-hero {
  background: linear-gradient(135deg, #2b1055 0%, #5b3a8c 50%, #7597de 100%);
  border-radius: var(--cg-radius);
  padding: 40px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 220px;
  margin-bottom: 32px;
}
.cg-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(155,81,224,0.3), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.cg-hero-content {
  position: relative;
  z-index: 2;
  max-width: 55%;
}
.cg-hero-title {
  font-size: 36px;
  font-weight: 800;
  margin: 0 0 10px 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  line-height: 1.15;
}
.cg-hero-desc {
  font-size: 15px;
  color: #d0d5e0;
  margin-bottom: 22px;
  line-height: 1.6;
}
.cg-badge {
  background-color: rgba(0,0,0,0.4);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cg-warning);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
}

/* ============================================================
   Section Titles
   ============================================================ */
.cg-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 18px;
}

/* ============================================================
   Game Grid & Cards
   ============================================================ */
.cg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.cg-game-card {
  background-color: var(--cg-surface);
  border-radius: var(--cg-radius);
  overflow: hidden;
  transition: 0.3s transform, 0.3s box-shadow;
  position: relative;
  border: 1px solid var(--cg-border);
}
.cg-game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  border-color: var(--cg-primary);
}
.cg-game-img {
  width: 100%;
  aspect-ratio: 1/1;
  background-size: cover;
  background-position: center;
  position: relative;
}
.cg-game-img::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 60%;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  pointer-events: none;
}
.cg-game-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  z-index: 2;
}
.cg-game-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.cg-game-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #bbb;
}
.cg-game-meta i {
  color: var(--cg-warning);
}

/* ============================================================
   Footer
   ============================================================ */
.cg-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--cg-border);
  display: flex;
  gap: 12px;
  text-align: center;
  flex-direction: column;
  color: var(--cg-text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.cg-footer a {
  color: var(--cg-text-muted);
  transition: 0.2s color;
}
.cg-footer a:hover {
  color: var(--cg-primary);
}

/* ============================================================
   Game Page - Player & Details
   ============================================================ */
.cg-player-wrapper {
  background-color: #000;
  border-radius: var(--cg-radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  margin-bottom: 24px;
  position: relative;
  border: 1px solid var(--cg-border);
}
.cg-player-wrapper iframe {
  width: 100%;
  border: none;
  display: block;
}

.cg-game-details-box {
  background-color: var(--cg-surface);
  border-radius: var(--cg-radius);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--cg-border);
  display: flex;
  gap: 20px;
}
.cg-game-details-icon {
  width: 100px;
  height: 100px;
  border-radius: var(--cg-radius);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.cg-game-details-info {
  flex: 1;
  min-width: 0;
}
.cg-game-details-title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px 0;
  line-height: 1.2;
  word-wrap: break-word;
}

/* ============================================================
   Forms
   ============================================================ */
.cg-form-control {
  width: 100%;
  background-color: var(--cg-bg);
  border: 1px solid var(--cg-border);
  color: var(--cg-text);
  padding: 12px 16px;
  border-radius: var(--cg-radius-sm);
  margin-bottom: 12px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: 0.2s border-color, 0.2s box-shadow;
  -webkit-appearance: none;
  appearance: none;
}
.cg-form-control::placeholder {
  color: var(--cg-text-muted);
}
.cg-form-control:focus {
  border-color: var(--cg-primary);
  box-shadow: 0 0 0 3px var(--cg-primary-glow);
}
textarea.cg-form-control {
  resize: vertical;
  min-height: 100px;
}
select.cg-form-control {
  cursor: pointer;
}

/* ============================================================
   Reviews
   ============================================================ */
.cg-review-card {
  background-color: var(--cg-surface);
  border-radius: var(--cg-radius-sm);
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--cg-border);
}
.cg-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================
   Auth Box (Login/Register)
   ============================================================ */
.cg-auth-box {
  background-color: var(--cg-surface);
  padding: 32px;
  border-radius: var(--cg-radius);
  max-width: 440px;
  margin: 30px auto;
  border: 1px solid var(--cg-border);
  width: 100%;
}

/* ============================================================
   Pricing / Cards layout
   ============================================================ */
.cg-flex-container {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.cg-flex-main {
  flex: 1;
  min-width: 0;
}
.cg-flex-sidebar {
  width: 300px;
  flex-shrink: 0;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  padding: 10px 0;
  width: 100%;
}
.page_links {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.page_links a {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Utility
   ============================================================ */
hr {
  border: none;
  border-top: 1px solid var(--cg-border);
  margin: 20px 0;
}

.g-recaptcha {
  margin: 15px 0;
}

.adz {
  margin: 15px 0;
  max-width: 100%;
  border: 1px solid var(--cg-border);
  border-radius: var(--cg-radius-sm);
  overflow: hidden;
}
.adz img {
  max-width: 100%;
  display: block;
}

/* Tables responsive */
table {
  border-collapse: collapse;
}
table th, table td {
  color: var(--cg-text);
}

/* ============================================================
   Mobile Bottom Navigation Bar
   ============================================================ */
.cg-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--cg-surface);
  border-top: 1px solid var(--cg-border);
  z-index: 1001;
  padding: 0;
  align-items: stretch;
  justify-content: space-around;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.cg-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--cg-text-muted);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  flex: 1;
  transition: 0.2s color;
  -webkit-tap-highlight-color: transparent;
  padding: 6px 0;
}
.cg-bottom-nav a i {
  font-size: 20px;
  transition: 0.2s all;
}
.cg-bottom-nav a.active,
.cg-bottom-nav a:hover {
  color: var(--cg-primary);
}
.cg-bottom-nav a.active i {
  transform: scale(1.1);
}

/* ============================================================
   RESPONSIVE: Tablet (max-width 900px)
   ============================================================ */
@media (max-width: 900px) {
  :root {
    --bottom-nav-height: 60px;
  }

  .cg-sidebar {
    transform: translateX(-100%);
  }
  .cg-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 5px 0 25px rgba(0,0,0,0.5);
  }
  .cg-content-wrapper {
    margin-left: 0;
  }
  .cg-topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .cg-mobile-menu-btn {
    display: inline-flex !important;
    padding: 8px 12px !important;
    flex-shrink: 0;
  }
  .cg-main {
    padding: 16px;
    padding-bottom: calc(16px + var(--bottom-nav-height));
  }

  /* Bottom nav visible on mobile */
  .cg-bottom-nav {
    display: flex;
  }

  /* Hero */
  .cg-hero {
    padding: 24px;
    flex-direction: column;
    text-align: center;
    border-radius: var(--cg-radius-sm);
    min-height: auto;
  }
  .cg-hero::before {
    width: 250px;
    height: 250px;
    top: -30%;
    right: -10%;
  }
  .cg-hero-content {
    max-width: 100%;
  }
  .cg-hero-title {
    font-size: 24px;
  }
  .cg-hero-desc {
    font-size: 14px;
  }

  /* Grid */
  .cg-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  /* Game Details */
  .cg-game-details-box {
    flex-direction: column;
    padding: 18px;
    gap: 14px;
  }
  .cg-game-details-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--cg-radius-sm);
  }
  .cg-game-details-title {
    font-size: 22px;
  }

  /* Player */
  .cg-player-wrapper {
    border-radius: var(--cg-radius-sm);
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .cg-player-wrapper iframe {
    min-height: 250px !important;
    aspect-ratio: 16/9;
  }

  /* Auth box */
  .cg-auth-box {
    margin: 16px auto;
    padding: 24px 20px;
  }

  /* User actions - hide text labels */
  .cg-user-actions .cg-btn span {
    display: none;
  }
  .cg-user-actions {
    gap: 6px;
  }
  .cg-user-actions .cg-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Section title */
  .cg-section-title {
    font-size: 18px;
  }

  /* Pricing grid */
  .cg-pricing-grid {
    grid-template-columns: 1fr !important;
  }

  /* Footer */
  .cg-footer {
    padding-bottom: calc(24px + var(--bottom-nav-height));
  }

  /* Review header stack on mobile */
  .cg-review-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* QR code hide on mobile */
  .cg-qr-section {
    display: none !important;
  }

  /* Checkout grid */
  .cg-checkout-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   RESPONSIVE: Small phones (max-width 480px)
   ============================================================ */
@media (max-width: 480px) {
  .cg-main {
    padding: 12px;
    padding-bottom: calc(12px + var(--bottom-nav-height));
  }

  .cg-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .cg-game-info {
    padding: 8px;
  }
  .cg-game-title {
    font-size: 12px;
  }
  .cg-game-meta {
    font-size: 10px;
    gap: 4px;
  }

  .cg-hero {
    padding: 20px 16px;
    margin-bottom: 20px;
  }
  .cg-hero-title {
    font-size: 20px;
  }

  .cg-topbar {
    height: 56px;
  }
  .cg-search input {
    padding: 8px 14px 8px 38px;
    font-size: 13px;
  }

  .cg-game-details-box {
    padding: 14px;
  }
  .cg-game-details-title {
    font-size: 20px;
  }

  .cg-auth-box {
    padding: 20px 16px;
    border-radius: var(--cg-radius-sm);
  }

  .cg-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .cg-section-title {
    font-size: 16px;
  }

  .cg-player-wrapper iframe {
    min-height: 200px !important;
  }
}

/* ============================================================
   Animations & Micro-interactions
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cg-game-card {
  animation: fadeInUp 0.4s ease both;
}
.cg-game-card:nth-child(1) { animation-delay: 0.02s; }
.cg-game-card:nth-child(2) { animation-delay: 0.04s; }
.cg-game-card:nth-child(3) { animation-delay: 0.06s; }
.cg-game-card:nth-child(4) { animation-delay: 0.08s; }
.cg-game-card:nth-child(5) { animation-delay: 0.10s; }
.cg-game-card:nth-child(6) { animation-delay: 0.12s; }

/* Smooth scrollbar for full page */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.cg-btn:focus-visible,
.cg-form-control:focus-visible {
  outline: 2px solid var(--cg-primary);
  outline-offset: 2px;
}

/* Full screen mode for game player */
#myDiv:fullscreen {
  background-color: black;
  width: 100vw;
  height: 100vh;
}
#myDiv:fullscreen iframe {
  height: 100vh;
  aspect-ratio: auto;
}
#myDiv:-webkit-full-screen {
  background-color: black;
  width: 100vw;
  height: 100vh;
}
#myDiv:-webkit-full-screen iframe {
  height: 100vh;
  aspect-ratio: auto;
}


/* Load More Section */
.cg-load-more-section {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    margin: 10px 0 30px;
}
.cg-load-more-section .cg-btn {
    padding: 12px 30px;
    font-size: 15px;
}
.cg-spinner {
    animation: rotate 2s linear infinite;
    z-index: 2;
    width: 20px;
    height: 20px;
    margin-right: 8px;
}
.cg-spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate {
    100% { transform: rotate(360deg); }
}
@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}
