/* Styles pour les témoignages avec details/summary */
/* ========== CONTENEUR PRINCIPAL ========== */
.ff-container {
  width: 100%;
  margin: 10px auto 30px auto;
  display: block;
}

/* ========== LABELS DES FILTRES ========== */
.ff-container label {
  font-family: "roboto", "Arial Narrow", Arial, sans-serif;
  width: 19%;
  height: 30px;
  cursor: pointer;
  color: #777;
  line-height: 33px;
  font-size: 19px;
  display: inline-block;
  text-align: center;
  transition: all 0.3s ease;
}

/* Labels actifs */
.ff-container input.ff-selector-type-all:checked ~ label.ff-label-type-all,
.ff-container input.ff-selector-type-1:checked ~ label.ff-label-type-1,
.ff-container input.ff-selector-type-2:checked ~ label.ff-label-type-2,
.ff-container input.ff-selector-type-3:checked ~ label.ff-label-type-3,
.ff-container input.ff-selector-type-4:checked ~ label.ff-label-type-4,
.ff-container input.ff-selector-type-5:checked ~ label.ff-label-type-5,
.ff-container input.ff-selector-type-45:checked ~ label.ff-label-type-45 {
  background: #eee;
  color: #424d71;
  text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
}

/* Masquer les radio buttons */
.ff-container input {
  display: none;
}

/* ========== GRILLE DES TÉMOIGNAGES ========== */
.ff-items {
  position: relative;
  margin: 0 auto;
  padding-top: 20px;
  list-style: none;
}

.ff-items::after {
  content: "";
  display: table;
  clear: both;
}

/* ========== ITEM LI ========== */
.ff-items li {
  list-style-type: none;
  margin: 5px;
  float: left;
  width: 205px;
  height: 160px;
  transform: scale(1);
  transition: transform 0.3s linear;
}

/* ========== CARTE TÉMOIGNAGE ========== */
.temoin-card {
  display: block;
  position: relative;
  padding: 4px;
  background: #f9f9f9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  width: 185px;
  height: 145px;
  cursor: pointer;
}

.temoin-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info au survol */
.temoin-card .temoin-info {
  display: block;
  background: rgba(113, 113, 113, 0.9);
  font-style: italic;
  color: #fff;
  font-weight: bold;
  padding: 10px;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  overflow: hidden;
  opacity: 0;
  text-align: center;
  text-shadow: 1px 1px 1px #303857;
  transition: all 0.3s ease-out;
}

.temoin-card:hover .temoin-info {
  height: 110px;
  padding-top: 30px;
  opacity: 1;
}

/* ========== DIALOG POUR LES TÉMOIGNAGES ========== */
.temoin-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  max-width: 70vw;
  min-width: 40vw;
  background-color: var(--background-color);
  color: var(--texte-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  top: 30vh;
  left: 20vw;
}

.temoin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.temoin-dialog .dialog-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--texte-color);
  opacity: 0.6;
  transition: opacity 0.2s;
  z-index: 10;
  padding: 5px 10px;
  line-height: 1;
}

.temoin-dialog .dialog-close:hover {
  opacity: 1;
}

.temoin-dialog .temoin-texte {
  padding: 25px;
  font-style: italic;
  line-height: 1.6;
  position: relative;
}

.temoin-dialog .temoin-texte::before {
  content: '"';
  font-size: 3rem;
  opacity: 0.3;
  position: absolute;
  top: 5px;
  left: 15px;
  font-family: Georgia, serif;
}

.temoin-dialog .temoin-signature {
  display: block;
  margin-top: 1rem;
  text-align: right;
  font-style: normal;
  font-weight: bold;
  color: #aaa;
}

/* Animation d'ouverture du dialog */
.temoin-dialog[open] {
  animation: dialogOpen 0.3s ease forwards;
}

@keyframes dialogOpen {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== FILTRAGE CSS PUR ========== */
/* Afficher tous par défaut */
.ff-container input.ff-selector-type-all:checked ~ .ff-items-wrapper .ff-items li {
  transform: scale(1);
  animation: scaleUp 0.3s linear 0.1s forwards;
}

/* Filtrage par type */
.ff-container input.ff-selector-type-1:checked ~ .ff-items-wrapper .ff-items .ff-item-type-1,
.ff-container input.ff-selector-type-2:checked ~ .ff-items-wrapper .ff-items .ff-item-type-2,
.ff-container input.ff-selector-type-3:checked ~ .ff-items-wrapper .ff-items .ff-item-type-3,
.ff-container input.ff-selector-type-4:checked ~ .ff-items-wrapper .ff-items .ff-item-type-4,
.ff-container input.ff-selector-type-5:checked ~ .ff-items-wrapper .ff-items .ff-item-type-5 {
  opacity: 1;
  transform: scale(1.1);
  transition: transform 0.3s linear;
  animation: scaleUp 0.3s linear 0.4s forwards;
}

/* Masquer les autres */
.ff-container
  input.ff-selector-type-1:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-1),
.ff-container
  input.ff-selector-type-2:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-2),
.ff-container
  input.ff-selector-type-3:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-3),
.ff-container
  input.ff-selector-type-4:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-4),
.ff-container
  input.ff-selector-type-5:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-5) {
  transition:
    transform 0.3s linear,
    width 0s linear 0.3s;
  animation: scaleDown 0.3s linear forwards;
}

/* Conseil/Bilan = types 4 ET 5 */
.ff-container input.ff-selector-type-45:checked ~ .ff-items-wrapper .ff-items .ff-item-type-4,
.ff-container input.ff-selector-type-45:checked ~ .ff-items-wrapper .ff-items .ff-item-type-5 {
  opacity: 1;
  transform: scale(1.1);
  transition: transform 0.3s linear;
  animation: scaleUp 0.3s linear 0.4s forwards;
}

.ff-container
  input.ff-selector-type-45:checked
  ~ .ff-items-wrapper
  .ff-items
  li:not(.ff-item-type-4):not(.ff-item-type-5) {
  transition:
    transform 0.3s linear,
    width 0s linear 0.3s;
  animation: scaleDown 0.3s linear forwards;
}

/* ========== ANIMATIONS ========== */
@keyframes scaleUp {
  50% {
    width: 205px;
    transform: scale(0, 0);
  }
  100% {
    width: 205px;
    transform: scale(1, 1);
  }
}

@keyframes scaleDown {
  0% {
    width: 205px;
    transform: scale(1, 1);
  }
  99% {
    width: 205px;
    transform: scale(0, 0);
  }
  100% {
    width: 0px;
    height: 0;
    margin: 0;
    transform: scale(0, 0);
  }
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.ff-items-wrapper {
  position: relative;
  max-height: 500px; /* Ajuster selon la hauteur souhaitée pour ~50% */
  overflow: hidden;
  transition: max-height 0.6s ease-in-out;
}

/* État déplié */
.ff-items-wrapper.expanded {
  max-height: 5000px; /* Valeur suffisamment grande */
}

/* Dégradé en bas pour indiquer qu'il y a plus de contenu */
.ff-items-wrapper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--bg-color, #fff));
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ff-items-wrapper.expanded::after {
  opacity: 0;
}

/* Bouton Voir plus / Voir moins */
.btn-voir-plus {
  color: var(--white);
  display: inline-block;
  background-color: var(--orangealice);
  padding: 0.5em 1em;
  margin-left: 30vw;
  border: none;
}

.btn-voir-plus:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 4px var(--orangealice);
}

.btn-voir-plus:active {
  transform: translateY(0);
}

/* Icône flèche */
.btn-voir-plus::after {
  content: " ▼";
  font-size: 0.8em;
  transition: transform 0.3s ease;
  display: inline-block;
}

.btn-voir-plus.expanded::after {
  transform: rotate(180deg);
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  .ff-items-wrapper::after {
    background: linear-gradient(to bottom, transparent, var(--bg-color, #1a1a2e));
  }
}
