/* ============================================================
   0. VARIABLES GLOBALES (Couleurs et configuration)
   ============================================================ */
:root {
  /* Couleurs de l'interface */
  --dico-primary: #0073aa;
  --dico-bg-search: #cbe9ff;
  --dico-bg-hover: #edf3f8;
  --dico-btn-submit: #ff9a52;
  --dico-btn-submit-hover: #fa9044;
  --dico-text-dark: #2c3e50;
  --dico-text-muted: #666;
  --dico-border: #ddd;

  /* Couleurs des Typologies (Base) */
  --typo-definition: #4f7cfa;
  --typo-conjugaison: #bc90ff;
  --typo-etymologie: #fa8e03;
  --typo-genre: #f6a3e2;
  --typo-prononciation: #9dcb44;
  --typo-prononciation-bg: #d6f697;
  --typo-contraire: #ff5d5d;
  --typo-synonyme: #cb0670;
  --typo-orthographe: #61cd85;
  --typo-dossier: #009bdf;

  /* Couleurs des Typologies (Survol / Hover) */
  --typo-definition-hover: #0044cc;
  --typo-conjugaison-hover: #8a4fff;
  --typo-etymologie-hover: #c67102;
  --typo-genre-hover: #f26ecf;
  --typo-prononciation-hover: #87b133;
  --typo-contraire-hover: #d93636;
  --typo-synonyme-hover: #9a0555;
  --typo-orthographe-hover: #43a664;
  --typo-dossier-hover: #0384bc;
}

/* ============================================================
   1. CACHE ET UTILITAIRES
   ============================================================ */
.post-10434 .page-header {
  display: none;
}

.dico-waiting,
.no-results {
  color: var(--dico-text-muted);
  font-style: italic;
  padding: 0 0 20px 0;
}

.dico-waiting {
  display: none;
  visibility: hidden;
}

/* ============================================================
   2. BARRE DE RECHERCHE
   ============================================================ */
.dico-search-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: start;
  gap: 2rem;
  background: var(--dico-bg-search);
  padding: 20px;
  border-radius: 8px;
  align-items: end;
  margin: 1rem 0 3rem 0;
}

.dico-field {
  display: flex;
  position: relative;
  flex-direction: column;
  gap: 5px;
}

.dico-field label {
  font-weight: bold;
  font-size: 0.85rem;
}

.dico-actions {
  width: 13rem;
}

/* Conteneur des actions pour aligner les boutons horizontalement */
.dico-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style du bouton Reset circulaire */
.dico-reset-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background-color: #ffffff;
    color: #666;
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    padding: 0;
    flex-shrink: 0;/
}

.dico-reset-filters:hover,
.dico-reset-filters:focus {
    border-color: #ff4d4d;
    color: #ff4d4d;
    background-color: white;
    outline: none;
}

.dico-reset-filters:hover svg {
    transform: rotate(-180deg);
}

.dico-reset-filters svg {
    transition: transform 0.35s ease;
}

.dico-no-results-box {
    text-align: center;
    padding: 4rem 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ccc;
    margin: 20px 0;
}

.dico-reset-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #3E6AB1;
    font-family: "DM Sans", Sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-style: normal;
    text-decoration: none;
    color: white !important;
    border-style: none;
    border-radius: 35px 35px 35px 35px;
    line-height: 1;
    padding: 12px 24px;
    text-align: center;
    transition: all .3s;
}

.dico-reset-link-btn:hover {
    background-color: #307491;
}

/* ============================================================
   3. CHAMPS SELECT (Custom UI)
   ============================================================ */
.dico-field select {
  display: none !important;
}

.custom-select-trigger {
  background-color: #ffffff;
  color: var(--dico-primary);
  font-weight: bold;
  font-size: 0.95rem;
  padding: 12px 40px 12px 16px;
  margin-top: 0.2rem;
  border-radius: 99999px;
  border: none;
  width: 100%;
  min-width: 180px;
  cursor: pointer;
  text-align: left;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230073aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 18px;
  transition:
    background-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
}

.custom-select-trigger:hover {
  background-color: #fbfbfb;
}

#trigger-f_sujet {
  min-width: 22rem;
}
#trigger-f_annee,
#trigger-f_langue,
#trigger-f_theme {
  min-width: 13rem;
}

.custom-options {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  margin-top: 5px;
  max-height: 450px;
  overflow-y: auto;
}

.custom-options.open {
  display: block;
}

.custom-option {
  padding: 10px 16px;
  color: var(--dico-primary);
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
}

.custom-option:hover {
  background-color: var(--dico-bg-hover);
}
.custom-option.selected {
  background-color: var(--dico-primary);
  color: #fff;
}

.custom-option.disabled-option {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    color: #888;
    background-color: transparent;
}

.custom-option.disabled-option::after {
    content: " (0)";
    font-size: 0.85em;
    opacity: 0.7;
}

.custom-options::-webkit-scrollbar {
  width: 6px;
}
.custom-options::-webkit-scrollbar-thumb {
  background: var(--dico-primary);
  border-radius: 10px;
}

/* Styles Fallback (Select Natif si JS désactivé) */
.dico-field select:hover,
.dico-field select:focus {
  outline: none;
}

.dico-field select option {
  background-color: #ffffff;
  color: var(--dico-primary);
  font-weight: bold;
  padding: 10px;
}

.dico-field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f2f2f2;
  color: #888;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
.dico-field select::-ms-expand {
  display: none;
}

/* ============================================================
   4. BOUTON SOUMETTRE
   ============================================================ */
.dico-submit {
  background: var(--dico-btn-submit) !important;
  color: #fff !important;
  border: none !important;
  height: 51px !important;
  width: auto !important;
  min-width: 230px;
  border-radius: 25px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  padding: 0 25px !important;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  white-space: nowrap;
  box-shadow: none !important;
  flex-grow: 1;
}

.dico-submit:hover {
  background: var(--dico-btn-submit-hover) !important;
  transform: scale(1.02);
}
.dico-submit svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.dico-submit-text {
  line-height: 1;
}

/* ============================================================
   5. CONTENEUR DES RÉSULTATS ET GRILLE
   ============================================================ */
#dico-results-container {
  transition: opacity 0.25s ease;
  padding: 0 3rem 2rem 3rem;
}

.mots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
  margin: 1.2rem 0 4rem 0;
}

/* ============================================================
   6. CARTES DE MOTS
   ============================================================ */
.mot-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--dico-border);
  margin: 0;
  border-radius: 20px;
  min-height: 280px;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    transform 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
}

.mot-card:hover {
  transform: translateY(-3px) scale(1.01); /* Amélioration subtile du hover */
  box-shadow: 0 6px 16px rgba(25, 24, 24, 0.12);
}

.mot-card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.mot-card-header {
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
  padding: 2.2rem;
  text-align: center;
  letter-spacing: 1px;
  align-content: center;
}

.mot-card-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mot-title {
  font-size: 2.2rem !important;
  font-weight: 800;
  margin: 0;
  padding: 0 5px;
  color: var(--dico-text-dark);
  text-align: center;
  transition: all 0.3s ease-in-out;
  display: block;
}

/* ============================================================
   7. COULEURS DYNAMIQUES DES CARTES (Background & Texte)
   ============================================================ */
/* Fonds des Headers */
.mot-card .mot-card-header-definition {
  background: var(--typo-definition);
}
.mot-card .mot-card-header-conjugaison {
  background: var(--typo-conjugaison);
}
.mot-card .mot-card-header-etymologie {
  background: var(--typo-etymologie);
}
.mot-card .mot-card-header-genre {
  background: var(--typo-genre);
}
.mot-card .mot-card-header-contraire {
  background: var(--typo-contraire);
}
.mot-card .mot-card-header-synonyme {
  background: var(--typo-synonyme);
}
.mot-card .mot-card-header-orthographe {
  background: var(--typo-orthographe);
}
.mot-card .mot-card-header-dossier {
  background: var(--typo-dossier);
}

.mot-card .mot-card-header-prononciation {
  background: var(--typo-prononciation-bg);
  color: #000000;
}

/* Couleurs des Titres */
.mot-title-definition {
  color: var(--typo-definition);
}
.mot-title-conjugaison {
  color: var(--typo-conjugaison);
}
.mot-title-etymologie {
  color: var(--typo-etymologie);
}
.mot-title-genre {
  color: var(--typo-genre);
}
.mot-title-prononciation {
  color: var(--typo-prononciation);
}
.mot-title-contraire {
  color: var(--typo-contraire);
}
.mot-title-synonyme {
  color: var(--typo-synonyme);
}
.mot-title-orthographe {
  color: var(--typo-orthographe);
}
.mot-title-dossier {
  color: var(--typo-dossier);
}

/* Couleurs des Titres au Survol (Hover) */
.mot-card:hover .mot-title-definition {
  color: var(--typo-definition-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-conjugaison {
  color: var(--typo-conjugaison-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-etymologie {
  color: var(--typo-etymologie-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-genre {
  color: var(--typo-genre-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-prononciation {
  color: var(--typo-prononciation-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-contraire {
  color: var(--typo-contraire-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-synonyme {
  color: var(--typo-synonyme-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-orthographe {
  color: var(--typo-orthographe-hover);
  transform: scale(1.05);
}
.mot-card:hover .mot-title-dossier {
  color: var(--typo-dossier-hover);
  transform: scale(1.05);
}

/* ============================================================
   8. PAGINATION
   ============================================================ */
.dico-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 3rem 0;
}

.dico-page-btn,
.dico-page-info {
  color: var(--dico-primary);
  border: none;
  padding: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.4rem;
}

.dico-page-info.current {
  cursor: default;
}

/* ============================================================
   9. SKELETON SCREEN (Chargement)
   ============================================================ */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  background: #f6f7f8;
  border: 1px solid #eee;
  border-radius: 20px;
  min-height: 280px;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

.skeleton-header {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 5rem;
  background: rgb(203, 201, 201);
}

.skeleton-body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
}

.skeleton-title {
  width: 140px;
  height: 30px;
  background: #e2e5e7;
  border-radius: 10px;
}

/* ============================================================
   10. RESPONSIVE
   ============================================================ */

/* GRANDS ÉCRANS PAYSAGE (1200px - 1400px) */
@media (max-width: 1400px) {
  #dico-results-container {
    padding: 0 4rem;
  }
  .dico-search-form {
    gap: 1.5rem;
  }
  #trigger-f_sujet {
    min-width: 16rem;
  }
  .mots-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* ORDINATEUR PORTABLE & TABLETTE PAYSAGE (< 1024px) */
@media (max-width: 1024px) {
  #dico-results-container {
    padding: 0 2rem;
  }
  .mots-grid {
    grid-template-columns: repeat(2, 1fr); /* La grille passe en 2 colonnes fluidement */
    gap: 2rem;
  }
  .mot-card-header {
    padding: 1.8rem;
    font-size: 1.6rem;
  }
  .mot-title {
    font-size: 1.9rem !important;
  }
}

/* MOBILE ÉLARGI & TABLETTE PORTRAIT (< 768px) */
@media (max-width: 768px) {
  #dico-results-container {
    padding: 0 1.5rem;
  }
  .dico-search-form {
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
  }
  .dico-field,
  .dico-actions {
    width: 100%;
  }
  #trigger-f_sujet,
  #trigger-f_annee,
  #trigger-f_langue,
  #trigger-f_theme{
    min-width: 100% !important;
    width: 100% !important;
  }

  .dico-submit {
    min-width: 90% !important;
    width: 90% !important;
  }

  .mots-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
  .mot-card {
    min-height: 240px;
  }
  .mot-card-header {
    padding: 1.2rem;
    font-size: 1.3rem;
  }
  .mot-title {
    font-size: 1.5rem !important;
  }
}

/* PETIT MOBILE (< 600px) */
@media (max-width: 600px) {
  #dico-results-container {
    padding: 0 1rem;
  }
  .dico-field {
    width: 100%;
  }

  .mots-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .mot-card {
    min-height: 200px;
  }
  .mot-card-header {
    padding: 1.5rem;
    font-size: 1.5rem;
  }
  .mot-title {
    font-size: 1.8rem !important;
  }
}

/* ============================================================
    PAGE FICHE MOT
============================================================ */

/* ============================================================
   1. COMPOSANT : BLOC TYPO (POSITIONNEMENT ET STYLE)
============================================================ */

.bloc-typo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  padding: 2rem 3rem;
  border-radius: 0 44px 0 0;
  position: absolute;
  top: 23.5rem; /* Conservation de la dernière définition */
  z-index: 2;
  font-size: 2.5rem;
  width: 28rem;
  font-weight: 700;
}

/* Couleurs de fond dynamiques (Slug) */
.bloc-typo-definition {
  background-color: #4f7cfa;
}
.bloc-typo-etymologie {
  background-color: #fa8e03;
}
.bloc-typo-conjugaison {
  background-color: #bc90ff;
}
.bloc-typo-genre {
  background-color: #f6a3e2;
}
.bloc-typo-orthographe {
  background-color: #61cd85;
}
.bloc-typo-synonyme {
  background-color: #cb0670;
}
.bloc-typo-contraire {
  background-color: #ff5d5d;
}
.bloc-typo-dossier {
  background-color: #009bdf;
}

/* Couleurs des liens dans le Bloc Typo */
.bloc-typo-definition a {
  color: #4f7cfa !important;
}
.bloc-typo-conjugaison a {
  color: #bc90ff !important;
}
.bloc-typo-etymologie a {
  color: #fa8e03 !important;
}
.bloc-typo-genre a {
  color: #f6a3e2 !important;
}
.bloc-typo-prononciation a {
  color: #d6f697 !important;
}
.bloc-typo-contraire a {
  color: #ff5d5d !important;
}
.bloc-typo-synonyme a {
  color: #cb0670 !important;
}
.bloc-typo-orthographe a {
  color: #61cd85 !important;
}
.bloc-typo-dossier a {
  color: #009bdf !important;
}

/* ============================================================
   3. COMPOSANT : MOT CARD HEADER (GRILLE / LISTE)
   ============================================================ */

.mot-card-header-definition a {
  color: #4f7cfa !important;
}
.mot-card-header-conjugaison a {
  color: #bc90ff !important;
}
.mot-card-header-etymologie a {
  color: #fa8e03 !important;
}
.mot-card-headero-genre a {
  color: #f6a3e2 !important;
} /* Typo d'origine conservée */
.mot-card-header-prononciation a {
  color: #9dcb44 !important;
}
.mot-card-header-contraire a {
  color: #ff5d5d !important;
}
.mot-card-header-synonyme a {
  color: #cb0670 !important;
}
.mot-card-header-orthographe a {
  color: #61cd85 !important;
}
.mot-card-header-dossier a {
  color: #009bdf !important;
}

.typo-fiche-mot {
  transition: color 0.2s ease-in-out;
}

.mot-card-header-definition a:hover {
  color: var(--typo-definition-hover) !important;
}
.mot-card-header-conjugaison a:hover {
  color: var(--typo-conjugaison-hover) !important;
}
.mot-card-header-etymologie a:hover {
  color: var(--typo-etymologie-hover) !important;
}
.mot-card-header-genre a:hover {
  color: var(--typo-genre-hover) !important;
}
.mot-card-header-prononciation a:hover {
  color: var(--typo-prononciation-hover) !important;
}
.mot-card-header-contraire a:hover {
  color: var(--typo-contraire-hover) !important;
}
.mot-card-header-synonyme a:hover {
  color: var(--typo-synonyme-hover) !important;
}
.mot-card-header-orthographe a:hover {
  color: var(--typo-orthographe-hover) !important;
}
.mot-card-header-dossier a:hover {
  color: var(--typo-dossier-hover) !important;
}

.typo-link {
  font-weight: 700;
  font-size: 2rem;
}

/* ============================================================
   4. TITRES ET SECTIONS DU CONTENU
   ============================================================ */

.dico-titre-unique {
  color: #507bc1;
  font-size: 2.9rem !important;
  margin-bottom: 20px;
}

.dico-titre-secondaire {
  color: #000000;
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 2rem;
  margin-bottom: 15px;
  margin-left: 2rem;
  background: white;
  padding: 0.5rem 1.3rem;
  border: 1px solid #507ac2;
  border-radius: 16px;
  width: fit-content;
}

/* ============================================================
   5. STRUCTURE DES PARAGRAPHES
   ============================================================ */

.dico-bloc-paragraphe {
  position: relative;
}

/* Espacement entre paragraphes avec titres */
.dico-bloc-paragraphe:has(h3) ~ .dico-bloc-paragraphe:has(h3) {
  margin-top: 3.5rem;
}

/* Background décoratif des sections h3 */
.dico-bloc-paragraphe:has(h3)::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 0;
  width: 100%;
  height: 100%;
  background: #eef8ff;
  z-index: -1;
  border-radius: 16px;
}

.dico-paragraphe-contenu {
  margin: 0;
  padding-top: 0.6rem;
  line-height: 1.7;
  font-size: 1.1rem;
  color: #000;
}

/* Marges spécifiques pour le contenu sous h3 */
.dico-bloc-paragraphe:has(h3) .dico-paragraphe-contenu {
  margin: 0 3rem 2rem 3rem;
}

.dico-bloc-paragraphe:has(h3) ul,
.dico-bloc-paragraphe:has(h3) ol {
  margin: 0 4rem 2rem 1rem;
  padding: 0;
}

/* ============================================================
   6. STYLE DES BALISES SPÉCIFIQUES (AUTONYME, EXEMPLE, LIENS)
   ============================================================ */

.dico-autonyme {
  font-weight: 700;
  font-style: italic !important;
}

.dico-exemple {
  font-style: italic;
}

/* Liens dans le contenu */
.dico-paragraphe-contenu a {
  color: #009bdf;
  text-decoration: none;
  transition: opacity 0.2s;
}

.dico-paragraphe-contenu a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================================================
   7. RESPONSIVE MOBILE
   ============================================================ */

@media (max-width: 768px) {
  .bloc-typo {
    top: 15rem;
    width: 80%;
    font-size: 1.6rem;
    padding: 1rem 1.5rem;
    border-radius: 0 25px 0 0;
  }

  .dico-titre-unique {
    font-size: 2rem !important;
  }

  .dico-titre-secondaire {
    margin-left: 0;
    font-size: 1.2rem;
  }

  .dico-bloc-paragraphe:has(h3) .dico-paragraphe-contenu {
    margin-left: 1rem;
  }

  .dico-bloc-paragraphe:has(h3) ol {
    margin-left: 2rem;
    padding: 0;
  }
}
