/* Documenthèque (page-71.php) — mobile d'abord */

.documentheque {
  --dt-vert: var(--primary, #017804);
  --dt-vert-clair: #e8f4e8;
  --dt-texte: #2b2b2b;
  --dt-texte-doux: #5c5c5c;
  --dt-bordure: #dfe3df;
  --dt-rayon: 12px;
  width: 100%;
  color: var(--dt-texte);
  text-align: left;
}

/* Le thème centre h2, h3, h4 et ul sous 992 px avec !important :
   une liste se lit mieux alignée à gauche */
.documentheque .dt-liste,
.documentheque .dt-titre {
  text-align: left !important;
}

/* Texte réservé aux lecteurs d'écran */
.documentheque .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Recherche et tri */
.dt-outils {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin: 8px 0 16px;
}

.dt-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dt-texte);
}

.dt-champ {
  position: relative;
}

.dt-champ .fa-search {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dt-texte-doux);
  pointer-events: none;
}

.dt-champ input,
.dt-tri select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--dt-bordure);
  border-radius: 999px;
  background: #fff;
  font-size: 1rem;
  color: var(--dt-texte);
}

.dt-champ input {
  padding: 0 16px 0 44px;
}

.dt-tri select {
  padding: 0 16px;
}

.dt-champ input:focus,
.dt-tri select:focus,
.dt-type:focus-visible,
.dt-btn:focus-visible {
  outline: 3px solid rgba(1, 120, 4, 0.35);
  outline-offset: 2px;
  border-color: var(--dt-vert);
}

.dt-bouton-recherche {
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--dt-vert);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Filtrage instantané avec JavaScript : bouton inutile */
.dt-outils.dt-js .dt-bouton-recherche {
  display: none;
}

/* Filtres par type : une rangée qui défile horizontalement sur mobile */
.dt-types {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 -16px 16px;
  padding: 2px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.dt-types::-webkit-scrollbar {
  display: none;
}

.dt-type {
  flex: none;
}

.dt-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--dt-bordure);
  border-radius: 999px;
  background: #fff;
  color: var(--dt-texte);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.dt-type:hover {
  border-color: var(--dt-vert);
  color: var(--dt-vert);
  text-decoration: none;
}

.dt-type[aria-current="true"] {
  background: var(--dt-vert);
  border-color: var(--dt-vert);
  color: #fff;
}

.dt-compte {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--dt-vert-clair);
  color: var(--dt-vert);
}

.dt-type[aria-current="true"] .dt-compte {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.dt-resultat {
  font-size: 0.9rem;
  color: var(--dt-texte-doux);
  margin: 0 0 8px;
}

/* Liste des documents */
.dt-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dt-bordure);
  border-radius: var(--dt-rayon);
  background: #fff;
  overflow: hidden;
}

.dt-doc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 14px;
  padding: 16px;
  border-bottom: 1px solid var(--dt-bordure);
}

.dt-doc:last-of-type {
  border-bottom: 0;
}

.dt-doc[hidden] {
  display: none;
}

.dt-icone {
  font-size: 1.6rem;
  color: #c0392b;
  line-height: 1;
  padding-top: 4px;
}

.dt-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef1f4;
  color: #3d4a57;
}

.dt-badge--decret { background: #e6f4ea; color: #1e6b34; }
.dt-badge--arrete { background: #fdf3dc; color: #7a5300; }
.dt-badge--loi { background: #e5f0fb; color: #1b4f86; }
.dt-badge--bulletin-information,
.dt-badge--bulletin-statistique { background: #f0ebfb; color: #55339a; }
.dt-badge--guide { background: #e2f5f3; color: #0f625a; }
.dt-badge--rap { background: #fbeaea; color: #8a2b2b; }
.dt-badge--curricula { background: #fdeee4; color: #8a3f12; }

.dt-titre {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 6px 0 4px;
  color: var(--dt-texte);
  overflow-wrap: anywhere;
}

.dt-details {
  font-size: 0.85rem;
  color: var(--dt-texte-doux);
  margin: 0;
}

/* Actions : sous le texte sur mobile */
.dt-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.dt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--dt-bordure);
  border-radius: 999px;
  background: #fff;
  color: var(--dt-texte);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.dt-btn:hover {
  border-color: var(--dt-vert);
  color: var(--dt-vert);
  text-decoration: none;
}

.dt-btn--principal {
  flex: 1;
  background: var(--dt-vert);
  border-color: var(--dt-vert);
  color: #fff;
}

.dt-btn--principal:hover {
  background: #015f03;
  color: #fff;
}

.dt-vide {
  text-align: center;
  padding: 40px 16px;
  border: 1px dashed var(--dt-bordure);
  border-radius: var(--dt-rayon);
  color: var(--dt-texte-doux);
}

.dt-vide p {
  margin-bottom: 12px;
}

/* Tablette et plus */
@media (min-width: 768px) {
  .dt-types {
    flex-wrap: wrap;
    margin: 0 0 16px;
    padding: 0;
    overflow: visible;
  }

  .dt-outils {
    grid-template-columns: minmax(0, 1fr) 220px auto;
  }

  .dt-outils.dt-js {
    grid-template-columns: minmax(0, 1fr) 220px;
  }

  .dt-doc {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 18px 20px;
  }

  .dt-actions {
    grid-column: auto;
  }

  .dt-btn--principal {
    flex: none;
  }

  /* Sur grand écran, « Télécharger » devient une icône seule (nom accessible conservé) */
  .dt-btn-texte {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .dt-btn:not(.dt-btn--principal) {
    width: 46px;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dt-type {
    transition: none;
  }
}

/* Pagination : styles du thème (classes h-3-em, primary-back…) ; seuls l'espacement,
   le masquage et le focus clavier sont ajoutés ici */
.dt-pagination {
  flex-wrap: wrap;
  row-gap: 8px;
  margin: 24px 0 8px;
}

.dt-pagination[hidden] {
  display: none !important;
}

.dt-pagination a:focus-visible {
  outline: 3px solid rgba(1, 120, 4, 0.35);
  outline-offset: 2px;
}

.dt-resultat:focus {
  outline: none;
}
