/* ============================================================
   CCC FILTRES CATALOGUE — design sober, inspiré du megamenu
   - Pas de bold excessif, pas d'uppercase, pas d'emojis
   - Une seule couleur d'accent (cyan #2fadce) sur hover/active
   - Icônes SVG inline (lucide-like) injectées par JS
   ============================================================ */

/* === STICKY SIDEBAR + scrollable interne === */
.PM_ASBlockOutputVertical{
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 70px !important;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f9fafb;
  align-self: flex-start; /* important si parent reste flex */
  z-index: 5;
}
/* On s'assure qu'aucun ancêtre proche n'a overflow:hidden qui casserait sticky */
#right-column,
#left-column,
.side-column,
.col-lg-3{
  overflow: visible !important;
}
.PM_ASBlockOutputVertical::-webkit-scrollbar{ width: 5px; }
.PM_ASBlockOutputVertical::-webkit-scrollbar-track{ background: transparent; }
.PM_ASBlockOutputVertical::-webkit-scrollbar-thumb{ background: #d1d5db; border-radius: 3px; }

/* === CARD CONTAINER === */
.PM_ASBlockOutput .card{
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: none;
  overflow: hidden;
  background: #fff;
}
.PM_ASBlockOutput .card-header{
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 14px;
}
.PM_ASBlockOutput .PM_ASBlockTitle{
  font-size: 13px !important;
  font-weight: 600;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0;
  text-transform: none;
}
.PM_ASBlockOutput .PM_ASBlockTitle::before{
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}
.PM_ASBlockOutput .PM_ASBlockNbProductValue{
  display: inline-block;
  margin-left: auto;
  background: transparent;
  padding: 0;
  color: #6b7280;
  font-size: 11px;
  font-weight: 400;
  border: none;
}
.PM_ASBlockOutput .card-block{
  padding: 4px 8px 10px !important;
}

/* === RESET BUTTON === */
.PM_ASResetSearch{
  display: block !important;
  text-align: center;
  margin: 8px 4px !important;
  padding: 6px 12px;
  background: transparent;
  color: #6b7280 !important;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none !important;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  letter-spacing: 0;
  text-transform: none;
  transition: all .15s ease;
}
.PM_ASResetSearch:hover{
  background: #f9fafb;
  color: #2fadce !important;
  border-color: #2fadce;
}

/* === ACCORDION HEADERS === */
.PM_ASCriterionsGroup{
  border-bottom: 1px solid #f3f4f6;
  margin: 0 !important;
}
.PM_ASCriterionsGroup:last-child{ border-bottom: none; }

.PM_ASCriterionsGroupTitle{
  margin: 0 !important;
  padding: 11px 4px 11px 6px !important;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 13px !important;
  font-weight: 500;
  color: #6b7280;
  transition: color .15s ease;
  border-radius: 4px;
}
.PM_ASCriterionsGroupTitle:hover{ color: #2fadce; }
.PM_ASCriterionsGroupTitle:hover .ccc-filter-icon{ stroke: #2fadce; }
.PM_ASCriterionsGroupName{
  display: flex !important;
  align-items: center;
  gap: 9px;
  flex: 1;
  font-size: 13px;
}

/* SVG icon container (injecté par JS) */
.ccc-filter-icon{
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: #94a3b8;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .15s ease;
}

/* Caret accordéon */
.PM_ASCriterionsGroupTitle::after{
  content: "";
  width: 10px;
  height: 10px;
  margin-left: 8px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform .2s ease;
}
.PM_ASCriterionsGroup.is-collapsed .PM_ASCriterionsGroupTitle::after{ transform: rotate(-90deg); }
.PM_ASCriterionsGroup.is-active .PM_ASCriterionsGroupTitle{ color: #2fadce; }
.PM_ASCriterionsGroup.is-active .ccc-filter-icon{ stroke: #2fadce; }

/* Compteur nb actifs sur titre */
.ccc-filter-count{
  margin-left: 6px;
  background: #2fadce;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 9px;
  line-height: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
}

/* === GROUPE OUTER (collapse) === */
.PM_ASCriterionsGroupOuter{
  padding: 0 4px 8px;
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .25s ease, opacity .15s ease, padding .25s ease;
}
.PM_ASCriterionsGroup.is-collapsed .PM_ASCriterionsGroupOuter{
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* === SELECT NATIF CACHÉ === */
.ccc-filters-enhanced .PM_ASCriterionStepEnable .PM_ASCriterionGroupSelect{
  display: none !important;
}

/* === LISTE CHECKBOX CUSTOM === */
.ccc-filter-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.ccc-filter-item{ margin: 0; }
.ccc-filter-checkbox{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ccc-filter-label{
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12.5px;
  color: #7b8694;
  transition: background .12s ease, color .12s ease;
  margin: 0;
  font-weight: 400;
  line-height: 1.4;
}
.ccc-filter-label:hover{ background: #f9fafb; color: #475569; }
.ccc-filter-label::before{
  content: "";
  width: 14px;
  height: 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 3px;
  flex-shrink: 0;
  background: #fff;
  transition: all .12s ease;
}
.ccc-filter-checkbox:checked + .ccc-filter-label{
  color: #2fadce;
  font-weight: 500;
}
.ccc-filter-checkbox:checked + .ccc-filter-label::before{
  background: #2fadce;
  border-color: #2fadce;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='%23fff'%3E%3Cpath d='M3.7 7.3L1.6 5.2 2.6 4.2l1.1 1.1L7.4 1.6l1 1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.ccc-filter-name{
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: inherit;
}
.ccc-filter-count-badge{
  background: transparent;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 400;
  padding: 0;
  border-radius: 0;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ccc-filter-checkbox:checked + .ccc-filter-label .ccc-filter-count-badge{
  color: #2fadce;
}

/* === CHIPS FILTRES ACTIFS — design minimal, juste avant le listing produits === */
.ccc-active-filters{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  padding: 0;
  background: transparent;
  border: none;
}
.ccc-active-filters:empty{ display: none; }
.ccc-active-filters-label{
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  margin-right: 2px;
  letter-spacing: 0;
  text-transform: none;
  font-style: normal;
}
.ccc-active-chip{
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 4px 4px 4px 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  font-size: 12.5px;
  color: #1a202c;
  font-weight: 400;
  transition: all .15s ease;
  line-height: 1.4;
}
.ccc-active-chip:hover{
  border-color: #2fadce;
  color: #2fadce;
  background: #f0fdff;
}
.ccc-active-chip-x{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  font-weight: 400;
  opacity: .55;
  transition: all .12s ease;
}
.ccc-active-chip:hover .ccc-active-chip-x{ opacity: 1; }
.ccc-active-chip-x:hover{ background: #2fadce; color: #fff !important; opacity: 1 !important; }
.ccc-active-clear-all{
  margin-left: 4px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
  transition: color .15s ease;
  text-decoration: underline;
  text-decoration-color: transparent;
}
.ccc-active-clear-all:hover{
  color: #dc2626;
  text-decoration-color: currentColor;
  background: transparent;
}

/* === LOADING OVERLAY (pendant filtrage) === */
.ccc-products-loading{
  position: relative;
  pointer-events: none;
  min-height: 240px;
}
.ccc-products-loading > *{
  opacity: .35;
  transition: opacity .2s ease;
}
.ccc-products-loading::before{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.5);
  z-index: 100;
  border-radius: 6px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: all;
}
.ccc-products-loading::after{
  content: "";
  position: absolute;
  top: 90px;
  left: 50%;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  border: 3px solid #e5e7eb;
  border-top-color: #2fadce;
  border-radius: 50%;
  animation: ccc-spin 0.7s linear infinite;
  z-index: 101;
}
@keyframes ccc-spin {
  to { transform: rotate(360deg); }
}
.ccc-loading-text{
  position: absolute;
  top: 138px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  z-index: 101;
  letter-spacing: 0.02em;
  display: none;
}
.ccc-products-loading + .ccc-loading-text,
body.ccc-filtering .ccc-loading-text{ display: block; }

/* === MOBILE DRAWER === */
.ccc-mobile-filter-trigger{
  display: none;
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9990;
  padding: 11px 22px;
  background: #2fadce;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  cursor: pointer;
  align-items: center;
  gap: 8px;
}
.ccc-mobile-filter-trigger-icon{
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
}
.ccc-mobile-filter-trigger-count{
  background: rgba(255,255,255,.25);
  color: #fff;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
}
.ccc-mobile-filter-trigger-count:empty,
.ccc-mobile-filter-trigger-count:not(:empty)[data-empty="1"]{ display: none; }
.ccc-mobile-filter-overlay{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.5);
  display: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.ccc-mobile-filter-overlay.is-open{ display: block; opacity: 1; }
.ccc-mobile-filter-drawer{
  position: fixed;
  top: 0;
  right: -100%;
  bottom: 0;
  width: min(420px, 100vw);
  background: #fff;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transition: right .3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
}
.ccc-mobile-filter-drawer.is-open{ right: 0; }
.ccc-mobile-filter-header{
  padding: 14px 16px;
  background: #fafbfc;
  color: #1a202c;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ccc-mobile-filter-header h2{
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.ccc-mobile-filter-close{
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.ccc-mobile-filter-close:hover{ color: #2fadce; border-color: #2fadce; }
.ccc-mobile-filter-content{
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.ccc-mobile-filter-footer{
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}
.ccc-mobile-filter-footer button{
  flex: 1;
  padding: 10px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
}
.ccc-mobile-filter-clear{
  background: #fff;
  color: #6b7280;
  border: 1px solid #e5e7eb !important;
}
.ccc-mobile-filter-apply{
  background: #2fadce;
  color: #fff;
  border: none;
}

@media (max-width: 991px){
  .ccc-mobile-filter-trigger{ display: inline-flex; }
  .PM_ASBlockOutputVertical{
    position: static;
    max-height: none;
    overflow: visible;
  }
  body:not(.ccc-mobile-filters-active) #left-column .PM_ASBlockOutput,
  body:not(.ccc-mobile-filters-active) #right-column .PM_ASBlockOutput{
    display: none;
  }
}

/* === ORDRE VISUEL DES BLOCS SIDEBAR ===
   Le reorder est fait en JS via DOM moves (pas via flex order).
   Raison : `display:flex` casse `position:sticky` sur les flex items.
   On garde donc le document flow naturel pour que sticky fonctionne. */

/* On force juste l'affichage de block-newproducts qui peut être hidden par CSS inline */
#right-column .block-newproducts,
#left-column .block-newproducts{ display: block !important; }

/* === BOUTON ANNULER pendant filtrage === */
.ccc-loading-cancel{
  position: absolute;
  top: 178px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 102;
  padding: 7px 18px;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  border-radius: 18px;
  cursor: pointer;
  transition: all .15s ease;
  display: none;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.ccc-loading-cancel:hover{
  border-color: #dc2626;
  color: #dc2626;
  background: #fff;
}
body.ccc-filtering .ccc-loading-cancel{ display: inline-block; }

/* === HIDE le bloc "Filtres actifs" NATIF de pm_advancedsearch4 (doublon de notre version épurée) === */
#js-active-search-filters,
.PM_ASSelectionsBlock.active_filters,
.PM_ASSelections.active_filters{
  display: none !important;
}

/* === STICKY barre tri/compteur/affichage (juste au-dessus du listing produits) === */
#js-product-list-top{
  position: -webkit-sticky;
  position: sticky;
  top: 70px;
  z-index: 6;
  background: #fff;
  margin-bottom: 0 !important;
  box-shadow: 0 4px 8px -4px rgba(0,0,0,.08);
  border-radius: 6px;
}
/* Empêche overflow:hidden des ancêtres de casser le sticky */
/* Aggressive overflow:visible sur tous les ancêtres possibles pour préserver sticky */
html, body,
#wrapper, #content-wrapper, #main,
#products, .products-selection, .products-bottom,
#left-column, #right-column,
.side-column, aside.side-column,
.col, [class*="col-lg-"], [class*="col-md-"], [class*="col-sm-"],
.row, .container, .container-fluid{
  overflow: visible !important;
}
/* X axe peut clip pour éviter scroll horizontal mais Y doit rester visible pour le sticky */
html, body{ overflow-x: hidden !important; overflow-y: visible !important; }
