/* ========================================
   Nebula Theme — Bootstrap 5 Dark Cosmic Theme
   Purple-to-pink gradients, glass-morphism cards
   ======================================== */

:root {
  --nebula-bg: #0b0d17;
  --nebula-card: rgba(20, 22, 40, 0.85);
  --nebula-card-solid: #141628;
  --nebula-border: rgba(139, 92, 246, 0.15);
  --nebula-primary: #8b5cf6;
  --nebula-primary-dark: #7c3aed;
  --nebula-pink: #ec4899;
  --nebula-text: #e2e8f0;
  --nebula-muted: #94a3b8;
  color-scheme: dark;
}

body {
  background: var(--nebula-bg);
  color: var(--nebula-text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   Starfield Canvas Background
   ======================================== */
.nebula-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ========================================
   Navigation
   ======================================== */
.nebula-nav {
  background: rgba(11, 13, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nebula-border);
  z-index: 1030;
}

.nebula-nav .nav-link {
  color: var(--nebula-muted) !important;
  font-weight: 500;
  transition: color 0.2s;
}

.nebula-nav .nav-link:hover {
  color: var(--nebula-primary) !important;
}

.nebula-nav-spacer {
  height: 72px;
}

.site-logo {
  max-height: 38px;
}

.nebula-search .input-group {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  overflow: hidden;
}

.nebula-search .form-control:focus {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* ========================================
   Buttons
   ======================================== */
.btn-nebula {
  background: linear-gradient(135deg, var(--nebula-primary), var(--nebula-pink));
  color: #fff;
  border: none;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-nebula:hover {
  background: linear-gradient(135deg, var(--nebula-primary-dark), var(--nebula-primary));
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  color: #fff;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 50% !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: none;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* ========================================
   Cards
   ======================================== */
.nebula-card {
  background: var(--nebula-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--nebula-border);
  border-radius: 16px;
  overflow: hidden;
}

/* ========================================
   Game Grid Cards
   ======================================== */
.nebula-game-card {
  text-decoration: none;
  color: var(--nebula-text);
  display: block;
  transition: transform 0.3s, box-shadow 0.3s;
}

.nebula-game-card:hover {
  transform: translateY(-4px);
  color: var(--nebula-text);
}

.nebula-game-card .card-img-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--nebula-card-solid);
  aspect-ratio: 1;
}

.nebula-game-card .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.nebula-game-card:hover .card-img-wrap img {
  transform: scale(1.08);
}

.nebula-game-card .card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(139, 92, 246, 0.7), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nebula-game-card:hover .card-overlay {
  opacity: 1;
}

.play-icon {
  font-size: 2rem;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.card-title {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 4px 0;
  color: var(--nebula-muted);
}

/* ========================================
   Trending Scroll Cards
   ======================================== */
.nebula-trend-card {
  width: 180px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--nebula-text);
  transition: transform 0.3s;
}

.nebula-trend-card:hover {
  transform: translateY(-4px);
  color: var(--nebula-text);
}

.trend-img-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 3/4;
}

.trend-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trend-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,13,23,0.9), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.nebula-trend-card:hover .trend-overlay {
  opacity: 1;
}

.trend-play {
  font-size: 2rem;
  color: #fff;
}

.trend-info {
  padding: 8px 4px;
}

.trend-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-rating {
  font-size: 0.75rem;
  color: #fbbf24;
}

.nebula-scroll-row .d-flex::-webkit-scrollbar {
  height: 4px;
}

.nebula-scroll-row .d-flex::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.3);
  border-radius: 2px;
}

/* ========================================
   Category Pills
   ======================================== */
.nebula-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--nebula-card);
  border: 1px solid var(--nebula-border);
  border-radius: 50px;
  text-decoration: none;
  color: var(--nebula-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nebula-cat-pill:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
  color: var(--nebula-text);
}

.cat-emoji {
  font-size: 1.1rem;
}

/* ========================================
   Section Title
   ======================================== */
.section-title {
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--nebula-border);
}

.section-title span {
  color: var(--nebula-primary);
}

/* ========================================
   Tags & Badges
   ======================================== */
.nebula-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 50px;
  color: #c4b5fd;
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.nebula-tag:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
}

.nebula-tag-secondary {
  display: inline-block;
  padding: 4px 12px;
  background: var(--nebula-card-solid);
  border-radius: 50px;
  color: var(--nebula-muted);
  text-decoration: none;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.nebula-tag-secondary:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.nebula-badge {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  font-size: 0.85rem;
}

/* ========================================
   Footer
   ======================================== */
.nebula-footer {
  background: rgba(11, 13, 23, 0.95);
  border-top: 1px solid var(--nebula-border);
  position: relative;
  z-index: 1;
}

/* ========================================
   Pagination
   ======================================== */
.nebula-pagination .page-link {
  background: var(--nebula-card);
  border: 1px solid var(--nebula-border);
  color: var(--nebula-muted);
  border-radius: 8px !important;
  margin: 0 3px;
  transition: all 0.2s;
}

.nebula-pagination .page-link:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #fff;
}

.nebula-pagination .active .page-link {
  background: linear-gradient(135deg, var(--nebula-primary), var(--nebula-pink));
  border-color: transparent;
  color: #fff;
}

/* ========================================
   Dropdown
   ======================================== */
.nebula-dropdown {
  background: var(--nebula-card-solid);
  border: 1px solid var(--nebula-border);
  border-radius: 12px;
  padding: 4px;
}

.nebula-dropdown .dropdown-item {
  color: var(--nebula-text);
  border-radius: 8px;
  font-size: 0.9rem;
}

.nebula-dropdown .dropdown-item:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #fff;
}

.xp-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  background: rgba(139, 92, 246, 0.3);
  border-radius: 50px;
  font-size: 0.7rem;
  color: #c4b5fd;
}

.avatar-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
}

/* ========================================
   Widget Styles
   ======================================== */
.widget-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--nebula-border);
}

.category-item {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-item a {
  text-decoration: none;
}

.category-item li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--nebula-muted);
  font-size: 0.85rem;
  transition: all 0.2s;
}

.category-item li:hover {
  background: rgba(139, 92, 246, 0.1);
  color: #fff;
}

.icon-category {
  font-size: 1.2rem;
}

.cat-count {
  margin-left: auto;
  background: rgba(255,255,255,0.05);
  padding: 1px 8px;
  border-radius: 50px;
  font-size: 0.7rem;
}

/* ========================================
   Game Player
   ======================================== */
.game-player-card {
  padding: 0;
  overflow: hidden;
}

.game-iframe {
  border: none;
  width: 100%;
  height: 100%;
}

/* ========================================
   Load More Button
   ======================================== */
.btn-load-more-games {
  margin-top: 1rem;
}

/* ========================================
   Vertical Widget Items
   ======================================== */
.nebula-v-item {
  display: block;
  padding: 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--nebula-text);
  transition: background 0.2s;
  margin-bottom: 4px;
}

.nebula-v-item:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--nebula-text);
}

.v-thumb {
  width: 56px; height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.v-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v-meta {
  font-size: 0.7rem;
  color: var(--nebula-muted);
}

/* ========================================
   Utilities
   ======================================== */
.text-purple { color: var(--nebula-primary) !important; }

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .nebula-nav-spacer { height: 60px; }
  .nebula-card { border-radius: 10px; }
  .section-title { font-size: 1.1rem; }
  .game-iframe-container { min-height: 220px; }
}

/* ========================================
   Ad Support
   ======================================== */
#top-content {
  position: relative; z-index: 1;
  padding: 10px 0;
}

#bottom-content {
  position: relative; z-index: 1;
  padding: 10px 0;
}

/* Anchor ad z-index above Bootstrap nav (1030) */
[id*="anchor-ad"],
[class*="anchor-ad"] {
  z-index: 1040 !important;
}
