/* Questionnaires CCSchool — Charte Émeraude / Corail / Ivoire (31/07/26) */

:root {
  --vert: #0E7A6B;          /* Émeraude — couleur primaire */
  --vert-clair: #15A18D;    /* Émeraude clair — survols, liens */
  --vert-fonce: #0A5A4F;    /* Émeraude foncé — texte sur fond clair, hover foncé */
  --vert-pale: #E7F3F0;     /* Émeraude très pâle — fond de section alterné */
  --terra: #E06A44;         /* Corail / terracotta — accent, CTA */
  --terra-clair: #E9855F;   /* Corail clair — survol CTA */
  --gris: #6E6155;          /* Gris chaud (biais ivoire) — texte secondaire */
  --gris-clair: #ECE3D6;    /* Gris chaud clair — bordures, fonds neutres */
  --bg-page: #FBF7F0;       /* Ivoire chaud — fond de page */
  --blanc: #ffffff;
  --rouge: #C0392B;
  --radius: 12px;
  --ombre: 0 4px 20px rgba(14, 122, 107, 0.09);
  --ombre-hover: 0 8px 25px rgba(14, 122, 107, 0.14);
  --transition: all 0.25s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--vert);
  background: var(--bg-page);
  line-height: 1.6;
}

/* En-tête */
.entete-page {
  position: relative;
  background: var(--bg-page);
  color: var(--vert);
  padding: 4px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid rgba(14, 122, 107, 0.12);
}
.marque { font-weight: 700; letter-spacing: 0.5px; font-size: 20px; margin-left: 80px; }
.logo { max-height: 124px; width: auto; display: block; }
.logo-qualiopi { max-height: 88px; width: auto; display: block; margin-right: 56px; }
.banniere-titre {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; text-align: center; max-width: 44%;
  color: var(--terra); font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; font-size: 15px; line-height: 1.35;
}

/* Page */
.page { max-width: 1000px; margin: 32px auto; padding: 0 18px; }

.titre-bloc { margin-bottom: 32px; text-align: center; }
.sur-titre { color: var(--terra); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; font-size: 14px; margin: 0 0 8px; }
h1 { font-size: 32px; margin: 0 0 12px; color: var(--vert); font-weight: 700; line-height: 1.2; }
.intro { color: var(--gris); font-size: 16px; margin: 0 auto; max-width: 600px; }

/* Blocs / sections */
.bloc {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid rgba(14, 122, 107, 0.06);
  transition: var(--transition);
}
.bloc:hover { box-shadow: var(--ombre-hover); }
.entete { border-top: 4px solid var(--terra); }
/* Toutes les sections sur fond blanc (décision Jonathan 01/08/26). */
.section-titre {
  display: inline-block;
  font-size: 20px;
  color: var(--vert-fonce);
  margin: 0 0 24px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--terra);
  font-weight: 600;
}
.masque { display: none !important; }

fieldset.question { border: none; padding: 0; margin: 0 0 24px; }
legend.q-label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 16px; width: 100%; color: var(--vert-fonce); }
.question { margin-bottom: 24px; }
.q-label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 16px; }
.asterisque { color: var(--rouge); font-weight: bold; }

/* Ligne : plusieurs questions côte à côte (ex. Nom / Prénom) */
.ligne { display: flex; gap: 20px; }
.ligne .question { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .ligne { flex-direction: column; gap: 0; }
}

input[type="text"], input[type="date"], textarea, select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gris-clair);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--vert);
  background: var(--bg-page);
  transition: var(--transition);
}
input[type="text"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--vert);
  background: var(--blanc);
  box-shadow: 0 0 0 3px rgba(14, 122, 107, 0.15);
}
textarea { resize: vertical; min-height: 100px; }

.erreur-msg { color: var(--rouge); font-size: 14px; margin-top: 8px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.erreur-msg::before { content: "⚠️"; font-size: 12px; }
.question.invalide input[type="text"], .question.invalide input[type="date"], .question.invalide textarea, .question.invalide select {
  border-color: var(--rouge);
  background: #FBEAE7;
}
.question.invalide .choix-ligne { border-color: var(--rouge); background: #FBEAE7; }

/* Table Responsive */
.table-responsive { overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; margin-top: 8px; border-radius: 8px; }

/* Choix (radio / checkbox) */
/* Grille 2 colonnes : profite de la largeur de la page pour les listes de choix. */
.choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; border: none; padding: 0; margin: 0; }
.choix-ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--gris-clair);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--blanc);
  font-size: 16px;
}
/* La ligne « Autre » (avec son champ texte) occupe toute la largeur. */
.choix-ligne:has(.autre-txt) { grid-column: 1 / -1; }
.choix-ligne:hover { border-color: var(--vert-clair); background: var(--vert-pale); transform: translateY(-1px); }
.choix-ligne input { width: 20px; height: 20px; accent-color: var(--terra); flex: none; cursor: pointer; }
.autre-txt { flex: 1; margin-left: 8px; padding: 8px 12px; font-size: 15px; }
.choix-ligne:has(input:checked) { border-color: var(--terra); background: #FDF1EB; font-weight: 500; }
@media (max-width: 640px) {
  .choix { grid-template-columns: 1fr; }
}

/* Grille et Matrice */
.grille { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--blanc); }
.grille th, .grille td { border: 1px solid var(--gris-clair); padding: 12px; }
.grille thead th { background: var(--vert); color: var(--blanc); font-weight: 500; text-align: center; }
.grille th.grille-comp { text-align: left; }
.grille td.grille-comp { text-align: left; background: var(--bg-page); font-weight: 500; }
.grille td.grille-niv { text-align: center; width: 130px; }
.grille td.grille-niv input { width: 20px; height: 20px; accent-color: var(--terra); cursor: pointer; }
.grille tbody tr { transition: var(--transition); }
.grille tbody tr:hover td { background: var(--vert-pale); }

.consigne { font-weight: 500; margin: 0 0 8px; font-size: 16px; color: var(--vert); }
.legende { font-size: 14px; color: var(--gris); margin: 0 0 16px; font-style: italic; }
.matrice-table td.grille-niv { width: auto; min-width: 45px; }

/* Actions */
.actions { margin: 16px 0 48px; display: flex; justify-content: center; }
.btn-envoyer {
  background: var(--terra);
  color: var(--blanc);
  border: none;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(224, 106, 68, 0.3);
}
.btn-envoyer:hover { 
  background: var(--terra-clair); 
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(224, 106, 68, 0.4); 
}

.hint { color: var(--gris); font-style: italic; text-align: center; padding: 30px; font-size: 16px; }
.merci {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 48px 32px;
  text-align: center;
  font-size: 20px;
  color: var(--vert);
  border-top: 6px solid var(--terra);
  animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pied de page */
.pied {
  text-align: center;
  color: var(--gris);
  font-size: 14px;
  padding: 32px 16px 48px;
  border-top: 1px solid rgba(14, 122, 107, 0.1);
  margin-top: 40px;
}

/* Aperçu démo */
.apercu.masque { display: none !important; }
.apercu {
  position: fixed;
  inset: 0;
  background: rgba(14, 122, 107, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.3s ease;
}
.apercu-carte {
  background: var(--blanc);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 24px 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.apercu-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.apercu-tete strong { font-size: 18px; color: var(--vert); }
.apercu-tete button {
  background: var(--gris-clair);
  color: var(--vert);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}
.apercu-tete button:hover { background: var(--gris-clair); }
.apercu-note { color: var(--gris); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }
#apercu-json {
  background: var(--vert);
  color: #F3ECDF;
  padding: 20px;
  border-radius: 8px;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
}

/* Fichier (upload) */
.fichier-wrap input[type="file"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px dashed var(--gris-clair);
  border-radius: 8px;
  background: var(--bg-page);
  font-family: inherit;
  font-size: 15px;
  color: var(--gris);
}
.aide-fichier { font-size: 13px; color: var(--gris); margin: 6px 0 0; }

/* Bloc répétable (ex. un salarié par bloc) */
.repetable-instance {
  border: 1px solid rgba(14, 122, 107, 0.12);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  background: var(--bg-page);
}
.repetable-titre { margin: 0 0 16px; font-size: 16px; color: var(--terra); font-weight: 700; }
.btn-ajouter-instance, .btn-supprimer-instance {
  background: none;
  border: 1px dashed var(--vert-clair);
  color: var(--vert);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
}
.btn-ajouter-instance:hover { background: var(--vert-pale); }
.btn-supprimer-instance { border-color: var(--rouge); color: var(--rouge); margin-top: 8px; }
.btn-supprimer-instance:hover { background: #FBEAE7; }

@media (max-width: 600px) {
  .bloc { padding: 20px 16px; }
  h1 { font-size: 26px; }
  .btn-envoyer { width: 100%; padding: 16px; }
  .grille td.grille-comp { font-size: 13px; }
  .grille td.grille-niv { width: auto; padding: 8px; }
  .grille th.grille-niv { font-size: 12px; }
  .choix-ligne { padding: 10px 12px; }
}
