/* ============================================================
   GameNova Frontend — components.css
   Game Cards, Buttons, Badges, Modals,
   Pagination, Skeleton, Filters, Share
   ============================================================ */

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             0.5rem;
  padding:         0.6rem 1.4rem;
  border-radius:   var(--border-radius-full);
  font-family:     var(--font-body);
  font-size:       var(--font-size-sm);
  font-weight:     600;
  line-height:     1;
  border:          1px solid transparent;
  cursor:          pointer;
  text-decoration: none;
  transition:      all var(--transition-fast);
  white-space:     nowrap;
  -webkit-user-select: none;
  user-select:     none;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary — Purple */
.btn-primary {
  background:  var(--neon-purple);
  border-color: var(--neon-purple);
  color:       #fff;
  box-shadow:  0 0 0 0 var(--neon-purple-glow);
  transition:  all var(--transition-fast),
               box-shadow var(--transition-base);
}
.btn-primary:hover {
  background:  var(--neon-purple-bright);
  box-shadow:  var(--glow-purple);
  color:       #fff;
}

/* Accent — Cyan */
.btn-accent {
  background:  transparent;
  border-color: var(--neon-cyan);
  color:        var(--neon-cyan);
}
.btn-accent:hover {
  background:  var(--neon-cyan-soft);
  box-shadow:  var(--glow-cyan);
  color:       var(--neon-cyan);
}

/* Ghost */
.btn-ghost {
  background:  var(--bg-glass);
  border-color: var(--border-color);
  color:        var(--text-secondary);
}
.btn-ghost:hover {
  border-color: var(--border-hover);
  color:        var(--text-white);
  background:   var(--bg-input);
}

/* Danger */
.btn-danger {
  background:  var(--neon-pink);
  border-color: var(--neon-pink);
  color:       #fff;
}
.btn-danger:hover {
  box-shadow:  var(--glow-pink);
}

/* Sizes */
.btn-sm {
  padding:   0.4rem 0.9rem;
  font-size: var(--font-size-xs);
}
.btn-lg {
  padding:   0.8rem 2rem;
  font-size: var(--font-size-md);
}
.btn-icon {
  width:   38px;
  height:  38px;
  padding: 0;
  flex-shrink: 0;
}
.btn-icon.btn-sm {
  width:  30px;
  height: 30px;
}

/* Play CTA — special large button for hero */
.btn-play {
  padding:        0.75rem 2rem;
  background:     var(--neon-purple);
  border:         1px solid var(--neon-purple-bright);
  border-radius:  var(--border-radius-full);
  color:          #fff;
  font-family:    var(--font-display);
  font-size:      1.1rem;
  font-weight:    700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor:         pointer;
  transition:     all var(--transition-base);
  box-shadow:     var(--glow-purple);
  display:        inline-flex;
  align-items:    center;
  gap:            0.5rem;
}
.btn-play:hover {
  background:  var(--neon-purple-bright);
  box-shadow:  0 0 32px var(--neon-purple-glow), 0 0 60px rgba(124, 58, 237, 0.2);
  transform:   translateY(-1px);
  color:       #fff;
}

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display:         inline-flex;
  align-items:     center;
  gap:             0.3rem;
  padding:         0.2rem 0.6rem;
  border-radius:   var(--border-radius-full);
  font-size:       var(--font-size-xs);
  font-weight:     600;
  letter-spacing:  0.04em;
  text-transform:  uppercase;
  white-space:     nowrap;
  line-height:     1;
}

.badge-featured {
  background:  #ff2d78;
  color:       #ffffff;
  border:      none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.badge-new {
  background:  #00b894;
  color:       #ffffff;
  border:      none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.badge-trending {
  background:  #f39c12;
  color:       #ffffff;
  border:      none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.badge-category {
  background:  var(--neon-cyan-soft);
  color:       var(--neon-cyan);
  border:      1px solid rgba(0, 229, 255, 0.2);
}

.badge-plays {
  background:  var(--bg-glass);
  color:       var(--text-secondary);
  border:      1px solid var(--border-color);
}

/* ══════════════════════════════════════════
   GAME CARDS
══════════════════════════════════════════ */
.games-grid {
  width:    100%;
  display:  grid;
  gap:      clamp(0.75rem, 1.2vw, 1.25rem);
}

/* Breakpoint columns — no max-width, fully fluid */
/* Mobile default */
.games-grid { grid-template-columns: repeat(2, 1fr); }

/* sm: 480px → 2 cols (same, already default) */
@media (min-width: 480px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
}

/* md: 768px → 3 cols */
@media (min-width: 768px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); }
}

/* lg: 1024px → 4 cols */
@media (min-width: 1024px) {
  .games-grid { grid-template-columns: repeat(4, 1fr); }
}

/* xl: 1280px → 5 cols */
@media (min-width: 1280px) {
  .games-grid { grid-template-columns: repeat(5, 1fr); }
}

/* 2xl: 1600px → 6 cols */
@media (min-width: 1600px) {
  .games-grid { grid-template-columns: repeat(6, 1fr); }
}

/* 4K: 2560px → 8 cols */
@media (min-width: 2560px) {
  .games-grid { grid-template-columns: repeat(8, 1fr); }
}

/* 5K+: 3840px → 10 cols */
@media (min-width: 3840px) {
  .games-grid { grid-template-columns: repeat(10, 1fr); }
}

/* ── Game Card ── */
.game-card {
  position:         relative;
  background:       var(--bg-card);
  border:           1px solid var(--bg-card-border);
  border-radius:    var(--border-radius-lg);
  overflow:         hidden;
  cursor:           pointer;
  transition:       transform var(--transition-base),
                    border-color var(--transition-base),
                    box-shadow var(--transition-base);
  text-decoration:  none;
  display:          block;
}

.game-card:hover {
  transform:    translateY(-4px);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow:   var(--glow-card-hover);
}

.game-card:active {
  transform: translateY(-2px);
}

/* Thumbnail */
.game-card-thumb {
  position:    relative;
  width:       100%;
  padding-top: 60%;  /* 5:3 ratio */
  overflow:    hidden;
  background:  var(--bg-secondary);
}

.game-card-thumb img {
  position:   absolute;
  inset:      0;
  width:      100%;
  height:     100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.game-card:hover .game-card-thumb img {
  transform: scale(1.06);
}

/* Play overlay on hover */
.game-card-play-overlay {
  position:        absolute;
  inset:           0;
  background:      rgba(7, 7, 15, 0.55);
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  transition:      opacity var(--transition-base);
}

.game-card:hover .game-card-play-overlay {
  opacity: 1;
}

.play-btn-circle {
  width:         54px;
  height:        54px;
  border-radius: 50%;
  background:    var(--neon-purple);
  border:        2px solid rgba(255, 255, 255, 0.3);
  display:       flex;
  align-items:   center;
  justify-content: center;
  box-shadow:    var(--glow-purple);
  font-size:     1.3rem;
  color:         #fff;
  transition:    transform var(--transition-bounce);
}

.game-card:hover .play-btn-circle {
  transform: scale(1.1);
}

/* Badge overlay on thumbnail */
.game-card-badge {
  position: absolute;
  top:      0.5rem;
  left:     0.5rem;
  z-index:  2;
}

/* Info */
.game-card-info {
  padding: 0.7rem 0.85rem 0.85rem;
}

.game-card-title {
  font-family:    var(--font-display);
  font-size:      var(--font-size-md);
  font-weight:    700;
  color:          var(--text-white);
  line-height:    1.25;
  margin-bottom:  0.35rem;
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
  letter-spacing: 0.01em;
}

.game-card-meta {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  gap:         0.5rem;
}

.game-card-cat {
  font-size:   var(--font-size-xs);
  color:       var(--text-muted);
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}

.game-card-plays {
  display:     flex;
  align-items: center;
  gap:         0.25rem;
  font-size:   var(--font-size-xs);
  color:       var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.game-card-plays .plays-dot {
  width:         6px;
  height:        6px;
  border-radius: 50%;
  background:    var(--neon-green);
  box-shadow:    0 0 4px var(--neon-green);
}

/* ── Horizontal scroll row (Related games on mobile) ── */
.games-row {
  display:     flex;
  gap:         clamp(0.6rem, 1vw, 1rem);
  overflow-x:  auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}
.games-row::-webkit-scrollbar { display: none; }

.games-row .game-card {
  flex:      0 0 clamp(140px, 18vw, 220px);
  min-width: 0;
}

/* ══════════════════════════════════════════
   SKELETON LOADING
══════════════════════════════════════════ */
@keyframes skeleton-pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.4; }
  100% { opacity: 1; }
}

.skeleton {
  animation:    skeleton-pulse 1.6s ease infinite;
  background:   linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  border-radius:   var(--border-radius);
}

@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton-shimmer {
  animation:    skeleton-shimmer 1.6s linear infinite;
  background:   linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  border-radius:   var(--border-radius);
}

/* Card skeleton */
.game-card-skeleton {
  background:    var(--bg-card);
  border:        1px solid var(--bg-card-border);
  border-radius: var(--border-radius-lg);
  overflow:      hidden;
}

.skeleton-thumb {
  width:   100%;
  padding-top: 60%;
  background: var(--bg-secondary);
}

.skeleton-line {
  height:        14px;
  border-radius: var(--border-radius-sm);
  background:    var(--bg-secondary);
}

.skeleton-info {
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ══════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════ */
.pagination {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             0.35rem;
  padding:         2rem 0;
  flex-wrap:       wrap;
}

.page-link {
  min-width:       38px;
  height:          38px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   var(--border-radius);
  border:          1px solid var(--border-color);
  background:      var(--bg-card);
  color:           var(--text-secondary);
  font-size:       var(--font-size-sm);
  font-weight:     500;
  cursor:          pointer;
  transition:      all var(--transition-fast);
  text-decoration: none;
  padding:         0 0.6rem;
}

.page-link:hover {
  border-color: var(--neon-purple);
  color:        var(--neon-purple-bright);
  background:   var(--neon-purple-soft);
}

.page-link.active {
  background:   var(--neon-purple);
  border-color: var(--neon-purple);
  color:        #fff;
  box-shadow:   var(--glow-purple);
  font-weight:  700;
}

.page-link.disabled {
  opacity:        0.35;
  pointer-events: none;
}

/* ══════════════════════════════════════════
   SEARCH BAR (search.php full page)
══════════════════════════════════════════ */
.search-hero {
  padding:    2rem var(--page-pad) 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.search-hero-form {
  position:  relative;
  width:     100%;
}

.search-hero-input {
  width:         100%;
  height:        54px;
  padding:       0 1.25rem 0 3.5rem;
  background:    var(--bg-input);
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  color:         var(--text-primary);
  font-size:     var(--font-size-md);
  outline:       none;
  transition:    border-color var(--transition-fast),
                 box-shadow var(--transition-fast);
}

.search-hero-input::placeholder {
  color: var(--text-muted);
}

.search-hero-input:focus {
  border-color: var(--neon-purple);
  box-shadow:   0 0 0 4px var(--neon-purple-soft);
}

.search-hero-icon {
  position:  absolute;
  left:      1.2rem;
  top:       50%;
  transform: translateY(-50%);
  color:     var(--text-muted);
  font-size: 1.25rem;
}

.search-results-count {
  margin-top: 1rem;
  font-size:  var(--font-size-sm);
  color:      var(--text-muted);
}

.search-results-count strong {
  color: var(--text-white);
}

/* ══════════════════════════════════════════
   FILTER BAR (All Games / Category Sort)
══════════════════════════════════════════ */
.filter-bar {
  display:       flex;
  align-items:   center;
  gap:           0.75rem;
  padding:       1rem var(--page-pad);
  background:    var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap:     wrap;
}

.filter-label {
  font-size:  var(--font-size-sm);
  color:      var(--text-muted);
  white-space: nowrap;
}

.filter-select {
  height:          38px;
  padding:         0 2rem 0 0.85rem;
  background:      #111122;
  border:          1px solid var(--border-color);
  border-radius:   var(--border-radius);
  color:           #f0f0ff;
  font-size:       var(--font-size-sm);
  cursor:          pointer;
  outline:         none;
  appearance:      none;
  -webkit-appearance: none;
  color-scheme:    dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%235a5a7a' d='M8 10L3 5h10z'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 0.6rem center;
  background-size:     14px;
  transition:      border-color var(--transition-fast);
}

.filter-select option {
  background: #111122;
  color:      #f0f0ff;
}

.filter-select option:checked {
  background: #7c3aed;
  color:      #ffffff;
}

.filter-select:focus {
  border-color: var(--neon-purple);
}

.active-filter-tag {
  display:       inline-flex;
  align-items:   center;
  gap:           0.35rem;
  padding:       0.3rem 0.7rem;
  background:    var(--neon-purple-soft);
  border:        1px solid rgba(124, 58, 237, 0.35);
  border-radius: var(--border-radius-full);
  font-size:     var(--font-size-xs);
  color:         var(--neon-purple-bright);
}

.active-filter-tag .remove-tag {
  cursor:    pointer;
  opacity:   0.7;
  font-size: 0.9em;
  transition: opacity var(--transition-fast);
}
.active-filter-tag .remove-tag:hover { opacity: 1; }

/* ══════════════════════════════════════════
   SHARE BUTTONS
══════════════════════════════════════════ */
.share-group {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  flex-wrap:   wrap;
}

.share-label {
  font-size: var(--font-size-sm);
  color:     var(--text-muted);
}

.btn-share {
  display:     flex;
  align-items: center;
  gap:         0.4rem;
  padding:     0.4rem 0.9rem;
  border:      1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  background:  var(--bg-glass);
  color:       var(--text-secondary);
  font-size:   var(--font-size-xs);
  font-weight: 500;
  cursor:      pointer;
  transition:  all var(--transition-fast);
}

.btn-share:hover {
  border-color: var(--border-hover);
  color:        var(--text-white);
}

.btn-share.whatsapp:hover {
  border-color: #25d366;
  color:        #25d366;
  background:   rgba(37, 211, 102, 0.08);
}

.btn-share.copy-link.copied {
  border-color: var(--neon-green);
  color:        var(--neon-green);
  background:   var(--neon-green-soft);
}

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
  width:           100%;
  padding:         4rem 2rem;
  text-align:      center;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             1rem;
}

.empty-state-icon {
  font-size:   4rem;
  line-height: 1;
  filter:      grayscale(0.4) opacity(0.6);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size:   var(--font-size-2xl);
  color:       var(--text-primary);
}

.empty-state-sub {
  font-size:  var(--font-size-sm);
  color:      var(--text-muted);
  max-width:  360px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
.toast-container {
  position:       fixed;
  bottom:         1.5rem;
  right:          1.5rem;
  z-index:        var(--z-toast);
  display:        flex;
  flex-direction: column;
  gap:            0.6rem;
  align-items:    flex-end;
}

.toast {
  display:       flex;
  align-items:   center;
  gap:           0.65rem;
  padding:       0.75rem 1.25rem;
  background:    var(--bg-card);
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow:    var(--shadow-lg);
  font-size:     var(--font-size-sm);
  color:         var(--text-primary);
  min-width:     240px;
  animation:     toast-in 0.3s var(--transition-base) forwards;
}

.toast.success { border-left: 3px solid var(--neon-green); }
.toast.error   { border-left: 3px solid var(--neon-pink);  }
.toast.info    { border-left: 3px solid var(--neon-cyan);  }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

.toast.removing {
  animation: toast-out 0.3s ease forwards;
}

/* ══════════════════════════════════════════
   AD BANNER SLOTS
══════════════════════════════════════════ */
.ad-slot {
  width:           100%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         0.75rem 0;
  background:      var(--bg-secondary);
  border-radius:   var(--border-radius);
  border:          1px dashed var(--border-color);
  color:           var(--text-muted);
  font-size:       var(--font-size-xs);
  min-height:      90px;
  overflow:        hidden;
}

/* ══════════════════════════════════════════
   LAZY LOAD IMAGE
══════════════════════════════════════════ */
.lazy-img {
  opacity:    0;
  transition: opacity 0.4s ease;
}

.lazy-img.loaded {
  opacity: 1;
}

/* ══════════════════════════════════════════
   FULLSCREEN BUTTON (Game embed)
══════════════════════════════════════════ */
.btn-fullscreen {
  display:         flex;
  align-items:     center;
  gap:             0.4rem;
  padding:         0.4rem 0.85rem;
  background:      var(--bg-glass);
  border:          1px solid var(--border-color);
  border-radius:   var(--border-radius);
  color:           var(--text-secondary);
  font-size:       var(--font-size-sm);
  cursor:          pointer;
  transition:      all var(--transition-fast);
}
.btn-fullscreen:hover {
  border-color: var(--neon-purple);
  color:        var(--neon-purple-bright);
}

/* ══════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width:         40px;
  height:        40px;
  border:        3px solid var(--border-color);
  border-top:    3px solid var(--neon-purple);
  border-radius: 50%;
  animation:     spin 0.8s linear infinite;
}

.spinner-sm {
  width:       20px;
  height:      20px;
  border-width: 2px;
}

/* ══════════════════════════════════════════
   RELATED GAMES SECTION
══════════════════════════════════════════ */
.related-games-section {
  padding:       2rem var(--page-pad);
  border-top:    1px solid var(--border-color);
  background:    var(--bg-secondary);
}

/* ══════════════════════════════════════════
   MASONRY GRID — All Games section
   Uses CSS columns for natural card flow
   with varying thumbnail heights
══════════════════════════════════════════ */
.masonry-grid {
  display:      block;           /* override CSS grid */
  columns:      4;
  column-gap:   clamp(0.75rem, 1.2vw, 1.25rem);
}

.masonry-grid .game-card {
  display:        inline-block;  /* required for column flow */
  width:          100%;
  break-inside:   avoid;
  margin-bottom:  clamp(0.75rem, 1.2vw, 1.25rem);
}

/* ── Varying thumbnail heights for masonry effect ── */
/* Default: 60% (5:3 ratio) — inherited from .game-card-thumb */

.masonry-grid .game-card:nth-child(5n+1) .game-card-thumb {
  padding-top: 85%;   /* tall portrait */
}
.masonry-grid .game-card:nth-child(7n+2) .game-card-thumb {
  padding-top: 100%;  /* square */
}
.masonry-grid .game-card:nth-child(5n+4) .game-card-thumb {
  padding-top: 75%;   /* medium-tall */
}
.masonry-grid .game-card:nth-child(9n+6) .game-card-thumb {
  padding-top: 110%;  /* extra tall */
}

/* ── Responsive columns ── */
@media (max-width: 1200px) {
  .masonry-grid { columns: 3; }
}
@media (max-width: 640px) {
  .masonry-grid { columns: 2; }
}