/* ============================================================
   catalogue.css
   ============================================================ */

.catalogue-header {
  text-align: center;
  padding-bottom: var(--space-3) !important;
}

.catalogue-header p { font-weight: 600; color: var(--color-navy-900); }

.catalogue-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-5);
  padding-top: 0 !important;
}

.filters-panel {
  align-self: start;
  position: sticky;
  top: calc(var(--header-offset) + var(--space-3));
  background: var(--color-steel-100);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.filters-panel fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-4);
}

.filters-panel legend {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-navy-950);
  margin-bottom: var(--space-2);
}

.filters-panel label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
}

.filters-panel__price-range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filters-panel__price-range input {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-steel-300);
}

.filters-panel__apply { width: 100%; margin-top: var(--space-2); }
#reset-filters { width: 100%; margin-top: var(--space-2); }

.catalogue-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.catalogue-toolbar__right { display: flex; align-items: center; gap: var(--space-3); }

.catalogue-toolbar__sort { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; }
.catalogue-toolbar__sort select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-steel-300);
}

#open-filters-mobile { display: none; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.pagination__page,
.pagination__arrow {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-steel-300);
  background: var(--color-white);
  cursor: pointer;
  font-weight: 600;
  flex: 0 0 auto;
}

.pagination__page.is-active {
  background: var(--color-accent-500);
  border-color: var(--color-accent-500);
  color: var(--color-white);
}

.pagination__arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination__ellipsis {
  display: flex;
  align-items: flex-end;
  padding-bottom: 6px;
  color: var(--color-steel-500);
  font-weight: 700;
}

/* ---------- BOTTOM SHEET MOBILE ---------- */
.filters-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.filters-sheet-overlay.is-open { opacity: 1; }

.filters-sheet {
  background: var(--color-white);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: var(--space-4);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.filters-sheet-overlay.is-open .filters-sheet { transform: translateY(0); }

.filters-sheet__handle {
  width: 40px; height: 4px;
  background: var(--color-steel-300);
  border-radius: 999px;
  margin: 0 auto var(--space-3);
}

.filters-sheet__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.filters-sheet__header button {
  background: none; border: none; font-size: 18px; cursor: pointer;
}

@media (max-width: 900px) {
  .catalogue-layout { grid-template-columns: minmax(0, 1fr); }
  .filters-panel { display: none; }
  #open-filters-mobile { display: inline-flex; }
}

/* Case « Comparar » dans les cartes */
.product-card .compare-toggle { align-self: flex-end; margin: 6px 0 2px; font-size: 12.5px; }

/* ============================================================
   Filtres avancés
   ============================================================ */
.filters-panel { max-height: calc(100vh - var(--header-offset) - var(--space-5)); overflow-y: auto; }

/* Interrupteur « Solo ofertas » */
.filter-switch {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  margin: 0 0 var(--space-4);
  padding: 10px 12px !important;
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-navy-950);
  cursor: pointer;
}
.filter-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filter-switch__track {
  position: relative;
  width: 38px; height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--color-steel-300);
  transition: background 0.2s ease;
}
.filter-switch__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.filter-switch input:checked + .filter-switch__track { background: var(--color-danger); }
.filter-switch input:checked + .filter-switch__track::after { transform: translateX(16px); }
.filter-switch input:focus-visible + .filter-switch__track { box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.3); }

/* Liste de marques */
.facet-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-steel-300);
  border-radius: 10px;
  font: inherit;
  font-size: 13.5px;
  background: #fff;
}
.facet-list { display: flex; flex-direction: column; }
.facet-item {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  padding: 5px 0 !important;
  font-size: 14px;
  cursor: pointer;
}
.facet-item input { width: 16px; height: 16px; accent-color: var(--color-navy-950); flex-shrink: 0; }
.facet-item__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-item__count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-steel-500);
  background: #fff;
  padding: 1px 7px;
  border-radius: 999px;
}
.facet-item.is-collapsed, .facet-item.is-filtered-out { display: none !important; }
.facet-more {
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent-600);
  cursor: pointer;
}
.facet-empty { margin: 0; font-size: 13px; color: var(--color-steel-500); }

/* Pastilles classe énergétique */
.energy-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.energy-chip {
  position: relative;
  padding: 0 !important;
  cursor: pointer;
}
.energy-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.energy-chip span {
  display: inline-flex;
  align-items: center;
  min-width: 40px;
  height: 30px;
  padding: 0 12px 0 10px;
  border-radius: 8px 0 0 8px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
  background: var(--chip);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.6);
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.energy-chip:hover span { opacity: 0.7; }
.energy-chip input:checked + span { opacity: 1; transform: scale(1.05); }
.energy-chip input:focus-visible + span { outline: 2px solid var(--color-navy-950); outline-offset: 2px; }

/* Raccourcis de budget */
.price-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.price-chips button {
  padding: 6px 10px;
  border: 1px solid var(--color-steel-300);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-navy-900);
  cursor: pointer;
}
.price-chips button:hover { border-color: var(--color-navy-950); }

/* Filtres actifs au-dessus des résultats */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-3);
}
.active-filters[hidden] { display: none; }
.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--color-navy-950);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.active-filter span { font-size: 10px; opacity: 0.75; }
.active-filter:hover span { opacity: 1; }
.active-filters__clear {
  padding: 0 4px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--color-steel-500);
  text-decoration: underline;
  cursor: pointer;
}

/* ============================================================
   Barre de filtres rapides + bouton « Filtros »
   ============================================================ */
.filters-button {
  display: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1.5px solid var(--color-navy-950);
  border-radius: 999px;
  background: var(--color-navy-950);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.filters-button__count {
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-accent-500);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filters-button__count[hidden] { display: none; }

.quick-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px;
}
.quick-filters::-webkit-scrollbar { display: none; }
.quick-filter {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border: 1.5px solid var(--color-steel-300);
  border-radius: 999px;
  background: #fff;
  color: var(--color-navy-900);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.quick-filter:hover { border-color: var(--color-navy-950); }
.quick-filter.is-active {
  border-color: var(--color-navy-950);
  background: var(--color-navy-950);
  color: #fff;
}
.quick-filter.is-active::after { content: ' ✕'; font-size: 10px; opacity: 0.7; }
.quick-filter--hot.is-active { border-color: var(--color-danger); background: var(--color-danger); }
.quick-filters__sep { flex-shrink: 0; width: 1px; height: 22px; background: var(--color-steel-300); margin: 0 2px; }

/* Sur mobile : bouton « Filtros » bien visible + barre défilante */
@media (max-width: 900px) {
  #open-filters-mobile.filters-button { display: inline-flex; }
  .catalogue-toolbar { gap: 10px; }
}
@media (max-width: 480px) {
  .catalogue-toolbar__sort label { display: none; }
}
.catalogue-results { min-width: 0; }

/* Tri : même style que les pastilles */
.catalogue-toolbar__sort select {
  height: 42px;
  padding: 0 36px 0 16px;
  border: 1.5px solid var(--color-steel-300);
  border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 14px center / 14px no-repeat;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-navy-950);
  cursor: pointer;
}
@media (max-width: 900px) {
  .catalogue-toolbar { flex-wrap: nowrap; }
  .catalogue-toolbar__right { min-width: 0; }
  .catalogue-toolbar__sort select { max-width: 170px; }
}
.filters-button { white-space: nowrap; flex-shrink: 0; }
.quick-filter[hidden], #condition-fieldset[hidden] { display: none !important; }

/* ---------- Fil d'Ariane et sous-catégories (générés par le serveur) ---------- */
.seo-breadcrumb { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 8px; font-size: 13px; color: var(--color-steel-500); }
.seo-breadcrumb a { color: var(--color-steel-500); text-decoration: none; }
.seo-breadcrumb a:hover { color: var(--color-accent-600); text-decoration: underline; }
.seo-breadcrumb [aria-current] { color: var(--color-navy-950); font-weight: 600; }
.seo-subcats { display: flex; gap: 8px; margin: 14px 0 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.seo-subcats::-webkit-scrollbar { display: none; }
.seo-subcats a {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1.5px solid var(--color-steel-100);
  border-radius: 999px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-navy-900);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease;
}
.seo-subcats a:hover { border-color: var(--color-accent-500); color: var(--color-accent-600); }

/* Très petits écrans (320-380 px) : la barre Filtros / tri / grille reste sur une ligne sans déborder */
@media (max-width: 380px) {
  .filters-button { padding: 0 12px; gap: 6px; font-size: 13.5px; }
  .catalogue-toolbar__sort select { max-width: 112px; padding: 0 30px 0 12px; font-size: 13px; }
  .catalogue-toolbar { gap: 8px; }
}
