/* =====================================================
   WRAPPER
===================================================== */

.tpm-filters {
  margin: 35px auto 40px;
  padding: 0 10px;
}

@media screen and (max-width: 600px) {
  .tpm-filters {
    margin: 25px auto 30px;
  }
}

/* =====================================================
   TITRE
===================================================== */
.tpm-filters--title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px;
}

.tpm-filters--title .arrow-icon {
  width: 45px;
  height: 45px;
  margin-top: 5px;

  @media screen and (min-width: 768px) {
    display: none;
  }
}

.tpm-filters--title h2 {
  margin-bottom: 20px;

  @media screen and (max-width: 768px) {
    text-transform: uppercase;
  }
}

/* =====================================================
   BLOC PRINCIPAL
===================================================== */

.tpm-filter {
  border: 1px solid #000;
  border-bottom-left-radius: 90px;
  border-bottom-right-radius: 90px;
  padding: 50px;

  @media screen and (max-width: 768px) {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    padding: 20px;
  }
}

/* =====================================================
   LIGNES
===================================================== */

.tpm-filter__row {
  display: flex;
  flex-wrap: wrap;
  column-gap: 4rem;
}

/* Ligne 1 — Thématique / Sous-thématique */
.tpm-filter__row--1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2rem;
  width: 100%;
  margin-bottom: 30px;
}

.tpm-filter__row--1::after {
  content: "";
  flex: 1;
}

.tpm-filter__row--1 .tpm-filter__field {
  position: relative;
  flex: 0 0 auto;
  max-width: 300px;
  width: 100%;
}

/* Ligne 2 */
.tpm-filter__row--2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #000;
  padding-bottom: 15px;
  margin-top: 30px;
  width: 60%;

  @media screen and (max-width: 768px) {
    width: 80%;
  }
}

/* Ligne 3 — Filtres avancés */
.tpm-filter__row--3 {
  display: none;
  margin-top: 40px;
}

.tpm-filter__row--3.is-open {
  display: flex;
  gap: 60px;
  width: 90%;
  align-items: flex-start;

  @media screen and (max-width: 768px) {
    gap: 30px;
  }
}

.tpm-filter__row--3 > .tpm-filter__field {
  flex: 1;
  min-width: 220px;
}

.tpm-filter__row--3 .tpm-filter__field::after {
  display: none;
}

.tpm-filter__row--3 .dropdown-label {
  display: block;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 15px;
  border-bottom: 1px solid #000;
  padding-bottom: 20px;
  color: black;
}

/* =====================================================
   CUSTOM SELECT
===================================================== */

.tpm-custom-select {
  position: relative;
}

.tpm-custom-select__trigger {
  position: relative;
  border: none;
  border-bottom: 1px solid #000;
  padding: 10px 30px 15px 0;
  font-size: 20px;
  font-weight: 500;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  min-height: 42px;
  padding-left: 6px;
  color: #000;
  cursor: pointer;
}

.tpm-custom-select__trigger::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-image: url("/wp-content/themes/myasthenie/assets/images/arrow-down.png");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.tpm-custom-select.is-open .tpm-custom-select__trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.tpm-custom-select__list {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  z-index: 100;
  display: none;
}

/* Ligne 1 : liste avec bordure et coins arrondis */
.tpm-filter__row--1 .tpm-custom-select__list {
  position: relative;
  border: 1px solid #000;
  border-top: none;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}

.tpm-custom-select.is-open .tpm-custom-select__list {
  display: block;
}

.tpm-custom-select__option {
  padding: 12px 20px;
  font-size: 16px;
  border-bottom: 1px solid #000;
  user-select: none;
  cursor: pointer;
}

.tpm-custom-select__option:last-child {
  border-bottom: none;
}

.tpm-custom-select__option:hover {
  color: #013c82;
  text-decoration: underline;
  background-color: transparent;
}

.tpm-custom-select__option.is-selected {
  background: #013c82;
  color: #fff;
}

.tpm-custom-select__option.is-selected:last-child {
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}

/* Supprimer flèche sur les champs theme/subtheme */
.tpm-filter__field--theme::after,
.tpm-filter__field--subtheme::after {
  display: none;
}

/* =====================================================
   CHIPS
===================================================== */

.tpm-chip__label {
  font-size: 13px;
  color: #013c82;
}

.tpm-chip__remove {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 6px;
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
  padding: 0;
  color: #013c82;
}

.tpm-filter__field--theme-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 15px;
  border: 1px solid #013c82;
  border-radius: 5px;
  padding: 5px;
  width: fit-content;
}

.tpm-subtheme-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 15px;
}

.tpm-filter__field--subtheme-chip {
  display: none;
  align-items: center;
  gap: 4px;
}

.tpm-filter__field--subtheme-chip.is-visible {
  display: inline-flex;
  gap: 6px;
  border: 1px solid #013c82;
  border-radius: 5px;
  padding: 5px;
  width: fit-content;
}

/* =====================================================
   PILLS (checkbox / radio)
===================================================== */

.tpm-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}

.tpm-checkbox-option input {
  display: none;
}

.tpm-checkbox-option span {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid #000;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s ease;
}

.tpm-checkbox-option span:hover {
  color: #013c82;
}

.tpm-checkbox-option input:checked + span {
  background: #013c82;
  border-color: #013c82;
  color: #fff;
}

/* =====================================================
   BOUTONS ACTIONS
===================================================== */

.tpm-filter__actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 20px;
}

.tmp-filter {
  background: #00AA01;
  color: #fff;
  border: 1px solid #00AA01;
  padding: 9px 25px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s ease;
}

.tmp-filter:hover {
  background: white;
  color: #000;
  border: 1px solid #000000;
}

.tmp-reset {
  background: transparent;
  color: #000;
  border: 1px solid #000;
  padding: 9px 25px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s ease;
}

.tmp-filter,
.tmp-reset {
  @media screen and (max-width: 480px) {
    width: 100%;
  }
}
.tmp-reset:hover {
  background: #000;
  color: #fff;
}

.tpm-filter__actions-total p {
  font-size: 14px;
  color: #4d4d4d;
}

.tpm-filter__actions-total p .count {
  font-size: 10px;
  padding: 3px 6px;
  background: #4d4d4d;
  color: #ffffff;
  border-radius: 30px;
}
/* =====================================================
   TOGGLE FILTRES AVANCÉS
===================================================== */

.tpm-toggle-advanced {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 0;
  font-family: math;
}

.tpm-toggle-advanced__label-more,
.tpm-toggle-advanced__label-less {
  font-size: 20px;
  font-family: sans-serif;
  font-weight: 500;
  letter-spacing: 1px;
  color: black;
}

.tpm-toggle-advanced::before {
  content: "+";
  width: 36px;
  height: 36px;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 3rem;
  transition: 0.3s ease;
  font-family: math;
}

.tpm-toggle-advanced.is-open::before {
  content: "−";
}

.tpm-toggle-advanced__label-less {
  display: none;
}

.tpm-toggle-advanced.is-open .tpm-toggle-advanced__label-more {
  display: none;
}
.tpm-toggle-advanced.is-open .tpm-toggle-advanced__label-less {
  display: inline;
}

/* =====================================================
   MASQUER LE COMPTEUR DANS LES LABELS
===================================================== */

.dropdown-label .dropdown-count,
.dropdown-label .count,
.dropdown-label span:last-child {
  display: none !important;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media screen and (max-width: 768px) {
  .tpm-filter__row--1 {
    flex-direction: column;
    gap: 25px;
  }

  .tpm-filter__row--1::after {
    display: none;
  }

  .tpm-filter__row--1 .tpm-filter__field {
    width: 90%;
    max-width: 100%;
  }

  .tpm-filter {
    display: flex;
    flex-direction: column;
  }

  .tpm-filter__row--1 {
    order: 0;
    margin-bottom: 10px;
  }

  .tpm-filter__row--2 {
    order: 1;
  }

  .tpm-filter__row--3 {
    order: 2;
  }

  /* Compteur */
  .tpm-filter__actions-total {
    order: 3;
  }

  .tpm-filter__actions {
    order: 4;
    margin-top: 2rem;
  }
}
