/* --- Structure globale du formulaire --- */
/* #formulary-wrapper {
} */

@page {
  @bottom-left {
    border-top: 1px solid rgb(200, 200, 200);
    content: "";
    vertical-align: top;
    padding-top: 12px;
    padding-right: 8px;
  }
  @bottom-center {
    color: rgb(193, 193, 193);
    border-top: 1px solid rgb(200, 200, 200);
    content: "Josselin DOUINEAU - demonstrations-mathematiques.com";
    vertical-align: top;
    padding-top: 12px;
    padding-right: 8px;
  }
}

h1 {
  counter-reset: unset;
  text-align: center;
}
h2 {
  counter-reset: ol1Item olaItem olaItemBis propsCount subFamilyCount !important;
}

.formulary-content {
  margin: 0 20px;
}

.formulary-section {
  margin-bottom: 50px;
  padding-bottom: 20px;
}

/* --- Filtres - Version Bureau (> 768px) --- */
.filters-container {
  position: fixed;
  top: 200px; /* Ajuste selon ton header */
  left: 20px;
  height: fit-content;
  width: 120px;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid silver;
}

.filters-popup-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filters-popup-content div {
  margin-top: 0;
  font-size: 1.2rem;
}

.filters-popup-content label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;

  span {
    vertical-align: top;
  }
}

.mobile-only {
  display: none;
}

/* --- Filtres - Version Mobile (< 768px) --- */
@media screen and (max-width: 768px) {
  #formulary-wrapper {
    flex-direction: column;
  }

  .filters-container {
    position: sticky;
    top: 44px;
    z-index: 20;
    width: 100%;
    background: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
    text-align: center;
    border: none;
    & button {
      margin-left: auto;
      margin-right: auto;
    }
  }

  .mobile-only {
    display: block;
  }

  #toggle-filters {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
  }

  .filters-popup-content {
    display: none; /* Caché par défaut sur mobile */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--back);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    width: 80%;
    max-width: 300px;
  }

  .filters-popup-content.active {
    display: flex;
  }

  #close-filters {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
  }

  /* Overlay sombre derrière le popup */
  .filters-popup-content.active::before {
    content: "";
    position: fixed;
    top: -500vh;
    left: -500vw;
    right: -500vw;
    bottom: -500vh;
    background: rgba(0, 0, 0, 0.22);
    z-index: -1;
  }
}

/* --- Indicateur de section active en bas à droite --- */
#current-section-indicator {
  position: fixed;
  bottom: 120px;
  right: 30px;
  background: linear-gradient(115deg, #407a56, #22633b, #124525);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 1000;

  /* Animation d'apparition */
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

  /* Permet de cliquer "à travers" au cas où ça masquerait un élément de la page */
  pointer-events: none;
}

.dark {
  #current-section-indicator {
    background: linear-gradient(115deg, #407a56, #22633b, #124525);
  }
}
/* Classe ajoutée par le JS pour l'afficher */
#current-section-indicator.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Masquer complètement sur les petits écrans */
@media screen and (max-width: 768px) {
  #current-section-indicator {
    display: none !important;
  }
}

/* Préparation du rayon de lumière pour l'indicateur */
#current-section-indicator {
  /* ... tes autres propriétés ... */
  overflow: hidden; /* Pour que la lumière ne dépasse pas les bords arrondis */
}

#current-section-indicator::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg); /* Incline légèrement le rayon pour plus de dynamisme */
  pointer-events: none;
}

/* L'animation qui fait traverser la lumière */
@keyframes sweep-light-indicator {
  0% {
    left: -150%;
  }
  100% {
    left: 200%;
  }
}

/* La classe que le JS va ajouter/retirer pour déclencher l'effet */
.flash-effect::after {
  animation: sweep-light-indicator 0.6s ease-out;
}
