/* Shared category/manufacturer product-listing styles.
   Includes filters, sorting, the product grid, pagination and responsive rules. */

/* ==========================================================
   FILTER / SORT BAR
   (#js-product-list-top injected by PrestaShop)
========================================================== */

#js-product-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
  max-width: 1222px;
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
}

/* Right-side sort row */
.sort-by-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

/* Remove Bootstrap column widths inside sort-by-row */
.sort-by-row > * {
  width: auto !important;
  max-width: none !important;
  flex: unset !important;
}

/* "Sort by" label */
.sort-by {
  margin: 0;
  font-family: "Poppins";
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Strip default padding from PrestaShop's sort control wrapper */
.products-sort-order {
  padding: 0 !important;
}

/* Hide the block-categories sidebar (we use our own filter bar) */
.block-categories {
  display: none;
}

#manufacturer #main #search_filters .facet > ul {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}


/* ==========================================================
   FACETED SEARCH — filter bar
========================================================== */

/* Hide default module title */
#search_filters > .h6,
#search_filters .facet-title,
#search_filters .title {
  display: none !important;
}

/* Wrapper: fills remaining space */
#search_filters_wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-start;
}

/* Facet display order */
#search_filters .facet[data-name="Besoins_chevaux"],
#search_filters .facet[data-name="Besoins_chiens"] {
  order: 1;
}

#search_filters .facet[data-name^="Sous_besoins_chevaux__"],
#search_filters .facet[data-name^="Sous_besoins_chiens__"] {
  order: 2;
}

#search_filters .facet[data-name="Saison"] {
  order: 3;
}

/* On desktop, force Saison onto its own second row */
@media (min-width: 769px) {
  #search_filters .facet[data-name="Saison"] {
    display: flex;
    flex: 0 0 100%;
    max-width: none;
  }
}

/* Filter list */
#search_filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height:54px;
  align-items: center;
  margin-bottom: 0;
  padding-left: 0;
  background: none;
}

#search_filters > p {
  display: none;
}

/* Individual facet */
#search_filters .facet {
  max-width: 400px;
  margin: 0;
  padding-top: 0;
  align-items: center;
}

/* Hide duplicate titles rendered at different breakpoints */
.facet-title.hidden-sm-down,
.facet .title.hidden-md-up {
  display: none;
}

#search_filters .facet[data-name="Besoins_chevaux"] .dropdown {
  width: max-content;
  min-width: 340px;
  max-width: calc(100vw - 40px);
}

#search_filters .facet[data-name="Besoins_chevaux"] .select-list {
  white-space: nowrap;
}


/* Strip PrestaShop's default dropdown chrome */
#search_filters .facet-dropdown {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

#search_filters .facet-dropdown.dropdown {
  width: 100%;
}

/* Pill-shaped select button */
#search_filters .facet-dropdown .select-title {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 54px;
  padding: 0 20px;
  min-width: 240px;
  background: var(--color-surface-alt);
  border: 1px solid rgba(26, 47, 27, 0.15);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color     0.2s ease,
    background-color 0.2s ease;
}

#search_filters .facet-dropdown .select-title:hover {
  border-color: rgba(26, 47, 27, 0.30);
}

/* Flex layout inside the title */
#search_filters .select-title span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

#search_filters .select-title > * {
  display: flex;
  align-items: center;
}

/* Injected label (uppercase small-caps via ::before) */
#search_filters .facet[data-name="Besoins_chevaux"] .select-title span::before { content: "BESOIN"; }
#search_filters .facet[data-name="Saison"]           .select-title span::before { content: "SAISON"; }

#search_filters .facet[data-name^="Sous_besoins_chevaux__"] .select-title span::before,
#search_filters .facet[data-name^="Sous_besoins_chiens__"] .select-title span::before {
  content: "SOUS-BESOIN";
}

#search_filters .facet .select-title span::before {
  flex-shrink: 0;
  font-family: "Poppins";
  font-size: 11.5px;
  font-weight: 500;
  line-height: 17px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-muted);
  display: block;
  margin-bottom: -2px;
}

/* Selected value text */
#search_filters .facet .select-title span {
  font-family: "Cormorant-Garamond";
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Arrow icon */
#search_filters .facet-dropdown .material-icons {
  flex-shrink: 0;
  font-size: 18px;
  color: rgba(26, 47, 27, 0.60);
  transition: transform 0.2s ease;
}

#search_filters .facet-dropdown.show .material-icons {
  transform: rotate(180deg);
}

/* Dropdown menu */
#search_filters .dropdown-menu {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg-filters);
  box-shadow: 0 20px 60px -25px rgba(26, 47, 27, 0.15);
  min-width: 100%;
}

/* Dropdown options */
#search_filters .dropdown-menu .select-list {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: "Cormorant-Garamond";
  font-size: 18px;
  line-height: 24px;
  color: var(--color-primary);
  background: var(--color-bg-filters);
  text-decoration: none;
  transition: background 0.15s ease;
}

#search_filters .dropdown-menu .select-list:hover {
  background: var(--color-bg-filters-options-hover);
}


/* ==========================================================
   ACTIVE FILTERS  (hidden — we hide the ugly default block)
========================================================== */

#js-active-search-filters {
  display: none;
}


/* ==========================================================
   CLEAR-ALL BUTTON  (icon-only circular)
========================================================== */

#_desktop_search_filters_clear_all-wrapper {
  margin-right: 24px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.563rem 0;
}


#_desktop_search_filters_clear_all .js-search-filters-clear-all {
  font-size: 0; /* hide text */
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(26, 47, 27, 0.20);
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.js-search-filters-clear-all .material-icons {
  margin-right: 0;
}

@media (max-width: 768px) {
  #search_filters_wrapper {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  #_desktop_search_filters_clear_all-wrapper {
    order: -1;
    width: 100%;
    min-height: 0;
    margin: 0 0 12px;
    padding: 0;
    justify-content: center;
  }

  #_desktop_search_filters_clear_all {
    display: flex;
    justify-content: center;
    width: 100%;
  }
}


/* ==========================================================
   SORT SEGMENTED CONTROL  (custom, replaces theme's dropdown)
========================================================== */

.esc-sort {
  display: flex;
  align-items: center;
  gap: 12px;
}

.esc-sort__label {
  font-family: "Poppins";
  font-size: 11.5px;
  font-weight: 500;
  line-height: 17px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-muted);
  white-space: nowrap;
}

.esc-sort__controls {
  display: flex;
  align-items: center;
  padding: 4px;
  background: var(--color-surface-alt);
  border: 1px solid rgba(26, 47, 27, 0.15);
  border-radius: 999px;
  transition: border-color 0.2s ease;
}

.esc-sort__controls:hover {
  border-color: rgba(26, 47, 27, 0.30);
}

.esc-sort__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 43px;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-family: "Poppins";
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: rgba(26, 47, 27, 0.70);
  transition:
    background-color 0.15s ease,
    color            0.15s ease;
}

.esc-sort__btn.is-active {
  background: var(--color-primary);
  color: var(--color-secondary);
}

.esc-sort__btn:hover {
  text-decoration: none;
  color: var(--color-primary);
}

.esc-sort__btn.is-active:hover {
  color: var(--color-secondary);
}


/* ==========================================================
   PRODUCT COUNT
========================================================== */

.total-products {
  padding-top: 24px;
  padding-left: 120px;
  margin: 0 auto;
  font-family: "Poppins";
  font-weight: 500;
  font-size: 11.5px;
  line-height: 17.28px;
  letter-spacing: 2.53px;
  text-transform: uppercase;
  color: var(--color-muted);
}


/* ==========================================================
   PRODUCT LIST  (PrestaShop grid)
========================================================== */

#products {
  width: 100vw;
  background: #DBD5C0;
}

#js-product-list {
  max-width: 1440px;
  margin: 0 auto;
}

.products {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 24px;
  justify-content: center !important;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
}

/* ==========================================================
   PAGINATION
========================================================== */

/* Hide the bottom listing info bar (product count, prev/next) —
   we render our own pagination nav above */
#js-product-list-bottom {
  display: none !important;
}

nav.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-bottom: 0 !important;
  padding-bottom: 20px;
}

/* Kill Bootstrap grid column widths */
nav.pagination > div {
  width: auto !important;
  max-width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* Results count text */
nav.pagination .col-md-4 {
  text-align: center;
  font-family: "Poppins";
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-soft);
}

/* Page list wrapper */
nav.pagination .col-md-6 {
  display: flex;
  justify-content: center;
}

/* Unordered list */
nav.pagination .page-list,
.pagination .page-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  background: none;
}

/* Page items */
nav.pagination .page-list li a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(26, 47, 27, 0.15);
  background: var(--color-surface-alt);
  text-decoration: none;
  font-family: "Cormorant-Garamond";
  font-weight: 500;
  font-size: 18px;
  line-height: 1;
  color: var(--color-primary);
  transition: all 0.2s ease;
}

nav.pagination .page-list li a:hover {
  border-color: rgba(26, 47, 27, 0.30);
}

/* Current / active page */
nav.pagination .page-list li.current a {
  background: var(--color-primary);
  color: var(--color-secondary);
  border-color: var(--color-primary);
}

/* "Next" button: slightly wider for the icon */
nav.pagination .page-list li a.next {
  gap: 6px;
  padding-right: 14px;
}

nav.pagination .page-list li a.next i {
  font-size: 18px;
  line-height: 1;
}

/* ==========================================================
   RESPONSIVE — product listing and filters
========================================================== */

@media (max-width: 768px) {
  /* Filter bar: stacked vertical */
  #search_filters {
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    width: min(400px, calc(100vw - 48px));
  }

  #search_filters .facet {
    min-width: 0;
  }

  #search_filters .facet-dropdown .select-title {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    max-width: min(400px, calc(100vw - 48px));
    overflow: hidden;
  }

  #search_filters .facet-dropdown .select-title span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #search_filters .facet-dropdown .material-icons {
    flex-shrink: 0;
  }

  /* Filter bar row: stacked */
  #js-product-list-top {
    flex-direction: column;
    align-items: flex-start;
    margin: 0 24px;
    padding: 24px 0;
    gap: 12px;
  }

  .sort-by-row {
    width: 100%;
    justify-content: space-between;
    padding-right: 0;
  }

  .total-products {
    padding-left: 24px;
    padding-top: 24px;
  }

  /* Prevent Bootstrap gutters from overflowing the product listing. */
  #products .row {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  body#category #wrapper > .container,
  body#manufacturer #wrapper > .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Slightly wider cards on small screens. */
  #js-product-list .product {
    width: 340px;
  }

  #products .up {
    margin-bottom: 0;
  }

  #products {
    width: unset;
    padding-left: 12px;
    padding-right: 12px;
  }

  #_desktop_search_filters_clear_all-wrapper {
    margin-right: unset;
  }
}

