/* Boutons carrés pour la toolbar */
.toolbar-btn-square {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.3em;
  background: #f7fafd;
  border: 1px solid #b3c6e0;
  margin: 0 2px;
  transition: background 0.15s, border 0.15s;
  cursor: pointer;
  padding: 0;
}
.toolbar-btn-square:hover {
  background: #e0eafc;
  border-color: #448b36;
}
/* Sous-header charges (même style que sous-header appuis) */
#sub-header-charges {
  display: none;
  gap: 15px;
  position: relative;
  border-bottom: 1px solid #b3c6e0;
  border-top: 1px solid #b3c6e0;
  padding: 6px 12px 6px 0;
  background: #282c3b;
  box-shadow: none;
  border-radius: 0;
  align-items: center;
}
#sub-header-charges .charge-type-btn {
  margin-left: 90px;
}
#sub-header-charges .charge-type-btn:first-child {
  margin-left: 90px;
}
#sub-header-charges .charge-type-btn:not(:first-child) {
  margin-left: 0;
}

#sub-header-charges::after {
  content: none;
}

#sub-header-charges .charge-type-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #3a4a6b;
  border: none;
  border-radius: 4px;
  padding: 4px 14px 4px 10px;
  font-size: 0.98em;
  font-weight: 500;
  color: #eaf6ff;
  box-shadow: none;
  cursor: pointer;
  /* transition: background 0.15s, border 0.15s, color 0.15s; */
  outline: none;
}
#sub-header-charges .charge-type-btn:hover, #sub-header-charges{
  filter: brightness(1.1);
  /* border: 1px solid #448b36;
  color: #256029; */
}
#sub-header-charges .charge-type-btn.active {
  background: #28333c;
}
/* Style Excel-like pour le tableau des charges */
#charges table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#charges th, #charges td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}

#charges th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#charges tr:hover td {
  background: #eaf6ff;
}
#charges td:last-child {
  text-align: center;
}
#charges .delete-charge {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#charges .delete-charge:hover {
  background: #ffeaea;
}
#load-combination th {
  background: #e6f0fa;
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  transition: background 0.2s;
}
#result th, #result td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
/* Sous-header appuis (en-tête compact sans background ni box-shadow) */
#sub-header-appuis {
  display: none;
  gap: 15px;
  position: relative;
  border-bottom: 1px solid #b3c6e0;
  border-top: 1px solid #b3c6e0;
  padding: 6px 12px 6px 0;
  background: #282c3b;
  box-shadow: none;
  border-radius: 0;
  align-items: center;
}
#sub-header-appuis .appui-type-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #3a4a6b;
  border: none;
  border-radius: 4px;
  padding: 4px 14px 4px 10px;
  font-size: 0.98em;
  font-weight: 500;
  color: #eaf6ff;
  box-shadow: none;
  cursor: pointer;
  /* transition: background 0.15s, border 0.15s, color 0.15s; */
  outline: none;
}
#sub-header-appuis .appui-type-btn:first-child {
  margin-left: 90px;
}
#sub-header-appuis .appui-type-btn:not(:first-child) {
  margin-left: 0;
}



#sub-header-appuis .appui-type-btn:hover, #sub-header-appuis .appui-type-btn.active {
  filter: brightness(1.1);
}
#sub-header-appuis .appui-type-btn.active {
  background: #28333c;
}

#sub-header-appuis .appui-type-btn svg {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  fill: #ffffff;
  transition: fill 0.15s;
}

/* Style Excel-like pour le tableau des noeuds */
#noeuds table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#noeuds th, #noeuds td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
#noeuds th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#noeuds td input[type="number"] {
  width: 100%;
  background: #fffbe6;
  border: none;
  padding: 4px 6px;
  font-size: 1em;
  border-radius: 2px;
  box-sizing: border-box;
  transition: background 0.2s;
}
#noeuds td input[type="number"]:focus {
  outline: 2px solid #0078d7;
  background: #fffde0;
}
#noeuds td[contenteditable="true"] {
  background: #fffbe6;
  border: 1px solid #d0d0d0;
  padding: 4px 6px;
  font-size: 1em;
  border-radius: 2px;
  box-sizing: border-box;
  transition: background 0.2s;
}
#noeuds tr:hover td {
  background: #eaf6ff;
}
#noeuds tr td:last-child {
  text-align: center;
}
#noeuds .delete-btn {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#noeuds .delete-btn:hover {
  background: #ffeaea;
}
/* Style Excel-like pour le tableau des sections */
#sections table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#sections th, #sections td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
#sections th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#sections td[contenteditable="true"] {
  background: #fffbe6;
  cursor: cell;
}
#sections td[contenteditable="true"]:focus {
  outline: 2px solid #0078d7;
  background: #fffde0;
}
#sections tr:hover td {
  background: #eaf6ff;
}
#sections tr td:last-child {
  text-align: center;
}
#sections .delete-section {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#sections .delete-section:hover {
  background: #ffeaea;
}
/* Style pour les sections, identique à .material-item */
.section-item {
  border: 1px solid #ddd;
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  background: #fafafa;
  transition: background 0.3s ease, border-color 0.3s ease;
  user-select: none;
}

.section-item:hover {
  background: #f0f8ff;
  border-color: #0078d7;
}

.section-item.selected {
  background: #0078d7;
  color: white;
  border-color: #005a9e;
}

.section-item .section-details {
  margin-top: 6px;
  font-size: 0.85rem;
  padding-left: 1rem;
  color: #eee;
}

.section-item.selected .section-details {
  color: black;
}
/* Fond et positionnement */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-content {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem 2rem;
  width: 520px;
  max-height: 70vh;
  min-height: 35vh;
  /* suppression de overflow-y ici pour gérer le scroll dans #library */
  position: relative;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 1;
}

/* Styles spécifiques pour la modale des sections */
.section-modal-content {
  width: 900px;
  max-width: 95vw;
  max-height: 80vh;
  min-height: 600px;
}

.section-modal-body {
  display: flex;
  gap: 2rem;
  flex: 1;
}

.section-selection-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.section-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #ddd;
  padding-left: 2rem;
}

.preview-header {
  margin-bottom: 1rem;
}

.preview-header h3 {
  font-size: 1.1rem;
  color: #333;
  margin: 0;
  font-weight: 600;
}

.preview-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8f9fa;
  border: 2px dashed #ddd;
  border-radius: 8px;
  min-height: 300px;
  margin-bottom: 1rem;
}

#section-preview-canvas {
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-info {
  background: #f1f3f4;
  padding: 1rem;
  border-radius: 6px;
}

#section-preview-info {
  font-size: 0.9rem;
  color: #555;
}

#section-preview-info p {
  margin: 0.2rem 0;
}

/* Limitation de la taille de la section library */
#section-library-list {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

/* Scrollbar personnalisé pour la library */
#section-library-list::-webkit-scrollbar {
  width: 6px;
}

#section-library-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#section-library-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

/* Amélioration des éléments de section */
.section-item {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  color: #333; /* Texte noir par défaut */
}

.section-item:hover {
  background-color: #f8f9fa;
  border-color: #e9ecef;
  color: #000; /* Texte noir au survol */
}

.section-item.selected {
  background-color: #e3f2fd;
  border-color: #2196f3;
  border-left: 3px solid #2196f3;
  color: #000; /* Texte noir quand sélectionné */
}

.section-item .section-details {
  color: #555; /* Texte des détails en gris foncé pour lisibilité */
  font-size: 0.9em;
  margin-top: 5px;
}


/* Styles pour les boutons de type personnalisé */
.custom-section-type-btn {
  transition: all 0.2s ease;
  border-radius: 6px;
  padding: 8px;
  outline: none;
}

.custom-section-type-btn:hover {
  background-color: #f0f0f0;
  transform: translateY(-1px);
}

/* .custom-section-type-btn.active {
  background-color: #2196f3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
} */

/* Responsive pour les petits écrans */
@media (max-width: 1024px) {
  .section-modal-content {
    width: 95vw;
    min-height: 500px;
  }
  
  .section-modal-body {
    flex-direction: column;
  }
  
  .section-preview-panel {
    border-left: none;
    border-top: 1px solid #ddd;
    padding-left: 0;
    padding-top: 2rem;
  }
  
  .preview-container {
    min-height: 200px;
  }
  
  #section-preview-canvas {
    width: 250px;
    height: 250px;
  }
}
.modal-err-content {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem 2rem;
  width: 520px;
  max-height: 70vh;
  min-height: 15vh;
  position: relative;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 1;
}
/* Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-weight: 700;
  font-size: 1.2rem;
  color: #222;
  margin: 0;
}

.close-modal {
  font-size: 1.6rem;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  transition: color 0.2s ease;
  user-select: none;
}

.close-modal:hover {
  color: #d33;
}

/* Onglets */
.modal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modal-tabs button {
  flex: 1;
  padding: 0.5rem 0;
  background: #f0f0f0;
  border: 1.5px solid transparent;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.modal-tabs button:hover {
  background: #e0e0e0;
}

.modal-tabs button.active {
  background: #0078d7;
  color: white;
  border-color: #0078d7;
  box-shadow: inset 0 -3px 0 0 white;
}

/* Corps */
.modal-body {
  flex-grow: 1;
  overflow: hidden; /* évite scroll hors #library */
  font-size: 0.9rem;
  color: #333;
  display: flex;
  flex-direction: column;
}
.tab-section label {
  display: block;

  font-weight: 600;
  color: #444;
}

.tab-section input[type="text"],
.tab-section input[type="number"] {
  width: 100%;
  padding: 6px 10px;
  margin-top: 0.25rem;
  border: 1.5px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.tab-section input[type="text"]:focus,
.tab-section input[type="number"]:focus {
  outline: none;
  border-color: #0078d7;
  box-shadow: 0 0 5px rgba(0, 120, 215, 0.5);
}

/* Table des matériaux */
.material-item {
  border: 1px solid #ddd;
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  background: #fafafa;
  transition: background 0.3s ease, border-color 0.3s ease;
  user-select: none;
}

.material-item:hover {
  background: #f0f8ff;
  border-color: #0078d7;
}

.material-item.selected {
  background: #0078d7;
  color: white;
  border-color: #005a9e;
}

.material-item .material-details {
  margin-top: 6px;
  font-size: 0.85rem;
  padding-left: 1rem;
  color: #eee;
}

.material-item.selected .material-details {
  color: #ddd;
}

/* Footer */
.modal-footer {
  margin-top: 1.2rem;
  text-align: right;
  flex-shrink: 0;
}

#add-material, #add-section {
  background-color: #0078d7;
  color: white;
  border: none;
  padding: 10px 22px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

#add-material:hover, #add-section:hover {
  background-color: #005a9e;
}

/* Scrollbar personnalisé pour modal-content */
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}

/* Responsive */
@media (max-width: 550px) {
  .modal-content {
    width: 90%;
    padding: 1rem 1.2rem;
  }
}
#library {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 12px;
  background: #fafafa;
}
#library {
  max-height: auto;
}
#section-library {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 12px;
  background: #fafafa;
  max-height: auto;
}
#section-library::-webkit-scrollbar {
  width: 8px;
}
#section-library::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.15);
  border-radius: 4px;
}
#section-library::-webkit-scrollbar-track {
  background: #f5f5f5;
}
#library::-webkit-scrollbar {
  width: 8px;
}
#library::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.15);
  border-radius: 4px;
}

#library::-webkit-scrollbar-track {
  background: #f5f5f5;
}

/* Style Excel-like pour le tableau des appuis */
#appuis table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#appuis th, #appuis td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
#appuis th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#appuis td[contenteditable="true"], #appuis td input[type="number"], #appuis td input[type="text"] {
  background: #fffbe6;
  border: none;
  padding: 4px 6px;
  font-size: 1em;
  border-radius: 2px;
  box-sizing: border-box;
  transition: background 0.2s;
  border: 1px solid #d0d0d0;
}
#appuis td[contenteditable="true"]:focus, #appuis td input[type="number"]:focus, #appuis td input[type="text"]:focus {
  outline: 2px solid #0078d7;
  background: #fffde0;
}
#appuis tr:hover td {
  background: #eaf6ff;
}
#appuis tr td:last-child {
  text-align: center;
}
#appuis .delete-btn {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#appuis .delete-btn:hover {
  background: #ffeaea;
}

/* Style Excel-like pour le tableau des poutres */
#poutres table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#poutres th, #poutres td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
#poutres th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#poutres td[contenteditable="true"], #poutres td input[type="number"], #poutres td input[type="text"] {
  background: #fffbe6;
  border: none;
  padding: 4px 6px;
  font-size: 1em;
  border-radius: 2px;
  box-sizing: border-box;
  transition: background 0.2s;
  border: 1px solid #d0d0d0;
}
#poutres td[contenteditable="true"]:focus, #poutres td input[type="number"]:focus, #poutres td input[type="text"]:focus {
  outline: 2px solid #0078d7;
  background: #fffde0;

}
#poutres tr:hover td {
  background: #eaf6ff;
}
#poutres tr td:last-child {
  text-align: center;
}
#poutres .delete-btn {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#poutres .delete-btn:hover {
  background: #ffeaea;
}

/* Style Excel-like pour le tableau des matériaux */
#materiaux table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}
#materiaux th, #materiaux td {
  border: 1px solid #d0d0d0;
  padding: 8px 10px;
  text-align: left;
  min-width: 60px;
  background: #f9f9f9;
  transition: background 0.2s;
}
#materiaux th {
  background: #e6f0fa;
  font-weight: bold;
  color: #1a3a5a;
}
#materiaux td[contenteditable="true"], #materiaux td input[type="number"], #materiaux td input[type="text"] {
  background: #fffbe6;
  border: 1px solid #d0d0d0;
  padding: 4px 6px;
  font-size: 1em;
  border-radius: 2px;
  box-sizing: border-box;
  transition: background 0.2s;
}
#materiaux td[contenteditable="true"]:focus, #materiaux td input[type="number"]:focus, #materiaux td input[type="text"]:focus {
  outline: 2px solid #0078d7;
  background: #fffde0;
}
#materiaux tr:hover td {
  background: #eaf6ff;
}
#materiaux tr td:last-child {
  text-align: center;
}
#materiaux .delete-material {
  background: none;
  border: none;
  color: #d94f4f;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 3px;
  transition: background 0.2s;
}
#materiaux .delete-material:hover {
  background: #ffeaea;
}
.tab-button[data-tab="support-reaction"],
.tab-button[data-tab="beam-effort"],
.tab-button[data-tab="beam-effort-detail"] {
  border-top: none !important;
}
#section-search-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  box-sizing: border-box;
  margin-bottom: 1rem;
  box-shadow: unset;
  outline: none;
}
