/* ========== GAMES PAGE HERO ========== */
.games-hero {
  padding: calc(var(--header-height) + 3rem) 0 3rem;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.games-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.games-hero-sub {
  color: var(--color-muted);
  font-size: 0.95rem;
  max-width: 540px;
  margin: 0 auto;
}

/* ========== FILTER BAR ========== */
.filter-section {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: var(--header-height);
  z-index: 100;
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

.filter-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  width: 100%;
  box-sizing: border-box;
}

/* ── Top row: search + toggle button ── */
.filter-top-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0; /* critical — prevents flex child from overflowing */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.search-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--color-muted);
  pointer-events: none;
  flex-shrink: 0;
}

#gameSearch {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 0.88rem;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}

#gameSearch::placeholder { color: var(--color-muted); }

#gameSearch:focus {
  border-color: rgba(245, 197, 24, 0.5);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.08);
}

/* ── Filter toggle button (mobile) ── */
.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.58rem 1rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}

.filter-toggle-btn:hover,
.filter-toggle-btn.active {
  border-color: rgba(245, 197, 24, 0.5);
  color: var(--color-gold);
  background: rgba(245, 197, 24, 0.08);
}

.filter-toggle-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
}

.filter-toggle-btn.open svg {
  transform: rotate(180deg);
}

.filter-badge {
  background: var(--color-gold);
  color: #0a0000;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  line-height: 1.4;
  display: none;
}

.filter-badge.visible { display: inline-block; }

/* ── Pills panel ── */
.filter-pills-wrap {
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

/* Mobile: collapsed by default */
@media (max-width: 767px) {
  .filter-pills-wrap {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
  }

  .filter-pills-wrap.open {
    max-height: 350px;
    opacity: 1;
    padding: 0.5rem 0 0.75rem 0;
    margin: 0;
  }
}

/* Desktop: always visible */
@media (min-width: 768px) {
  .filter-toggle-btn { display: none; }

  .filter-pills-wrap {
    max-height: none !important;
    opacity: 1 !important;
    padding: 0 0 0.75rem 0 !important;
    margin: 0 !important;
  }
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.filter-pill {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font-body);
}

.filter-pill:hover {
  border-color: rgba(245, 197, 24, 0.4);
  color: var(--color-gold);
  background: rgba(245, 197, 24, 0.08);
}

.filter-pill.active {
  background: var(--color-gold);
  color: #0a0000;
  border-color: var(--color-gold);
  font-weight: 700;
}

/* ── Active filter label (mobile) ── */
.active-filter-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 0 0 0.5rem 0;
  display: none;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .active-filter-label { display: block; }
  .active-filter-label span { color: var(--color-gold); font-weight: 600; }
}

/* ========== GAMES GRID ========== */
.games-section {
  padding: 2.5rem 0 5rem;
  background: var(--color-bg);
}

.game-card-full {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.game-card-full:hover {
  border-color: rgba(245, 197, 24, 0.4);
  box-shadow: var(--shadow-gold);
  transform: translateY(-4px);
}

.game-card-full .game-card-thumb {
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
}

.game-card-full .game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.game-card-full:hover .game-card-thumb img {
  transform: scale(1.07);
}

.game-card-full .game-card-body {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-card-full .game-card-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-full .game-card-cat {
  font-size: 0.68rem;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.game-card-full .btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  margin-top: auto;
}

/* ── No results ── */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-muted);
}

.no-results svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.3;
  display: block;
}

.no-results p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.hidden { display: none !important; }

/* ========== RESULT COUNT ========== */
.results-count {
  font-size: 0.82rem;
  color: var(--color-muted);
  padding: 0 0 1rem;
  display: block;
}

.results-count strong { color: var(--color-gold); }

/* ========== RESPONSIVE GAMES GRID ========== */

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Small devices: 2 columns */
@media (max-width: 479px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .games-section { padding: 2rem 0 4rem; }
  .game-card-full .game-card-body { padding: 0.75rem; }
}

/* Small: 2-3 columns */
@media (min-width: 480px) and (max-width: 767px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
  .game-card-full .game-card-body { padding: 0.8rem; }
}

/* Tablet: 3 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .game-card-full .game-card-body { padding: 1rem; }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) and (max-width: 1439px) {
  .games-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
}

/* Large desktop: 5 columns */
@media (min-width: 1440px) {
  .games-grid { grid-template-columns: repeat(5, 1fr); gap: 1.5rem; }
}
