/* =========================================================
   PAGE GAMES — recherche, filtres, grille de produits
   (s'appuie sur les variables de style.css)
   ========================================================= */
.page-games {
  background: var(--black);
}

.games-page {
  padding: calc(var(--header-h) + 32px) 0 var(--space-section);
}

/* ---------- Fil d'Ariane ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--grey);
  margin-bottom: 22px;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--green);
}

.breadcrumb .current {
  color: var(--white);
}

/* ---------- Titre + barre ---------- */
.results-head {
  margin-bottom: 28px;
}

.results-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.results-title span {
  color: var(--green);
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.results-count {
  font-size: 15px;
  color: var(--grey);
}

.results-count strong {
  color: var(--white);
  font-weight: 700;
}

.results-search {
  display: flex;
  align-items: center;
  width: min(320px, 100%);
  height: 38px;
  padding: 0 6px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  background: #121012;
  transition: border-color 0.25s;
}

.results-search:focus-within {
  border-color: var(--olive);
}

.results-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

.results-search input::placeholder {
  color: var(--grey);
}

.results-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.results-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--grey);
  transition: color 0.2s;
}

.results-search button:hover {
  color: var(--green);
}

/* ---------- Layout ---------- */
.games-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- Filtres ---------- */
.filters-toggle,
.filters-head,
.filters-foot,
.filters-backdrop {
  display: none;
}

.filters {
  position: sticky;
  top: calc(var(--header-h-scrolled) + 28px);
}

.filter-group {
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.filter-group:first-child {
  padding-top: 0;
}

.filter-toggles {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-nav);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--white);
}

.filter-head svg {
  color: var(--grey);
  transition: transform 0.3s var(--ease);
}

.filter-group[data-open="false"] .filter-head svg {
  transform: rotate(-90deg);
}

.filter-body {
  padding-top: 14px;
}

.filter-group[data-open="false"] .filter-body {
  display: none;
}

/* Cases à cocher */
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey);
  cursor: pointer;
  transition: color 0.2s;
}

.check:hover {
  color: var(--white);
}

.check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check .box {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.check .box::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #0a0a0a;
  border-bottom: 2px solid #0a0a0a;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.check input:checked + .box {
  background: var(--green);
  border-color: var(--green);
}

.check input:checked + .box::after {
  opacity: 1;
}

.check input:checked ~ * {
  color: var(--white);
}

.check input:focus-visible + .box {
  outline: 2px solid var(--olive);
  outline-offset: 2px;
}

.check .count {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* Prix : double curseur */
.range {
  position: relative;
  height: 24px;
  margin: 4px 6px 12px;
}

.range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--r-pill);
}

.range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--green);
  border-radius: var(--r-pill);
}

.range input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--black);
  box-shadow: 0 0 0 1px var(--green);
  pointer-events: auto;
  cursor: pointer;
}

.range input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--black);
  box-shadow: 0 0 0 1px var(--green);
  pointer-events: auto;
  cursor: pointer;
}

.range input[type="range"]::-moz-range-track {
  background: transparent;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--grey);
}

.range-inputs input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  background: #121012;
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  -moz-appearance: textfield;
}

.range-inputs input::-webkit-outer-spin-button,
.range-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.range-inputs input:focus {
  border-color: var(--olive);
}

/* Listes de facettes */
.facet-search {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  background: #121012;
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.facet-search::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.facet-search:focus {
  border-color: var(--olive);
}

.facet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.facet-list li[hidden] {
  display: none;
}

.show-more {
  margin-top: 12px;
  font-family: var(--font-nav);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--green);
}

.show-more:hover {
  color: var(--white);
}

/* ---------- Barre d'outils des résultats ---------- */
.results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  min-height: 30px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 6px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  background: #121012;
  font-size: 12px;
  font-weight: 600;
  color: var(--grey);
}

.chip b {
  color: var(--white);
  font-weight: 700;
}

.chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--r-sm);
  color: var(--red);
  font-size: 14px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.chip button:hover {
  background: var(--red);
  color: var(--white);
}

.chip-reset {
  height: 28px;
  padding: 0 4px;
  font-family: var(--font-nav);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--green);
}

.chip-reset:hover {
  color: var(--white);
}

.sort {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--grey);
}

.sort select {
  height: 30px;
  padding: 0 26px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  background: #121012 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23a4e024' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 6px center / 14px;
  color: var(--green);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* Menu de tri personnalisé */
.sort-menu {
  position: relative;
  min-width: 200px;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 30px;
  padding: 0 8px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  background: #121012;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.2s;
}

.sort-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}

.sort-menu.open .sort-btn {
  border-color: var(--olive);
}

.sort-menu.open .sort-btn svg {
  transform: rotate(180deg);
}

.sort-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 100%;
  padding: 6px;
  border: 1px solid var(--olive-soft);
  border-radius: var(--r-sm);
  background: #0e0c0e;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}

.sort-menu.open .sort-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sort-list li {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--grey);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sort-list li:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.sort-list li.active {
  background: rgba(164, 224, 36, 0.12);
  color: var(--green);
}

/* ---------- Grille de produits ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product {
  position: relative;
  min-width: 0;
  background: #121012;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-sm);
  padding: 8px;
  transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}

.product:hover {
  transform: translateY(-4px);
  border-color: var(--olive-soft);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.product-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #1a1418 center / cover no-repeat;
}

.product-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(10, 8, 10, 0.85) 100%);
}

.product-title {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--white);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--green);
  color: #0a0a0a;
  font-family: var(--font-nav);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-tag.date {
  background: rgba(10, 8, 10, 0.85);
  color: var(--white);
}

.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 2px 2px;
}

.product-platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
}

.product-platform svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.product-price {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.discount {
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: var(--red);
  color: var(--white);
  font-family: var(--font-nav);
  font-size: 13px;
  font-weight: 700;
}

.price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}

.price-old {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: line-through;
}

.price-now {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.product-add {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: #0a0a0a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}

.product:hover .product-add,
.product:focus-within .product-add {
  opacity: 1;
  transform: translateY(0);
}

.no-results {
  padding: 60px 0;
  text-align: center;
  color: var(--grey);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
}

.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--grey);
  font-family: var(--font-nav);
  font-size: 15px;
  font-weight: 700;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.pagination button:hover:not(:disabled) {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.15);
}

.pagination button.active {
  background: var(--green);
  color: #0a0a0a;
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pagination .dots {
  color: var(--grey);
  padding: 0 4px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .games-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 24px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .games-page {
    padding-top: calc(var(--header-h) + 20px);
  }

  .results-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .games-layout {
    display: block;
  }

  /* Bouton d'ouverture des filtres */
  .filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-sm);
    font-family: var(--font-nav);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--white);
  }

  .filters-toggle[aria-expanded="true"] {
    border-color: var(--green);
    color: var(--green);
  }

  /* Tiroir latéral */
  .filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.6);
  }

  .filters-backdrop[hidden] {
    display: none;
  }

  .filters {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    width: min(340px, 86vw);
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #0e0c0e;
    border-right: 1px solid var(--olive-soft);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.4s var(--ease), visibility 0.4s;
  }

  .filters.open {
    transform: translateX(0);
    visibility: visible;
  }

  .filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 18px 16px 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--font-nav);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .filters-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    color: var(--grey);
    transition: color 0.2s, background 0.2s;
  }

  .filters-close:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
  }

  .filters .filter-group {
    padding-inline: 20px;
  }

  .filters .filter-group:first-of-type {
    padding-top: 18px;
  }

  /* Zone scrollable = tous les groupes ; le pied reste visible */
  .filters .filter-group:last-of-type {
    margin-bottom: auto;
  }

  .filters > .filter-group,
  .filters > .filter-toggles {
    flex-shrink: 0;
  }

  .filters-foot {
    display: block;
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    padding: 14px 20px;
    background: #0e0c0e;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .filters-apply {
    width: 100%;
    height: 44px;
  }

  body.filters-open {
    overflow: hidden;
  }

  .results-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .sort {
    justify-content: space-between;
  }

  .sort-menu {
    flex: 1;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-add {
    opacity: 1;
    transform: none;
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-media {
    aspect-ratio: 16 / 9;
  }
}

/* Micro-interaction : jaquette du catalogue */
.product-media {
  transition: transform 0.45s var(--ease);
}

.product:hover .product-media {
  transform: scale(1.02);
}

.product-title,
.product h3 {
  transition: color 0.2s;
}

.product:hover h3 {
  color: var(--green);
}
