/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: auto;
}

body {
    font-family: Open Sans, Arial, sans-serif;
    font-size: 14px;
}

.wrapper {
    height: 100%;
    display: table;
    width: 100%;
}

/* Header Styles */
.header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 2em;
    background: #dddddd;
    outline: 1px solid gray;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 10px;
}

.header div {
    display: inline-block;
    padding: 0 8px;
    text-shadow: 1px 1px 2px #cccccc;
    outline: 1px solid gray;
    white-space: nowrap;
    margin-right: 10px;
}

.header select {
    padding: 5px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

.header select:hover {
    border-color: #999;
}

/* Main Content Styles */
.main {
    height: calc(100vh - 2em);
    margin-top: 2em;
    display: table;
    width: 100%;
}

.box {
    display: table-cell;
    vertical-align: top;
}

/* Left Sidebar Styles */
.sidebar {
    width: 16em;
    background-color: transparent;
    border-right: none;
    position: fixed;
    left: 0;
    top: 2em;
    bottom: 0;
    overflow-y: auto;
    padding: 10px;
    z-index: 1;
    box-shadow: none;
}

.sidebar fieldset {
    margin-bottom: 10px;
    border-radius: 8px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1), 2px 3px 5px rgba(204, 204, 204, 0.5);
    border: 1px solid #ddd;
    cursor: default;
    width: 100%;
}

.sidebar fieldset button {
    margin-top: 10px;
    width: 100%;
    padding: 5px;
    background-color: #f0f0f0;
    color: black;
    border: 1px solid #ccc;
    cursor: pointer;
}

.sidebar fieldset button:hover {
    background-color: #e0e0e0;
}

.sidebar fieldset legend {
    background: white;
    padding: 0 5px;
    font-size: 14px;
    font-weight: bold;
}

.sidebar fieldset input {
    width: calc(100% - 4px);
    padding: 5px;
    margin: 0;
}

/* Right Sidebar Styles */
.sidebar-right {
    width: 250px;
    background-color: transparent;
    border-left: none;
    position: fixed;
    right: 10px;
    top: 2em;
    bottom: 0;
    overflow-y: auto;
    padding: 10px;
    z-index: 1;
    box-shadow: none;
}

.sidebar-right fieldset {
    margin-bottom: 10px;
    border-radius: 8px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1), 2px 3px 5px rgba(204, 204, 204, 0.5);
    border: 1px solid #ddd;
    cursor: default;
    width: 100%;
}

.sidebar-right fieldset legend {
    background: white;
    padding: 0 5px;
    font-size: 14px;
    font-weight: bold;
}

.sidebar-right #node-relations,
.sidebar-right #relations-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.sidebar-right #node-relations li,
.sidebar-right #relations-list li {
    margin-bottom: 5px;
    padding: 5px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.sidebar-right #all-relations {
    max-height: 350px;
    overflow-y: auto;
}

/* Canvas Container Styles */
#canvas-container {
    position: relative;
    margin-left: 16em;
    margin-right: 260px;
    height: calc(100vh - 2em);
    overflow: auto;
    margin-top: 2em;
}

#canvas {
    background-color: #fff;
}

/* Utility Styles */
.clickable {
    cursor: pointer;
}

.grabbable {
    cursor: -webkit-grab;
}

.noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

fieldset {
    margin-bottom: 1em;
    border-radius: 8px;
    padding: 8px 5px 12px 5px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1), 2px 3px 5px rgba(204, 204, 204, 0.5);
    border: 1px solid #ddd;
    cursor: default;
}

legend {
    background: white;
    padding: 0 5px;
    font-size: 14px;
    font-weight: bold;
}

hr {
    border: none;
    margin: 3px 0;
}

input {
    padding: 5px 5px;
    width: inherit;
}

a, a:visited, a:active {
    color: black;
    text-decoration: none;
}

#log .message {
    padding-left: 4px;
}

/* Popup Styles */
.popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.popup-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-height: 70vh;
    overflow-y: auto;
}

.popup-content h2, .popup-content h3 {
    color: inherit;
    margin-bottom: 15px;
}

.popup-content h3 {
    font-size: 18px;
    margin-top: 20px;
}

.popup-content p {
    color: inherit;
    line-height: 1.6;
}

.popup-content img {
    border-radius: 8px;
    margin-bottom: 20px;
}

.popup-content ul {
    list-style-type: square;
    padding-left: 30px;
    margin: 0;
}

.popup-content ul li {
    margin-bottom: 10px;
}

/* Help Button Styles */
#help-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: black;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    z-index: 1001;
}

#help-button:hover {
    background-color: #333;
}

/* Styles pour les contrôles de redimensionnement */
.resize-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 10px;
}

.resize-controls button,
.resize-controls a {
  background-color: black;
  color: white;
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.resize-controls button:hover,
.resize-controls a:hover {
  background-color: #333;
}

.resize-controls i {
  font-size: 16px;
  margin-right: 5px;
}

#nodes-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

#nodes-list li {
    margin-bottom: 5px;
    padding: 5px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

#all-nodes {
    max-height: 200px;
    overflow-y: auto;
}

#node-info {
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}

#nodes-list li.selected-node {
    background-color: #e0e0e0;
    font-weight: bold;
    color: #000;
    border-left: 4px solid #000;
    padding-left: 8px;
}

.selected-relation {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #000;
    border-left: 4px solid #000;
}

#node-type {
  margin-right: 10px;
  padding: 5px;
  font-size: 14px;
  width: 100px;
}

/* Désactiver les pointer-events pour les deux panneaux */
.sidebar, .sidebar-right {
  pointer-events: none;
}

/* Réactiver les pointer-events pour les éléments interactifs dans les panneaux */
.sidebar *, .sidebar-right * {
  pointer-events: auto;
}

/* Styles pour montrer/cacher les panneaux */
.hide-panel {
  display: none !important;
}

.show-panel {
  display: table-cell !important;
}

/* Styles pour la boîte de dialogue SweetAlert2 */
.custom-swal-popup {
    font-size: 14px;
    border-radius: 8px;
    padding: 20px;
}

.custom-swal-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.custom-swal-content {
    font-size: 14px;
    color: #555;
}

.custom-swal-confirm-button, .custom-swal-cancel-button {
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    margin: 0 5px;
}

.custom-swal-confirm-button {
    background-color: #007bff;
    color: white;
    border: none;
}

.custom-swal-cancel-button {
    background-color: #6c757d;
    color: white;
    border: none;
}

#edit-node-panel, #edit-relation-panel {
  margin-top: 15px;
  transition: all 0.3s ease;
}

#edit-node-name, #edit-relation-label {
  width: 100%;
  margin-bottom: 8px;
}

/* Styles pour les boutons Update */
#update-node-btn, #update-relation-btn {
  width: 100%;
  padding: 5px;
  background-color: #f0f0f0;
  color: black;
  border: 1px solid #ccc;
  cursor: pointer;
  margin-top: 5px;
}

#update-node-btn:hover, #update-relation-btn:hover {
  background-color: #e0e0e0;
}

/* Cache le panel remove node par défaut */
#remove-node-panel {
  display: none;
}

/* Affiche le panel remove node quand un nœud est sélectionné */
.has-selected-node #remove-node-panel {
  display: block;
}

/* Cache le panel remove relation par défaut */
#remove-relation-panel {
  display: none;
}

/* Affiche le panel remove relation quand une relation est sélectionnée */
.has-selected-relation #remove-relation-panel {
  display: block;
}

/* Node Attributes Panel Styles */
#node-attributes-panel {
  margin-top: 15px;
}

#attributes-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
}

/* Solution finale pour les boutons de suppression */
.attribute-item {
  display: grid !important;
  grid-template-columns: 1fr 20px !important;
  align-items: center;
  gap: 5px;
  padding: 5px;
  margin-bottom: 5px;
  background-color: #f0f0f0;
  border-radius: 4px;
}

.delete-attribute {
  all: unset
}
.add-attribute {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* Styles pour les éléments de sélection (type et langue) */
#attribute-type, #attribute-lang {
  flex: 1;
  min-width: 100px;
  padding: 5px;
}

/* Ajustement pour les champs de texte */
#new-attribute-name, #new-attribute-value {
  flex: 2;
  min-width: 120px;
}

/* Style pour le bouton d'ajout */
#add-attribute-btn {
  flex: 1;
  min-width: 100%;
  margin-top: 5px;
}

.attribute-lang {
  display: none;
}

.attribute-lang.show-lang {
  display: block;
}

#node-attributes ul {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
}

#node-attributes li {
  margin-bottom: 5px;
  padding: 5px;
  background-color: #f0f0f0;
  border-radius: 4px;
  font-size: 14px;
}

#node-attributes strong {
  color: #333;
}

#add-node {
  margin-bottom: 8px; /* Ajoute le même espacement qu'entre les autres champs */
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.version {
  font-size: 0.8em;
  color: #666;
}

.popup-tabs {
  display: flex;
  border-bottom: 1px solid #ccc;
  margin-bottom: 15px;
}

.tab-button {
  background: #f1f1f1;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 15px;
  margin-right: 2px;
  border-radius: 5px 5px 0 0;
  transition: 0.3s;
}

.tab-button:hover {
  background: #ddd;
}

.tab-button.active {
  background: #3498db;
  color: white;
}

.tab-content {
  padding: 10px 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.button-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.primary-button, .secondary-button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
}

.primary-button {
  background-color: black;
  color: white;
  border: 1px solid #333;
}

.primary-button:hover {
  background-color: #ddd;
}

.secondary-button {
  background-color: #f1f1f1;
  color: #333;
}

.secondary-button:hover {
  background-color: #ddd;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.shortcuts-table tr:nth-child(even) {
  background-color: #f2f2f2;
}

.shortcuts-table td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
}

.shortcuts-table kbd {
  background-color: #f7f7f7;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  color: #333;
  display: inline-block;
  font-family: monospace;
  font-size: 0.85em;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

/* Styles for the help popup */
.popup-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 5px;
}

.tab-button {
  background: #333;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 5px;
  transition: all 0.3s ease;
  font-size: 14px;
  color: white;
  margin-bottom: 5px;
  flex-grow: 1;
  text-align: center;
  min-width: 100px;
}

.tab-button:hover {
  background: #555;
}

.tab-button.active {
  background: black;
  font-weight: bold;
}

.interface-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

.interface-item {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  border-left: 4px solid black;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.interface-item h4 {
  margin-top: 0;
  color: black;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px dashed #eee;
}

.feature-section:last-child {
  border-bottom: none;
}

.feature-section h4 {
  color: black;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-section h4 i {
  font-size: 16px;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.shortcuts-table th {
  text-align: left;
  background-color: black;
  color: white;
  padding: 10px;
}

.shortcuts-table td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

.shortcuts-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

.shortcuts-table tr:hover {
  background-color: #f1f1f1;
}

.tab-content {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 10px;
}

/* Couleurs unifiées en noir */
#welcome .feature-section,
#getting-started .feature-section,
#nodes .feature-section,
#relations .feature-section,
#visualization .feature-section,
#import-export .feature-section {
  border-left-color: black;
}

#welcome h3 i,
#getting-started h3 i,
#nodes h3 i,
#relations h3 i,
#visualization h3 i,
#import-export h3 i {
  color: black;
}

/* Scrollbar styling */
.tab-content::-webkit-scrollbar {
  width: 8px;
}

.tab-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.tab-content::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
  background: black;
}

/* Dans la section .resize-controls */
.resize-controls button#freeze-graph {
  background-color: black;
  color: white;
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.resize-controls button#freeze-graph:hover {
  background-color: #333;
}

.resize-controls button#freeze-graph.frozen {
  background-color: #d9534f; /* Rouge pour indiquer que c'est actif */
}

.resize-controls button#freeze-graph i {
  font-size: 16px;
  margin-right: 5px;
}