/* 🌐 GLOBAL */

/* ✅ Affichage dynamique de complétion */
/* 📂 Toggle panneau édition */
/* 🖊️ Champs éditables */
/* 🖼️ Image modifiable */
/* 🔗 Liens */
/* 🖊️ Champs de saisie */
/* 🎯 Compteur de caractères – position fixe sous input */
/* 🎯 Bouton ✏️ Édition de contenu */
/* 💾 Boutons édition : enregistrer / annuler */
/* ✔️ Animation de confirmation */
/* 📅 Champs dates — affichage et comportement */

/* 📱 Responsive global */


/* 🧭 HEADER */

/* 📱 Responsive header */


/* 🪟 PANNEAU D’ÉDITION GLOBAL */

/* 🧱 Structure */
/* 🔤 Typographie */
/* 🧪 Placeholder */
/* ✏️ Champs particuliers */
/* 📱 Responsive panneau édition */


/* 🧭 PANNEAU LATÉRAL */



/* ==================================================
   🌐 GLOBAL
   ================================================== */


/* ========== ✅ AFFICHAGE DYNAMIQUE DE COMPLÉTION ========== */

.resume-infos .icon-attente,
.resume-infos .icone-check {
  display: inline-block;
  margin-right: 0.3rem;
}

.resume-infos .champ-rempli .icon-attente {
  display: none !important;
}

.resume-infos .icon-attente {
  color: var(--color-editor-error);
}

.resume-infos .icone-check {
  color: var(--color-editor-success);
}

.cache {
  display: none;
}

/* ========== 🖊️ CHAMPS ÉDITABLES ========== */

.champ-edition {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-top: 1rem;
}

.champ-organisateur.champ-vide {
  border: 1px dashed var(--color-border-header-organisateur);
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 0.5rem;
  padding: 0.3rem 0.5rem;
  opacity: 0;
  transition: all 0.3s ease;
}

body.edition-active .champ-organisateur.champ-vide {
  opacity: 0.7;
}

body.edition-active .champ-organisateur.champ-vide:hover {
  background-color: rgba(255, 255, 255, 0.04);
  opacity: 1;
  cursor: pointer;
}

.champ-vide-obligatoire {
  border: 2px dashed var(--color-editor-error);
  animation: clignoteTitre 1s infinite alternate;
}

@keyframes clignoteTitre {
  0% {
    box-shadow: 0 0 0px var(--color-editor-error);
  }

  100% {
    box-shadow: 0 0 8px var(--color-editor-error);
  }
}

body.edition-active .champ-organisateur[data-champ],
body.edition-active-chasse .champ-chasse[data-champ],
body.edition-active-enigme .champ-enigme[data-champ] {
  cursor: pointer;
}

body.edition-active .resume-infos li,
body.edition-active-chasse .resume-infos li,
body.edition-active-enigme .resume-infos li {
  cursor: pointer;
}


/* ========== 📂 Toggle panneau édition ========== */
section.enigme-wrapper {
  position: relative;
}

.bouton-edition-toggle {
  border: 1px solid;
}


/* ========== 🖼️ IMAGE MODIFIABLE ========== */
body:not(.edition-active-chasse) .chasse-fiche-container .champ-img .champ-modifier .icone-modif,
body:not(.edition-active) .header-organisateur .champ-img .champ-modifier .icone-modif {
  display: none !important;
}

body:not(.edition-active-chasse) .chasse-fiche-container .champ-img .champ-modifier,
body:not(.edition-active) .header-organisateur .champ-img .champ-modifier {
  opacity: 1 !important;
  filter: none !important;
  pointer-events: none;
  /* empêche les clics accidentels */
}

body.edition-active-chasse .chasse-fiche-container .champ-img .champ-modifier,
body.edition-active .header-organisateur .champ-img .champ-modifier,
body.edition-active-enigme .single-enigme-main .champ-img .champ-modifier {
  transform: translateY(0);
}

.media-modal.wp-core-ui button.media-modal-close:hover {
  color: white !important;
}

/* ========== 🖼 LOGO CLIQUABLE ========== */

body .header-img-modifiable {
  position: relative;
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transform: translateY(0%);
  opacity: 1;
}

body .header-img-modifiable .icone-modif {
  display: none;
}

.header-img-modifiable img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.header-img-modifiable .icone-modif {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  font-size: 1rem;
  color: var(--color-secondary);
  background-color: rgba(0, 0, 0, 0.6);
  padding: 0.2rem 0.3rem;
  border-radius: 0.3rem;
  transition: transform 0.2s;
}

.header-img-modifiable:hover .icone-modif {
  transform: scale(1.1);
}


/* ========== 🔗 LIENS ========== */

.champ-liens .champ-affichage-liens {
  display: flex;
  align-items: center;
}

.liens-placeholder {
  text-align: center;
}

.liens-placeholder-message {
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.5rem;
  opacity: 0.7;
}


/* ========== 🖊️ CHAMPS DE SAISIE ========== */

.champ-edition .champ-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.edition-panel-body input.champ-input,
.edition-panel-body input[type="date"] {
  background-color: white;
  border: 1px solid var(--color-editor-border);
  color: var(--color-editor-text);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 1.1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, background-color 0.2s;
}

.champ-edition input.champ-input::placeholder {
  color: var(--color-editor-placeholder);
}

.champ-edition input.champ-input:focus {
  outline: none;
  border-color: var(--color-editor-accent);
  background-color: var(--color-editor-field-hover);
}

/* ========== 🎯 COMPTEUR DE CARACTÈRES – POSITION FIXE SOUS INPUT ========== */

.champ-edition .champ-compteur,
.champ-edition .champ-instructions {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  opacity: 0.7;
  color: var(--color-editor-placeholder);
  text-align: left;
}

/* ========== 🎯 BOUTON ✏️ ÉDITION DE CONTENU ========== */


/* Boutons d’édition */
body.edition-active-chasse .page-chasse-wrapper .champ-modifier,
body.edition-active .header-organisateur-wrapper .champ-modifier,
body.edition-active .edition-panel-organisateur .champ-modifier,
body.edition-active-enigme .single-enigme-main .champ-modifier {
  background: none;
  border: none;
  color: var(--color-secondary);
  font-size: 0.9rem;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  transform: translateY(-50%);
  pointer-events: auto;
  display: inline-flex;
}

/* Harmonisation de l'alignement pour le champ sous-titre dans le panneau Énigme */
.single-enigme-main [data-champ="enigme_visuel_legende"] {
  display: inline-flex;
  align-items: center;
}

.single-enigme-main [data-champ="enigme_visuel_legende"] .champ-affichage {
  padding-left: 5px;
}

body.edition-active-enigme .single-enigme-main .champ-modifier .icone-modif {
  display: unset;
}

body.edition-active-chasse .champ-modifier:hover,
.edition-active .header-organisateur-wrapper .champ-modifier:hover {
  opacity: 1;
}

body.edition-active-chasse .champ-modifier:focus,
body.edition-active .header-organisateur-wrapper .champ-modifier:focus {
  outline: 2px solid var(--color-editor-accent);
  outline-offset: 2px;
}


/* ========== 💾 BOUTONS ÉDITION : ENREGISTRER / ANNULER ========== */

.champ-organisateur .champ-enregistrer,
.champ-organisateur .champ-annuler {
  border: none;
  background-color: var(--color-action);
  color: white;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

.champ-organisateur .champ-enregistrer:hover,
.champ-organisateur .champ-annuler:hover {
  opacity: 1;
}

.champ-edition .champ-enregistrer {
  background-color: var(--color-editor-success);
}

.champ-edition .champ-annuler {
  background-color: var(--color-editor-error);
}

.champ-edition .champ-inline-actions {
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  gap: 0 1rem;
}

.champ-edition .champ-inline-actions {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}



/* ========== ✔️ ANIMATION DE CONFIRMATION ========== */

.champ-feedback.champ-confirmation {
  color: var(--color-editor-success);
  opacity: 1;
  transition: opacity 0.5s ease;
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

.champ-feedback.champ-confirmation.fade-out {
  opacity: 0;
}

/* ========== 📅 CHAMPS DATES — AFFICHAGE ET COMPORTEMENT ========== */
input[type=date].champ-date-edit,
input[type=datetime-local].champ-date-edit {
  width: auto;
}

input[disabled].champ-inline-date,
input[disabled].champ-inline-nb,
input[disabled].champ-cout {
  background-color: var(--color-editor-background);
  /* Fond gris clair neutre */
  border: 1px solid var(--color-editor-border);
  /* Bordure standard */
  color: var(--color-editor-placeholder);
  /* Texte grisé façon placeholder */
  cursor: not-allowed;
  opacity: 1;
  /* Important pour ne pas rendre semi-transparent */
}

/* Styles communs pour les champs verrouillés */
.champ-desactive label {
  color: var(--color-editor-placeholder);
  font-style: italic;
}

.champ-desactive .champ-modifier {
  display: none !important;
}

.edition-panel-section .champ-option-illimitee {
  display: inline-block;
  margin-left: 1rem;
}

/* ========== 📱 RESPONSIVE GLOBAL ========== */

/* Empilage à partir de tablette */
@media (max-width: 768px) {
  .edition-panel-body {
    flex-direction: column;
  }
}



/* ==================================================
   🧭 HEADER
   ================================================== */

/* PARAMETRES EN HAUT À DROITE DU HEADER */
.header-actions-droite {
  top: 1.2rem;
  right: 0.5rem;
  position: absolute;
}

.header-coordonnees.champ-vide {
  border: 1px dashed var(--color-border-header-organisateur);
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--color-secondary);
  opacity: 0.85;
  transition: all 0.3s ease;
}

.header-coordonnees.champ-vide:hover {
  background-color: rgba(255, 255, 255, 0.06);
  opacity: 1;
}


/* ========== 🔠 TITRE ========== */
.champ-txt-editable {
  margin-right: 125px;
}

.champ-txt-editable .champ-affichage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.champ-txt-editable.champ-titre .champ-edition {
  padding-right: 60px;
}


/* ========== 📱 RESPONSIVE HEADER ========== */

/* Empilage à partir de tablette */
@media (max-width: 768px) {
  .edition-panel-body {
    flex-direction: column;
  }
}



/* ==================================================
   🪟 PANNEAU D’ÉDITION GLOBAL
   ================================================== */

/* ========== 🧱 STRUCTURE ========== */

.edition-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(-10px);
  border: 0;
  pointer-events: none;
}

body.edition-active .panneau-organisateur,
body.edition-active-chasse .edition-panel-chasse,
body.edition-active-enigme .edition-panel-enigme {
  height: 90vh;
  max-height: 90vh;
  opacity: 1;
  transform: translateY(0);
  background-color: var(--color-editor-background);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 1rem;
  pointer-events: auto;
  border-bottom: 1px solid var(--color-editor-border);
  overflow-y: auto;
}

body.edition-active .panneau-organisateur.edition-panel-modal,
body.edition-active-chasse .edition-panel-chasse.edition-panel-modal,
body.edition-active-enigme .edition-panel-enigme.edition-panel-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 90vh;
  max-height: 90vh;
  border-radius: 8px;
  z-index: 10000;
}

.edition-panel > .edition-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-editor-border);
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  background-color: var(--color-editor-background);
  z-index: 10;
}

.edition-panel .panneau-fermer {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-editor-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s ease;
  opacity: 0.75;
}

.edition-panel .panneau-fermer:hover {
  opacity: 1;
}

.edition-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 2rem;
  height: auto;
  min-height: 300px;
  box-sizing: border-box;
}

.edition-panel-section {
  display: flex;
  flex-direction: column;
  /* ✅ affichage en colonne par défaut */
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--color-editor-border);
  padding: 1rem;
  border-radius: 8px;
  color: var(--color-editor-text-muted);
}

.edition-panel-section .resume-technique {
  width: 100%;
}

.edition-panel-section .resume-technique label {
  display: inline-block;
  min-width: 150px;
}

.edition-panel-section .resume-technique input.inline-date,
.edition-panel-section .resume-technique input.champ-cout,
.edition-panel-section .resume-technique input.champ-nb-edit {
  width: 180px;
}

.edition-panel-section .resume-technique .champ-select-heure {
  width: auto;
}

/* ========== 🔤 TYPOGRAPHIE ========== */

body.edition-active .edition-panel {
  color: var(--color-editor-text);
}

.edition-panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-editor-heading);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edition-panel h3 {
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-editor-heading);
  /* ou une variable spécifique si besoin */
  margin-top: 0;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.edition-panel button {
  color: var(--color-editor-text);
  opacity: 0.75;
  box-shadow: none;
}

.edition-panel button:focus,
.edition-panel button:hover {
  opacity: 1;
  background: none;
}

.mce-menu .mce-container-body {
  color: var(--color-editor-text);
}

.mce-btn.mce-active button,
.mce-btn.mce-active:hover button,
.mce-btn.mce-active i,
.mce-btn.mce-active:hover i,
.mce-container,
.mce-container *,
.mce-widget,
.mce-widget * {
  color: var(--color-editor-text) !important;
}

.edition-panel label {
  color: var(--color-editor-text-muted);
  font-size: 16px;
}

/* ========== 🧪 PLACEHOLDER ========== */

.edition-placeholder {
  border: 1px dashed var(--color-editor-border);
  background-color: var(--color-editor-background);
  font-size: 0.95rem;
  color: var(--color-editor-text-muted);
}

.info-a-suivre {
  margin-top: 0.75rem;
  font-style: italic;
  color: var(--color-editor-text-muted);
}



/* ========== ✏️ CHAMPS PARTICULIERS ========== */

.champ-enigme.champ-texte[data-champ="enigme_visuel_legende"] {
  display: flex;
  align-items: center;
}
.champ-enigme.champ-texte[data-champ="enigme_visuel_legende"] i.fa-circle {
  margin-right: 10px;
}

li.ligne-email .champ-organisateur.champ-vide,
li.ligne-coordonnees.champ-organisateur.champ-vide,
li.ligne-logo.champ-organisateur.champ-vide {
  border: 0;
  background-color: transparent;
  border-radius: 0;
  padding: 0;
  opacity: 1;
}

li.ligne-email,
li.ligne-logo,
li.champ-titre {
  display: flex;
  align-items: start;
  gap: 0.5rem;
  align-items: center ;
}

li.ligne-logo .champ-modifier {
  margin-top: 0.5rem;
  margin-left: -0.5rem;
}

li.ligne-email i.fa-envelope {
  opacity: 0.6;
  margin-top: 6px;
}

li.ligne-email .champ-organisateur .champ-affichage {
  justify-content: start;
  text-align: unset;
}

/* Champs délai et heure de solution en ligne */
.champ-solution-timing {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.champ-solution-timing .champ-delai-inline {
  width: 60px;
  text-align: center;
}

.champ-solution-timing .champ-select-heure {
  width: auto;
}

.champ-solution-timing span {
  white-space: nowrap;
  color: var(--color-editor-text-muted);
}

.edition-panel-section .champ-badge-cout {
  margin: 0 1rem;
}

.edition-panel-section .resume-technique .champ-cout-points .champ-edition {
  gap: 0 5px;
}

.edition-panel-section .resume-technique li {
  margin-bottom: 0.9rem;
}


/* ========== 📱 RESPONSIVE PANNEAU EDITION ========== */
@media (max-width: 768px) {
  .edition-panel-body {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .edition-panel-body {
    flex-direction: column;
  }
}

/* ==================================================
    🧭 PANNEAU LATÉRAL 
   -------------------------------------------------- */

/* 🧭 Panneau latéral – animation et position */
.panneau-lateral-liens {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 420px;
  background-color: var(--color-editor-background);
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  overflow-y: auto;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
  border: 1px solid var(--color-editor-border);
  border-radius: 8px;
  color: var(--color-editor-text);
}

.panneau-lateral-liens.ouvert {
  transform: translateX(0%);
  opacity: 1;
  pointer-events: auto;
}

body.panneau-ouvert::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
}


.panneau-lateral__contenu {
  padding: 2rem 2rem 2rem 2.5rem;
}

/* Alignement commun des headers dans les panneaux */
.panneau-lateral__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-editor-border);
  position: sticky;
  top: 0;
  background-color: var(--color-editor-background);
  z-index: 10;
}

.panneau-lateral__header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-editor-heading);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.panneau-lateral-liens.ouvert .panneau-lateral__header h2 {
  opacity: 1;
  transform: translateY(0);
}

/* 🧭 Bouton de fermeture */
.panneau-fermer {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-editor-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s ease;
  opacity: 0.75;
}

.panneau-fermer:hover {
  opacity: 1;
}

/* 🧭 Liste sans puces */
.liste-liens-formulaires {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 🧭 Affichage propre des labels */
#panneau-recompense-chasse label {
  margin-bottom: -13px;
}

.panneau-lateral__contenu label {
  font-size: unset;
  color: var(--color-editor-text-muted);
}

.ligne-lien-formulaire label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--color-editor-text);
}

.ligne-lien-formulaire label::before {
  display: none;
}


/* 🧭 Espacement des champs */
.ligne-lien-formulaire {
  margin-bottom: 1.5rem;
}

/* 🧭 Champ input */
.ligne-lien-formulaire input[type="url"] {
  width: 100%;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background-color: white;
  color: var(--color-editor-text);
  box-sizing: border-box;
}

/* 🧭 Bouton enregistrer */
.panneau-lateral__actions {
  margin-top: 2rem;
}

.bouton-enregistrer-liens {
  background-color: var(--color-editor-success);
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  font-weight: bold;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.bouton-enregistrer-liens:hover {
  background-color: var(--color-editor-success-hover);
}

.zone-chasses,
.bloc-presentation-organisateur {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.panneau-lateral-large {
  width: 100%;
  max-width: 1000px;
}

.zone-chasses.masque,
.bloc-presentation-organisateur.masque {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bloc-toggle {
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  opacity: 1;
  max-height: 1000px;
  /* suffisant pour la plupart des cas */
}

.bloc-toggle.masque {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}





/* ==================================================
  🗺️ GRILLE DE CHASSES
  ================================================== */

.carte-ajout-chasse.disabled {
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(100%);
}

.carte-ajout-enigme.disabled {
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(100%);
}

/* ==================================================
   🗂️ ONGLET MODAL D'ÉDITION
   ================================================== */

.edition-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--color-editor-border);
  margin-bottom: 1rem;
}

.edition-tab {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-editor-text);
}

.edition-tab.active {
  border-bottom: 3px solid var(--color-primary);
}


.edition-tab-content {
  display: none;
  min-height: 180px;
  padding: 1rem;
  background-color: var(--color-editor-background);
  position: relative;
}

.edition-tab-content.active {
  display: block;
}

.edition-tab-content .tab-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10rem;
  color: var(--color-editor-border);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.edition-tab-content > :not(.tab-watermark) {
  position: relative;
  z-index: 1;
}