/* ==========================================================================
   WCPPCM Filter — design system aligné WCPPCM Pro
   Palette : teal #0a9bcd / navy #1e2a3a / fond cards blanc / accent orange
   ========================================================================== */

.wcppcm-filter,
.wcppcm-filter * {
  box-sizing: border-box;
}

.wcppcm-filter {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .06);
  padding: 4px 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #1e293b;
}

/* ----- Bandeau "X filtres actifs" + Effacer (en HAUT) -----
   Visible uniquement quand au moins un filtre est appliqué. Évite le scroll
   jusqu'en bas pour réinitialiser (retour utilisateurs mai 2026). */
.wcppcm-filter__reset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-bottom: 1px solid #fed7aa;
}
.wcppcm-filter__reset-count {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #9a3412;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wcppcm-filter__reset-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #fdba74;
  border-radius: 999px;
  color: #9a3412 !important;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.wcppcm-filter__reset-top-btn:hover {
  background: #9a3412;
  border-color: #9a3412;
  color: #ffffff !important;
  transform: translateY(-1px);
}
.wcppcm-filter__reset-top-btn svg {
  flex-shrink: 0;
}

/* ----- Sections (Catégories / Couleurs / Prix) ----- */
.wcppcm-filter__section {
  border-bottom: 1px solid #f1f5f9;
}
.wcppcm-filter__section:last-of-type {
  border-bottom: none;
}

.wcppcm-filter__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 !important;
  padding: 16px 18px 12px;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #1e2a3a !important;
}

.wcppcm-filter__toggle {
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.wcppcm-filter__toggle:hover {
  background: #f1f5f9;
  color: #0a9bcd;
}

.wcppcm-filter__body {
  padding: 0 18px 18px;
  overflow: hidden;
  transition: max-height .3s ease;
}
.wcppcm-filter__section.is-collapsed .wcppcm-filter__body {
  display: none;
}

/* ----- Catégories — checkboxes custom ----- */
.wcppcm-filter__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.wcppcm-filter__item {
  margin: 0 0 6px;
}
.wcppcm-filter__check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 14px;
  line-height: 1.3;
}
.wcppcm-filter__check:hover {
  background: #f8fafc;
}
.wcppcm-filter__check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.wcppcm-filter__check-box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 5px;
  background: #ffffff;
  position: relative;
  transition: background .15s, border-color .15s;
}
.wcppcm-filter__check-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s ease-out;
}
.wcppcm-filter__check.is-checked .wcppcm-filter__check-box,
.wcppcm-filter__check input:checked ~ .wcppcm-filter__check-box {
  background: #0a9bcd;
  border-color: #0a9bcd;
}
.wcppcm-filter__check.is-checked .wcppcm-filter__check-box::after,
.wcppcm-filter__check input:checked ~ .wcppcm-filter__check-box::after {
  transform: rotate(45deg) scale(1);
}
.wcppcm-filter__check-label {
  flex: 1;
  color: #1e293b;
}
.wcppcm-filter__count {
  color: #94a3b8;
  font-size: 12px;
}

/* Bouton "Tous nos modèles" sous la section catégories */
.wcppcm-filter__all-models {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  color: #0a9bcd !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  letter-spacing: .01em;
  transition: all .15s ease;
}
.wcppcm-filter__all-models:hover {
  background: #e0f2fe;
  border-color: #0a9bcd;
  color: #0771a6 !important;
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(10, 155, 205, .15);
}
.wcppcm-filter__all-models-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wcppcm-filter__all-models-icon svg {
  display: block;
}

/* ----- Couleurs — grille 2 colonnes, pastille + libellé ----- */
.wcppcm-filter__swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.wcppcm-filter__swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  transition: background .15s ease;
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.wcppcm-filter__swatch:hover {
  background: #f8fafc;
}
.wcppcm-filter__swatch.is-active {
  background: #e0f2fe;
}

.wcppcm-filter__swatch-dot {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--swatch-color, #cccccc);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .18);
  transition: box-shadow .15s ease, transform .15s ease;
}

.wcppcm-filter__swatch:hover .wcppcm-filter__swatch-dot {
  transform: scale(1.08);
}

.wcppcm-filter__swatch.is-active .wcppcm-filter__swatch-dot {
  box-shadow: 0 0 0 2px #0a9bcd, 0 2px 6px rgba(10, 155, 205, .25);
}

.wcppcm-filter__swatch-name {
  flex: 1;
  font-weight: 500;
  line-height: 1.2;
}

.wcppcm-filter__swatch.is-active .wcppcm-filter__swatch-name {
  color: #0771a6;
  font-weight: 600;
}

/* Pastille quadri (multicolore) */
.wcppcm-filter__swatch--quadri .wcppcm-filter__swatch-dot {
  background: conic-gradient(from 0deg, #ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #6366f1, #ec4899, #ef4444);
  position: relative;
}
.wcppcm-filter__swatch--quadri .wcppcm-filter__swatch-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: #ffffff;
  border-radius: 50%;
}

/* Pastille blanche : bordure visible pour la distinguer du fond */
.wcppcm-filter__swatch[data-slug="blanc"] .wcppcm-filter__swatch-dot,
.wcppcm-filter__swatch[data-slug="white"] .wcppcm-filter__swatch-dot {
  box-shadow: 0 0 0 1px #cbd5e1;
}

/* ----- Prix — slider double-curseur ----- */
.wcppcm-filter__price-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 14px;
  color: #1e2a3a;
}
.wcppcm-filter__price-sep {
  color: #cbd5e1;
}

.wcppcm-filter__slider {
  position: relative;
  height: 32px;
  margin: 0 8px 6px;
}
.wcppcm-filter__slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  transform: translateY(-50%);
}
.wcppcm-filter__slider-range {
  position: absolute;
  top: 50%;
  height: 4px;
  background: linear-gradient(90deg, #0a9bcd, #0771a6);
  border-radius: 2px;
  transform: translateY(-50%);
  /* left / right pilotés par le JS */
}

/* Inputs range natifs superposés, fond transparent, on garde uniquement les thumbs */
.wcppcm-filter__slider-input {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 32px;
  background: transparent;
  pointer-events: none;
  outline: none;
  margin: 0;
  padding: 0;
}
.wcppcm-filter__slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0a9bcd;
  box-shadow: 0 2px 6px rgba(10, 155, 205, .35);
  cursor: grab;
  transition: transform .15s, box-shadow .15s;
}
.wcppcm-filter__slider-input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(10, 155, 205, .5);
}
.wcppcm-filter__slider-input::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0a9bcd;
  box-shadow: 0 2px 6px rgba(10, 155, 205, .35);
  cursor: grab;
}
.wcppcm-filter__slider-input::-moz-range-track {
  background: transparent;
  border: none;
}

/* ----- Actions footer (Appliquer / Réinitialiser) ----- */
.wcppcm-filter__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 18px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.wcppcm-filter__btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all .15s ease;
  font-family: inherit;
}
.wcppcm-filter__btn--apply {
  background: linear-gradient(135deg, #0a9bcd, #0771a6);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(10, 155, 205, .25);
}
.wcppcm-filter__btn--apply:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(10, 155, 205, .35);
}
/* Masque le bouton Appliquer quand JS a initialisé l'auto-submit
   (l'utilisateur n'a plus besoin de cliquer manuellement). */
.wcppcm-filter.is-auto-submit .wcppcm-filter__btn--apply {
  display: none;
}

/* État de chargement (entre le moment où on change un filtre et le reload) */
.wcppcm-filter.is-loading {
  opacity: 0.55;
  pointer-events: none;
  position: relative;
}
.wcppcm-filter.is-loading::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  border: 2.5px solid #e2e8f0;
  border-top-color: #0a9bcd;
  border-radius: 50%;
  animation: wcppcmFilterSpin 0.8s linear infinite;
}
@keyframes wcppcmFilterSpin {
  to { transform: rotate(360deg); }
}
.wcppcm-filter__btn--reset {
  background: #ffffff;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.wcppcm-filter__btn--reset:hover {
  color: #1e2a3a;
  border-color: #cbd5e1;
  background: #f1f5f9;
}

/* ----- Mobile / sidebar étroite ----- */
@media (max-width: 480px) {
  .wcppcm-filter { font-size: 13px; }
  .wcppcm-filter__title { padding: 14px 14px 10px; }
  .wcppcm-filter__body { padding: 0 14px 14px; }
  .wcppcm-filter__swatch { padding: 5px 10px 5px 5px; font-size: 12px; }
  .wcppcm-filter__actions { padding: 12px 14px 14px; }
}

/* Si placé en widget Divi → reset les styles Divi qui interféreraient */
.wcppcm-filter-widget {
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.wcppcm-filter-widget .widgettitle,
.wcppcm-filter-widget .widget-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #1e2a3a;
}
