:root {
  /* Couleurs pastels personnalisables */
  --color-niet: #f0f0f0;
  --color-pec: #b2f2bb;
  --color-diag: #bee3f8;
  --color-test: #fbd5d5;
  --color-step: #e0e0e0;

  --border-niet: #ccc;
  --border-pec: #28a745;
  --border-diag: #007bff;
  --border-test: #ff4d4f;
  --border-step: #bbb;
}

:root {
  /* Pastel/Irisé pour chaque type de nœud */
  --color-niet: #f5f5f5;
  --color-pec: #c3fbd8;       /* vert menthe pastel */
  --color-ttt: #d8fbc3;       /* vert menthe pastel, échange vert et bleu */
  --color-diag: #d3e5ff;      /* bleu glacier irisé */
  --color-test: #fde2e4;      /* rose clair corail */
  --color-comm: #CCCCEE;/*f8f7ff;      /* lilas très clair */
 /* --color-ttt: #a0f0a0;*/
  --color-step: #CCFFFF;/*white;/*#f8f7ff;*/
  --color-sit: #FFFFDD;/*whiteSmoke;*/

  /* Bordures assorties */
  --border-niet: #ccc;
  --border-pec: #8ce2b4;
  --border-ttt: #8cb4e2;
  --border-diag: #7db9f5;
  --border-test: #f4a9ab;
  --border-comm: #cfcaff;
 /* --border-ttt: #8e8; PEC!!!*/
  --border-sit: #f8f7ff;/*red;/*#FF66AA;/*red;*/
  --border-step: Gainsboro;
}


body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f7f9fc;
}


/* ==== Couleurs personnalisées des nœuds ==== */
.niet {
  background-color: var(--color-niet);
}

.pec {
  background-color: var(--color-pec);
  border: 2px solid var(--border-pec);
}

.ttt {
  background-color: var(--color-ttt);
  border: 2px solid var(--border-ttt);
}

.diag {
  background-color: var(--color-diag);
  border: 2px solid var(--border-diag);
}

.test {
  background-color: var(--color-test);
  border: 2px dotted var(--border-test);
}

.step {
  background-color: var(--color-step);
  border: 2px solid var(--border-step);
}

/*.ttt {
  background-color: var(--color-ttt);
  border: 2px solid var(--border-ttt);
}*/

.sit {
/*  background-color: var(--color-sit);*/ 
  
   /* background: linear-gradient(to bottom right, #d3e5ff, yellow);/*#c3fbd8);/*#fde2e4);/*#CCCCEE*/
     /*background: linear-gradient(to right,#d3e5ff, #c3fbd8, #fde2e4,#f8f7ff);
   /* background: linear-gradient(to bottom right,
  #ff9aa2,  /* rouge pastel   #ffb347,  /* orange pastel   #fffac8,  /* jaune pastel 
  
  #c3fbd8,  /* vert pastel 
  #a0e7e5,  /* bleu clair pastel 
  #bdb2ff,  /* indigo/lilas pastel 
  #e4c1f9   /* violet pastel 
);*/

background: linear-gradient(to top left,
  rgba(255, 0, 0, 0.1),     /* rouge */
  rgba(255, 165, 0, 0.1),   /* orange */
  rgba(255, 255, 0, 0.1),   /* jaune */
  rgba(0, 128, 0, 0.1),     /* vert */
  rgba(0, 0, 255, 0.1),     /* bleu */
  rgba(75, 0, 130, 0.1),    /* indigo */
  rgba(238, 130, 238, 0.1)  /* violet */
);
 
  border: 4px double var(--border-sit);
}

/*.comm{
  background-color: var(--color-step);
  border: 2px solid var(--border-step);
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 10px;
  background: #fff;
  border-radius: 6px;
  max-width: 20em;
}*/

.commentaire {
  min-width: 0;
  flex-shrink: 1;/*pour corriger l'héritage*/



  word-wrap: break-word;
  /*overflow-wrap: break-word;
  /*hyphens: auto;*/
 /*width: 2em !important;
  max-width: 2em !important;
  min-width: 0 !important;*/
  box-sizing: border-box;
    flex-shrink: 1;
/*	width: 5em;*/
max-height: 8em !important;
max-width: 175px !important;/*Permet de court-circuiter l'héritage*/
padding: 5px;
overflow-y: auto; /* scroll vertical si dépassement */
overflow-x: hidden; /* ou auto, mais souvent on masque l’horizontal */
white-space: normal; /* permet au texte de passer à la ligne */
/*text-overflow: unset; /* optionnel, on enlève l’ellipse */
border-radius: 6px;
/*box-sizing: border-box;*/

  background-color: var(--color-comm);
  border: 2px inset var(--border-comm);
}



/* ==== Feuilles / feuilles terminales ==== */
.leaf-node {
  border: 2px dashed gray !important;
  background-color: #f9f9f9 !important;
}

/* ==== Modale ==== */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.modal-content h3 {
  margin-top: 0;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.layout-container {
	height : 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start; /* pour aligner en haut */
  gap: 20px; /* espace entre les deux */
}
/* ==== Liste des noeuds racines ==== */
.scroll-box {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 10px;
  background: #fff;
  border-radius: 6px;
  max-width: 300px;
}

.node-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 5px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.node-item:hover {
  background: #eef;
}

.node-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

/* ==== Zone Treant ==== */

.treant-hidden {/*Pour cacher l'arbre pendant son re calcul et éviter les impressions de sauts ou le décalage après rechargement*/
  opacity: 0;
  pointer-events: none; /* évite les clics fantômes pendant chargement */
}



/*#tree {
  width: auto;
  height: 500px;
  margin: 0 auto;
  overflow: auto;
}*/

#tree {
  height: 700px;
  overflow: auto;
  flex-grow: 1; /* pour prendre l'espace restant */
}


.Treant .node.clickable-node {
  white-space: pre-wrap;/*met des espaces la ou il y en a à l'enregistrement*/
  padding: 10px;
  max-height: 18em;
  /*max-width: 30em;*/
  font-weight: bold;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease;
  border-radius: 8px;
}

.Treant .node {
  width: 150px;
  height: auto;
  text-align: start; /*center;*/
  white-space: normal;
  word-wrap: break-word;
}






/*.Treant .node-corner {
  display: none !important;
}*/

/*.Treant .node-corner {// pas utilisé????
  background-color: rgba(0, 0, 0, 0.1);
  width: 8px;
  height: 8px;
  top: 4px;
  right: 4px;
  border-radius: 2px;
}*/


/*.Treant .node {
  display: flex;
  justify-content: center;
  align-items: center;
}*/


/* ==== Bouton Supprimer ==== */
.delete-btn {
  background-color: #f44336;
  border: none;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

.delete-btn:hover {
  background-color: #d32f2f;
}

/* ==== Bouton pour afficher les enfants ==== */
.show-children-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
    top: -10px;
  right: -10px;
 /* Ne sert a rien. background-color: red/*#d3e5ff #f8f7ff;/*#007bff;*/
  color: white;
  font-size: 14px;
  border: none;
  cursor: pointer;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/*.show-children-btn {
  position: absolute;

  z-index: 10;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
}*/

.show-children-btn:hover {
  background-color: #6AA6E3;
}

/* ==== Responsive (Mobile/Tablette/Desktop) ==== */
@media (max-width: 768px) {
  .scroll-box {
    max-width: 100%;
    margin-bottom: 20px;
  }

  .modal-content {
    width: 95%;
  }

  .node-item span {
    max-width: 100px;
  }
}

@media (max-width: 480px) {
  .node-item {
    font-size: 13px;
    padding: 5px 8px;
  }

  .delete-btn {
    font-size: 11px;
    padding: 3px 6px;
  }

  .node-item span {
    max-width: 80px;
  }
}
