/* Réinitialisation des marges et des remplissages */
body, h1, h2, ul, li, p {
    margin: 0;
    padding: 0;
    overflow: auto;
}

/* Style de base pour le corps de la page */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
      height: 100%;   
}


/* Style pour l'en-tête */
header {
  background-color: #0078d7;
  color: #fff;
  padding: 0.5rem 1rem; /* réduit la hauteur */
  text-align: center;
  width: 100%;
}


/* Style pour la navigation */
nav ul {
    list-style: none;
    padding: 0.3rem;
    background-color: #333;
    width: 100%;
}

nav ul li {
    display: inline;
    margin-right: 0.5rem;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
}


/* Style pour le contenu principal */
main {
  padding: 0rem 2rem 0rem 2rem; /* top, right, bottom, left */    width: 100%;
    max-width: 1200px;
      flex: 1; /* prend tout l’espace disponible */

}

.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

section {
    margin-bottom: 0.6rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}


/* Styles pour les boutons de navigation */
.navigation-buttons {
    margin-top: 1rem;
}

button {
    padding: 0.5rem 1rem;
    margin: 0.5rem;
    background-color: #0078d7;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #005da6;
}

.prob {
    font-size: 30px;
    text-align: center;
    border: #333 solid;
}

/* Ajoutez ces styles à votre fichier styles.css existant */

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
}

.button-group button {
    padding: 10px;
    background-color: #0078d7;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.button-group button:hover {
    background-color: #005da6;
}

/* Ajoutez ces styles à votre fichier styles.css existant */

.problem-types {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.problem-type {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.colonne-enonce #probleme {
  font-size: 18px;
  font-weight: normal;
  line-height: 1.4;
}


.example-button {
    padding: 5px 10px;
    background-color: #0078d7;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.example-button:hover {
    background-color: #005da6;
}

.example {
    margin-top: 10px;
    padding: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
}

.sub-families {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.sub-family {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.description {
    padding: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
}

.description ul {
    margin-top: 10px;
}

.description li {
    margin-bottom: 5px;
}


.custom-path {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.column {
    width: 30%;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}

.column ul {
    list-style: none;
    padding: 0;
}

.column li {
    margin-bottom: 10px;
    background-color: #e9e9e9;
    padding: 10px;
    border-radius: 5px;
}

.options {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.options button {
    padding: 10px 20px;
    background-color: #0078d7;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.options button:hover {
    background-color: #005da6;
}

.difficulty-level {
    margin-left: 10px;
}

.bouton {
    font-size: 30px;
}

.calc {
    font-size: 50px;
    text-align: center;
    border: #333 solid;
     max-width: 100%;
     overflow-x: hidden;
}

.numeric-keypad {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  gap: 0.2rem;
}


.key-row {
  display: flex;
  justify-content: center;
  width: 100%;
  gap: 0.4rem;
}

.key-row button {
  flex: 1;
  padding: 0.3rem 0.2rem; /* plus petit padding */
  font-size: 0.9rem;       /* texte plus petit */
  min-width: 0;
  max-width: 60px;
   border-radius: 4px;
  border: 1px solid #ccc;
}

.numeric-keypad button {
  width: 60px;
  height: 60px;
  font-size: 24px;
  margin: 2px;
}
.user-answer {
  font-size: 24px;
  margin-bottom: 10px;
}

* {
  box-sizing: border-box;
}

.timer-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-weight: bold;
}

#timer {
  font-size: 18px;
}

  .barre-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
  }
  /* Barre dizaine */
  .dizaine {
    width: 300px;
    height: 40px;
    background: linear-gradient(90deg, #3498db 0 100%);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: opacity 0.5s;
  }
  /* Les unités carrés */
  .unit {
    width: 28px;
    height: 28px;
    background-color: #3498db;
    border-radius: 4px;
    margin: 0 2px;
    position: relative;
    transition: transform 0.6s ease, opacity 0.3s ease;
  }
  /* Conteneur unités */
  .unitsContainer {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    min-width: 200px;
  }
  /* Conteneur unités mises de côté */
  .setAside {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 120px;
    height: 40px;
    border: 2px dashed #aaa;
    border-radius: 6px;
    padding: 5px;
    opacity: 0;
  }
  /* Contour pour unités restantes */
  .remainingUnits {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 3px solid #e74c3c;
    border-radius: 8px;
    padding: 6px;
  }

  .section-probleme {
  position: relative;
}

.colonne-enonce {
  flex: 1;
  max-width: 2000px;
  min-width: 250px;
  padding: 10px;
}

#clavier-numerique {
  flex: 1;
  max-width: 90px;
  min-width: 50px;
  padding: 10px;
  border-left: 1px solid #ccc;;
}

.colonne-correction {
  flex: 1;
  max-width: 300px;
  min-width: 20px;
  border-left: 1px solid #ccc;;
}


.zone-controle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
    margin-bottom: -10px;
}

.zone-controle select,
.zone-controle button {
  font-size: 14px;
  padding: 5px 10px;
  
}

.centre-bouton {
  display: flex;
  justify-content: center;
  margin: -10px 0;
}



/* 📱 Clavier numérique */

#clavier-numerique input#reponse-eleve {
  font-size: 18px;
  padding: 2px;
  width: 90px;
  text-align: center;
  margin-bottom: 10px;
  margin-top: 0px;
}

/* ✅ Zone de correction */
#zone-correction {
  margin-top: 20px;
  text-align: center;
}

#zone-correction p {
  font-size: 18px;
  margin-bottom: 10px;
}

#zone-correction button {
  font-size: 15x;
  border-radius: 4px;
  background-color: #469a70;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#zone-correction button:hover {
  background-color: #e60404;
}

.ligne-chrono-score {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 15px;
}

.ligne-chrono-score > div {
  font-size: 20px;
}

.bloc-probleme-et-clavier {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  margin-top: 20px;
  flex-wrap: wrap; /* pour s'adapter sur petit écran */
}

.section-probleme {
  flex: 1;
  min-width: 250px;
}

#clavier-numerique {
  flex: 1;
  min-width: 250px;
  max-width: 300px;
  text-align: center;
}


/* Style bleu pour les boutons du clavier numérique */
#clavier-btns button,
.btn-chiffre {
  background-color: #0078d7;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  padding: 5px 12px;
  margin: 1px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.entete-probleme {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.entete-probleme #probleme {
  flex: 1;
}

.btn-voix {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}


#zone-boutons-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  margin-top: 15px;
}

#zone-boutons-pdf button {
  background-color: #6a1b9a; /* violet foncé */
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  
}

#zone-boutons-pdf button:hover {
  background-color: #8e24aa; /* violet plus clair au survol */
}

#timer,
#score {
  margin-left: 20px; /* ou plus si besoin */
}

.schema-et-reponse {
  display: flex;
  align-items: flex-start; /* 🔼 aligner en haut */
  gap: 20px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#bar-chart {
  flex: 1;
  min-width: 200px;
}

#reponse {
  flex: 1;
  min-width: 150px;
  font-size: 22px;
  margin-top: 0;       /* 🧼 supprime tout décalage vertical */
  padding-top: 0;
  text-align: center;
}

.groupe-boutons-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  justify-content: center;
}

.groupe-boutons-action button {
  margin: 0; /* annule les marges par défaut */
}

#reponse {
  white-space: pre-line;
}

.btn-with-icon {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-btn {
  flex: 1;
}

.example-icon {
  margin-left: 8px;
  cursor: pointer;
  font-size: 18px;
  background: #eee;
  border-radius: 50%;
  padding: 2px 6px;
  transition: background 0.3s;
}

.example-icon:hover {
  background: #ccc;
}

/* grille à 7 colonnes (s’adapte en responsive) */
#choix-generateurs {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  align-items: start;
}

/* responsive : passe à auto-fit si l’écran est étroit */
@media (max-width: 1400px) {
  #choix-generateurs {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

#choix-generateurs .colonne-gen {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 220px;
  background: #fff;
}

#choix-generateurs .colonne-gen > legend {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

#choix-generateurs .liste-gen {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#choix-generateurs .gen-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.95rem;
}

#choix-generateurs .gen-item input[type="checkbox"] {
  transform: translateY(1px);
}


.groupe-selection {
  min-width: 200px;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 8px;
  background: #fafafa;
}

.groupe-selection h3 {
  font-size: 1.1em;
  margin-bottom: 8px;
  color: #333;
}

.groupe-toggle {
  display:flex; align-items:center; gap:6px; font-size:12px;
  user-select:none; cursor:pointer;
}
.groupe-toggle input { transform: translateY(1px); }

/* commun */
.etape-label { font-weight: 600; }

/* couleurs par position d'étape */
.etape-label[data-step="1"] { color: #0b6cff; } /* Samira */
.etape-label[data-step="2"] { color: #d12b2b; } /* Total */


.bloc-centre {
  display: flex;
  align-items: center;
  justify-content: center; /* ✅ centre horizontalement */
  gap: 8px;
}

:root {
  /* Réglez ici l’apparence */
  --alert-width: 680px;          /* largeur max de la fenêtre */
  --alert-font-size: 1.25rem;    /* taille de police */
  --alert-line-height: 1.6;      /* interligne */
  --alert-padding: 20px;         /* marges internes */
  --alert-radius: 14px;          /* arrondi */
}

dialog#exampleModal {
  border: none;
  padding: 0;
  width: min(90vw, var(--alert-width));
  max-width: 100%;
  background: transparent; /* le fond vrai est sur .modal-card */
}

dialog#exampleModal::backdrop {
  background: rgba(0,0,0,.45);  /* voile sombre derrière (centrage natif) */
}

.modal-card {
  background: #fff;
  border-radius: var(--alert-radius);
  padding: var(--alert-padding);
  font-size: var(--alert-font-size);
  line-height: var(--alert-line-height);
  color: #111;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: grid;
  gap: 14px;
}

.modal-card h3 {
  margin: 0;
  font-size: calc(var(--alert-font-size) * 1.1);
}

.modal-card .actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.close-btn {
  border: none;
  background: #4c78af;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
}
.close-btn:hover { background: #3b6597; }

/* (Optionnel) fermer en cliquant à l'extérieur : géré côté JS ci-dessous */

.custom-alert {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.custom-alert-box {
  background: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  font-size: 1.3rem; /* police plus grosse */
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

.custom-alert-box button {
  margin-top: 20px;
  padding: 10px 25px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #3498db;
  color: white;
  cursor: pointer;
}
.custom-alert-box button:hover {
  background: #2980b9;
}

.site-footer {
  background: #1e293b; /* gris foncé élégant */
  color: #cbd5e1;
  padding: 10px 10px 5px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-top: auto; /* pousse le footer en bas */
  width: 100%;       /* ✅ prend toute la largeur */
  text-align: center;


}

.footer-container {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: auto;
}

.footer-col h4 {
  margin-bottom: 15px;
  font-size: 16px;
  color: #fff;
  font-weight: bold;
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col ul li {
  margin-bottom: 8px;
  font-size: 16px;

}

.footer-col ul li a,
.social-links a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-col ul li a:hover,
.social-links a:hover {
  color: #38bdf8; /* bleu clair sur hover */
}

.social-links a {
  margin-right: 10px;
}

.footer-bottom {
  text-align: center;
  margin-top: 30px;
  border-top: 1px solid #334155;
  padding-top: 15px;
  font-size: 13px;
  color: #94a3b8;
}

.surlignage {
  position: relative;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 2px;
  overflow: hidden;
}

.surlignage::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  z-index: -1;
  animation: surligneur 1s forwards;
}

.surlignage.violet::before {
  background-color: rgba(200, 150, 255, 0.5);
}

.surlignage.rouge::before {
  background-color: rgba(255, 120, 120, 0.5);
}

@keyframes surligneur {
  from { width: 0; }
  to   { width: 100%; }
}

  .back-btn {
      display: block;
      width: max-content;
      margin: 12px auto 0;
      padding: 8px 12px;
      background: #333; color: white; border-radius: 6px;
      cursor: pointer; text-decoration: none;
    }
    .back-btn:hover { background: #555; }

/* ===================== Page: "types de problèmes" ===================== */
/* On scope tout sur .page-types pour ne pas impacter le reste. */

/* Router par sections */
.page-types main > section { display: none; }
.page-types main > section.active { display: block; }

/* Layout sticky (si utilisé) */
.page-types html { block-size: 100%; }
.page-types.sticky-layout { min-block-size: 100svh; display: flex; flex-direction: column; margin: 0; }
.page-types.sticky-layout > main { flex: 1; min-block-size: 0; overflow: visible; }

/* Grille de gros boutons */
.page-types .button-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

/* Gros boutons bleus (liens ou <button>) */
.page-types .button-group .link-btn,
.page-types .button-group button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 20px;
  border: none;
  background: #4c78af;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .3s;
}
.page-types .button-group .link-btn:hover,
.page-types .button-group button:hover {
  background: #45a049;
}

/* Boutons de navigation "Retour / Accueil" (gris) */
.page-types .back-btn {
  display: inline-block;
  width: max-content;
  padding: 8px 12px;
  background: #333;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.page-types .back-btn:hover { background: #555; }

/* Footer (cohérence liens – scoping pour éviter conflits) */
.page-types .site-footer a { color: #38bdf8; text-decoration: none; }
.page-types .site-footer a:hover { text-decoration: underline; }

/* Titre centré spécifique */
.page-types .title-center,
.page-types h2[style*="text-align: center"] { /* garde l'aspect si tu as encore du inline */
  text-align: center;
  font-size: 23px;
}


    /* Mise en page sélecteurs pour générateur personnalisé*/
    .groupe-selection {
      border: 1px solid #e5e5e5;
      border-radius: 10px;
      padding: 10px 12px;
      min-width: 260px;
      background: #fafafa;
      box-shadow: 0 1px 0 rgba(0,0,0,.03);
      margin-bottom: 12px;
    }
    .groupe-header h3 { margin: 0 0 6px 0; font-size: 16px; }
    .groupe-body label { display: inline-flex; align-items: center; gap: 6px; }
    .groupe-body br { line-height: 10px; }
    .example-icon { cursor: pointer; margin-left: 6px; }

    .share-wrap { display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:center; }
    .share-input { text-align:center; font-size:18px; width:9ch; height:36px; }
    #qr { width:128px; height:128px; display:flex; align-items:center; justify-content:center; background:#fff; }

    .grand-groupe {
      border: 2px solid #ccc;
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 20px;
      background: #f0f0f0;
      width: 100%;
    }
    .grand-groupe > h2 {
      margin-top: 0;
      font-size: 20px;
      text-align: center;
    }
    .sous-groupes {
      display: flex;
      gap: 20px;
      flex-wrap: wrap;
      align-items: flex-start;
      justify-content: center;
    }

  /* Panneau contact */
  #contact-panel {
    display: none;
    position: relative;
    text-align: left;
    max-width: 720px;
    margin: 12px auto 0;
    padding: 20px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
  }
  body.contact-open #contact-panel { display: block; }

  #contact-panel input, 
  #contact-panel textarea {
    width: 100%;
    box-sizing: border-box;
  }

  /* Croix */
  #contact-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #e2e8f0;
    cursor: pointer;
  }
  #contact-close:hover {
    color: #f87171; /* rouge clair au survol */
  }

  #bar-chart {
  display: flex;
  justify-content: center;
  align-items: center;
}
