@import url("https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700&display=swap");

/* ========================================
VARIABLES CSS - THÈME CLAIR
======================================== */
:root {
  /* Couleurs de fond */
  --bg-color: #fdfdfd;
  --bg-primary: #f0f2f5;
  --bg-secondary: #becddd;
  --bg-tertiary: #c8d0d6;
  --form-section-bg: #f8f9fa;

  /* Couleurs de texte */
  --text-color: #1c3641;
  --text-primary: #1c3641;
  --text-secondary: #6c757d;

  /* Sidebar et navigation */
  --sidebar-bg: linear-gradient(145deg, #e6eef2, #d8e3e8);

  /* Boutons */
  --button-bg: #45b7af;
  --button-text: #ffffff;
  --button-hover: #3ca29a;

  /* Bordures et séparateurs */
  --input-border: #dee2e6;
  --border-color: #b0b9c2;
  --table-border: #dee2e6;
  --card-border: #dee2e6;

  /* Ombres */
  --controls-shadow:
    0 8px 16px rgba(0, 0, 0, 0.06), 0 4px 4px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
  --shadow-panel: 8px 0 16px rgba(0, 0, 0, 0.1);
  --shadow-top: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-bottom: 0 -2px 4px rgba(0, 0, 0, 0.1);

  /* Effets de survol */
  --table-hover-bg: rgba(69, 183, 175, 0.05);

  /* Suggestions et recherche */
  --suggestion-hover: #f0f8f7;
  --highlight-bg: #45b7af;

  /* Couleurs de liens */
  --link-color: #ccc;
  --accent-color: #45b7af;
  --accent-hover: #3ca29a;

  /* Couleurs des nœuds de l'arbre */
  --color-male: #5b9bd5;
  --color-female: #e57373;
  --color-root-bg: rgba(21, 217, 29, 0.24);
  --color-root-stroke: #166534;
  --accent-color-alpha: rgba(69, 183, 175, 0.2);
  --accent-color-alpha-light: rgba(69, 183, 175, 0.1);

  /* Couleurs des graphiques */
  --chart-color-1: #45b7af;
  --chart-color-2: #ff69b4;
  --chart-color-3: #808080;
  --chart-color-4: #4caf50;
  --chart-color-5: #607d8b;

  /* Rayons de bordure */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 20px;
  --radius-full: 30px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
}

/* ========================================
VARIABLES CSS - MODE SOMBRE
======================================== */
.dark-mode {
  /* Couleurs de fond */
  --bg-color: #1e293b;
  --bg-primary: #1e293b;
  --bg-secondary: #293d58;
  --bg-tertiary: #151c29;
  --form-section-bg: #2a2a2a;

  /* Couleurs de texte */
  --text-color: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;

  /* Sidebar et navigation */
  --sidebar-bg: linear-gradient(145deg, rgba(15, 23, 42, 0.82), #192235);

  /* Boutons */
  --button-bg: #45b7af;
  --button-text: #1a1a1a;
  --button-hover: #3ca29a;

  /* Bordures */
  --input-border: #4a4a4a;
  --border-color: #334155;
  --table-border: #4a4a4a;
  --card-border: #4a4a4a;

  /* Effets de survol */
  --table-hover-bg: rgba(69, 183, 175, 0.1);

  /* Suggestions */
  --suggestion-hover: #333333;

  /* Couleurs de liens */
  --link-color: #4a4a4a;
  --highlight-bg: #45b7af;
}

/* ========================================
RESET ET STYLES DE BASE
======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  padding: 10px 30px;
  transition: all var(--transition-base);
  margin-left: 60px;
  overflow-x: hidden;
}

/* ========================================
TYPOGRAPHIE
======================================== */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 0.5rem;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  padding-right: 10px;
  color: var(--accent-color);
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
}

h4 {
  font-size: 0.9rem;
  margin-top: 4px;
  color: var(--accent-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
SCROLLBAR
======================================== */
/* WebKit */
::-webkit-scrollbar {
  width: 4px; /* encore plus fin */
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 120, 0.4);
  border-radius: 10px;
  border: 1px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 120, 0.6);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 120, 0.4) transparent;
}

/* ========================================
ROOT TAB
======================================== */
.root-tab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001;
  display: flex;
  align-items: stretch;
}

.root-tab-handle {
  background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  align-items: center;
  min-height: 200px;
}

.root-tab-header {
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.root-tab-header:hover {
  background: var(--accent-color-alpha-light);
  border-radius: var(--radius-sm);
}

.root-tab-name {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 15px 10px;
  transition: color var(--transition-fast);
}

.root-tab-header:hover .root-tab-name {
  color: white;
}

.root-tab-arrow {
  padding: 15px 0 10px 0;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  writing-mode: horizontal-tb;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.root-tab-header:hover .root-tab-arrow {
  color: var(--accent-color);
}

.root-tab-arrow i {
  transition: transform var(--transition-base);
  display: inline-block;
}

.root-tab-arrow.rotated i {
  transform: rotate(180deg);
}

.root-tab-icons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 15px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}

.root-tab-icon {
  width: 40px;
  height: 40px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.2rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.root-tab-icon:hover {
  color: var(--accent-color);
}

.root-tab-icon .tooltip {
  position: absolute;
  left: calc(100% + 4px);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
  z-index: 5000;
}

.root-tab-icon:hover .tooltip {
  opacity: 1;
}

/* ========================================
MODE SOMBRE - TOGGLE
======================================== */
#dark-mode-toggle .fa-sun {
  display: none;
}

.dark-mode #dark-mode-toggle .fa-sun {
  display: inline-block;
}

.dark-mode #dark-mode-toggle .fa-moon {
  display: none;
}

/* ========================================
CONTENEURS PRINCIPAUX
======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-size: 0.8rem;
  transition: all var(--transition-base);
}

.tree-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  margin-top: 30px;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: 1;
}

/* ========================================
EN-TÊTES ET SECTIONS
======================================== */
.form-header {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid var(--input-border);
  flex-wrap: wrap;
}

.form-header .header-search {
  flex: 1;
  min-width: 300px;
}

/* ========================================
CONTRÔLES ET ACTIONS
======================================== */
.controls {
  padding: 55px 20px 10px 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-color);
  box-shadow: var(--shadow-md);
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.controls-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls-title i {
  color: var(--accent-color);
}

.controls-actions {
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: row-reverse;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 9px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.action-button:hover {
  background: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.action-button:active {
  transform: translateY(0);
}

.action-button i {
  font-size: 0.9rem;
}

#setDefaultButton.active {
  background-color: var(--button-bg);
}

#setDefaultButton.active:hover {
  background-color: var(--button-hover);
}

#returnToDefaultButton {
  background-color: var(--bg-color);
}

#returnToDefaultButton:hover {
  background-color: var(--border-color);
}

.note-link {
  color: #45b7af;
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s ease;
}

.note-link:hover {
  color: #2a8f89;
  text-decoration: underline;
}

/* Mode sombre */
body.dark-mode .note-link {
  color: #6dd4cc;
}

body.dark-mode .note-link:hover {
  color: #45b7af;
}

/* ========================================
FORMULAIRES ET INPUTS
======================================== */
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast);
  background-color: var(--bg-color);
  color: var(--text-color);
}

.form-control:focus {
  border-color: var(--button-bg);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-color-alpha);
}

.form-body {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.form-section {
  background: var(--bg-tertiary);
  padding: 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 0.85rem;
}

.gender-select {
  width: auto;
  min-width: 100px;
  max-width: 120px;
  padding: 8px 16px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 0.85rem;
}

.generation-select {
  padding: 10px 38px 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
}

.generation-select:hover {
  border-color: var(--accent-color);
}

.death-info {
  display: none;
}

.death-placeholder {
  pointer-events: none;
}

.death-placeholder .form-control {
  border-color: transparent;
  background: transparent;
}

/* ========================================
SECTION DES RELATIONS
======================================== */
.relation-section {
  margin: 20px auto;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.relation-select {
  width: 100%;
  padding: 8px 16px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 0.85rem;
}

.relation-search-container {
  position: relative;
  width: 100%;
  min-width: 200px;
}

.relation-search-input {
  width: 100%;
  padding: 8px 16px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  background-color: var(--bg-color);
  color: var(--text-color);
}

.relation-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: var(--controls-shadow);
}

.relation-search-results.show {
  display: block;
}

.relation-search-item {
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-color);
}

.relation-search-item:hover {
  background-color: var(--suggestion-hover);
}

.existing-relation {
  background-color: var(--bg-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text-color);
}

.temp-relation {
  background-color: var(--button-bg);
  border-color: var(--button-hover);
  color: var(--button-text);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
}

.temp-relations-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.existing-relations,
.temp-relations {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.relation-type-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-color);
  padding: 25px;
  border-radius: var(--radius-md);
  max-width: 550px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

#marriageNotes {
  resize: vertical; /* L'utilisateur ne peut l'agrandir qu'en hauteur */
}

/* ========================================
RECHERCHE ET SUGGESTIONS
======================================== */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  border-color: var(--button-bg);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-color-alpha);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-color);
  opacity: 0.5;
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-color);
  opacity: 0.5;
  cursor: pointer;
  display: none;
  padding: 5px;
  transition: opacity var(--transition-fast);
}

.clear-search:hover {
  opacity: 1;
}

.search-input:not(:placeholder-shown) ~ .clear-search {
  display: block;
}

.search-input:not(:placeholder-shown) ~ .search-icon {
  display: none;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: var(--controls-shadow);
}

.search-suggestions.show {
  display: block;
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border-bottom: 1px solid var(--input-border);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background-color: var(--bg-tertiary);
}

.suggestion-main {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-color);
}

.suggestion-details {
  font-size: 0.75rem;
  color: var(--text-color);
  opacity: 0.7;
  display: flex;
  gap: 12px;
}

.name-initials { display: none; }
.date-year { display: none; }

.suggestion-highlight {
  background-color: var(--accent-color);
  color: white;
  padding: 0 2px;
  border-radius: 2px;
}

/* ========================================
INDEX ALPHABÉTIQUE
======================================== */
.alphabet-index {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 20px;
  justify-content: center;
}

.letter-btn {
  padding: 5px 10px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-tertiary);
  color: var(--text-color);
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  text-decoration: none;
}

.letter-btn:hover {
  background: var(--bg-color);
}

/* ========================================
BOUTONS
======================================== */
.btn-submit {
  background: var(--button-bg);
  color: var(--button-text);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.form-buttons-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.btn-submit .fas {
  margin-right: 8px;
}

.btn-submit:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.btn-action {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  margin-left: 8px;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.btn-edit {
  border: none;
  margin-right: 12px;
  background: transparent;
  color: var(--button-hover);
}

.btn-edit:hover {
  opacity: 0.8;
  transform: translateY(-1px);
  cursor: pointer;
}

/* ========================================
TABLEAUX
======================================== */
.table-container {
  margin-top: 25px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--table-border);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.table th {
  background: var(--text-color);
  color: var(--border-color);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--button-bg);
  font-weight: 600;
}

.table td {
  padding: 6px 4px;
  border-top: 1px dotted var(--input-border);
  font-size: 0.67rem;
  vertical-align: middle;
  color: var(--text-color);
  background: var(--bg-tertiary);
}

.table tr {
  transition: background-color var(--transition-fast);
}

.table tr:hover {
  background: var(--table-hover-bg);
}

/* ========================================
PAGINATION
======================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.page-ellipsis {
  padding: 8px 16px;
  color: var(--text-color);
}

.page-btn {
  padding: 8px 16px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--bg-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-color);
}

.page-btn:hover {
  background: var(--form-section-bg);
}

.page-btn.active {
  background: var(--button-bg);
  color: var(--button-text);
  border-color: var(--button-bg);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
GROUPES DE STATUT (VIVANT/DÉCÉDÉ)
======================================== */
.status-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-button {
  padding: 8px 16px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--bg-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-color);
}

.status-button.active {
  border-color: var(--button-hover);
  color: var(--text-color);
  background: var(--button-bg);
}

/* ========================================
CHECKBOXES
======================================== */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.checkbox-wrapper:hover {
  background: var(--accent-color-alpha-light);
}

input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-color);
  width: 16px;
  height: 16px;
}

label {
  cursor: pointer;
  user-select: none;
}

/* ========================================
BARRE DE RECHERCHE (TREE-FAMILY)
======================================== */
.controls-actions .search-bar {
  position: relative;
  width: 350px;
  max-width: 100%;
}

.controls-actions .search-bar input {
  width: 100%;
  padding: 10px 42px 10px 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.controls-actions .search-bar input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-color-alpha-light);
}

.controls-actions .search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-color);
  pointer-events: none;
}

.controls-actions .search-bar .clear-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
  transition: color var(--transition-fast);
  padding: 5px;
  border-radius: 50%;
}

.controls-actions .search-bar .clear-icon:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

.controls-actions .search-bar input:not(:placeholder-shown) + .clear-icon,
.controls-actions .search-bar.has-text .clear-icon {
  display: block;
}

/* ========================================
RÉSULTATS DE RECHERCHE
======================================== */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  animation: slideDown 0.2s ease;
}

.search-result-item {
  padding: 12px 15px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--border-color);
}

.search-result-name {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.search-result-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-highlight {
  background-color: var(--highlight-bg);
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 600;
}

.no-results {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ========================================
PANNEAU D'INFORMATIONS PERSONNELLES
======================================== */
.person-panel {
  margin-top: 50px;
  position: fixed;
  left: 0;
  top: 0;
  height: 94vh;
  width: 350px;
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-panel);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.person-panel.is-open {
  transform: translateX(0);
}

.close-panel-button {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-primary);
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition-fast);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

.close-panel-button:hover {
  opacity: 1;
  color: var(--accent-color);
  background: var(--accent-color-alpha-light);
}

.quick-view-btn {
  margin: 4px auto 4px 0px;
  font-size: 1em;
  position: relative;
}

.panel-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.panel-header.fixed-header {
  background-color: var(--bg-tertiary);
  margin: 0;
  padding: 10px 20px 10px 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-top);
  z-index: 100;
}

.panel-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.panel-footer.fixed-footer {
  background-color: var(--bg-tertiary);
  margin: 0;
  padding: 4px 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-bottom);
  z-index: 100;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.panel-footer.fixed-footer p {
  margin: 0;
}

.panel-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-header h3 {
  font-size: 0.85rem;
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
}

.panel-header .quick-view-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.panel-header .quick-view-btn:hover {
  color: var(--accent-color);
  background: var(--bg-color);
}

.panel-header .quick-view-btn .qv-label {
  font-size: 0.7rem;
}

.panel-content h4 {
  font-size: 0.95rem;
  margin-bottom: 5px;
  color: var(--accent-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-info-group {
  margin-bottom: 10px;
  background: var(--bg-primary);
  padding: 6px 5px 6px 5px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.panel-info-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.75rem;
  gap: 10px;
}

.panel-info-item:last-child {
  border-bottom: none;
}

.panel-label {
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.panel-value {
  color: var(--text-secondary);
  text-align: left;
  word-break: break-word;
}

.marriage-group {
  border-left: 3px solid var(--accent-color);
  padding-left: 12px;
  margin-bottom: 15px;
}

.spouse-name {
  font-weight: 700;
  margin-bottom: 8px;
  border-bottom: none !important;
}

/* ========================================
STATISTIQUES (statistics.html)
======================================== */
.stats-grid {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  width: 100%;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--controls-shadow);
  border: 1px solid var(--card-border);
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stat-card-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.stat-card-icon {
  color: var(--button-bg);
}

.stat-card-icon.fa-heart {
  color: #4caf50;
}

.stats-details {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stats-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  box-shadow: var(--controls-shadow);
  flex: 1 1 auto;
  min-width: 0;
}

.stats-list li {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-border);
}

.stats-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.stats-label-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  margin-top: 0.4rem;
}

.stats-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.tabs-container {
  margin-bottom: 30px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-evenly;
}

.tab-button {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.tab-button:hover {
  color: var(--accent-color);
}

.tab-button.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========================================
LOADER / CHARGEMENT (MÉCANISME UNIQUE)
======================================== */
.loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.dark-mode .loader-overlay {
  background: rgba(30, 41, 59, 0.9);
}

.loader {
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

.loading-spinner i,
.loading i {
  font-size: 2rem;
  margin-bottom: 15px;
  animation: spin 1s linear infinite;
}

.loader-overlay p {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
}

/* ========================================
NŒUDS ET ÉLÉMENTS D'ARBRE (D3.js)
======================================== */

/* Rectangles des nœuds (nouvelle structure) */
.node rect {
  fill: var(--bg-color);
  stroke: var(--text-secondary);
  stroke-width: 1.5px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.node:hover rect {
  filter: brightness(1.05);
  stroke-width: 2px;
}

.node rect.male {
  fill: var(--bg-tertiary);
  stroke: var(--color-male);
}

.node rect.female {
  fill: var(--bg-tertiary);
  stroke: var(--color-female);
}

.node rect.unknown {
  fill: var(--bg-tertiary);
  stroke: var(--text-secondary);
}

/* Nœud racine avec bordure verte */
.node.root-node rect {
  fill: var(--color-root-bg);
  stroke: var(--color-root-stroke);
  stroke-width: 2.5px;
}

/* Lien de mariage (trait plein par défaut) */
.marriage-link {
  fill: none;
  stroke: var(--link-color);
  stroke-width: 2px;
}

/* Lien de mariage en pointillés (quand plusieurs conjoints) */
.marriage-link-multiple {
  fill: none;
  stroke: var(--link-color);
  stroke-dasharray: 4 2;
  stroke-width: 2px;
}

/* Date de mariage */
.marriage-date {
  font-size: 16px;
  fill: var(--text-primary);
  pointer-events: none;
}

/* Texte des nœuds - hérite du font-size de .tree-container (10px) */
.node-text {
  fill: var(--text-primary);
  pointer-events: none;
}

.node-text-firstname {
  font-size: 1.3em; /* 9px relatif au 10px de .tree-container */
}

.node-text-lastname {
  text-transform: uppercase;
  font-size: 1.3em; /* 9px relatif au 10px de .tree-container */
}

.node-text-dates {
  font-size: 1.2em; /* 8px relatif au 10px de .tree-container */
  fill: var(--text-secondary);
}

/* Liens entre les nœuds */
.link {
  fill: none;
  stroke: var(--link-color);
  stroke-width: 2px;
}

.sibling-link,
.spouse-link,
.spouse-link-single,
.child-link {
  stroke: var(--link-color);
  stroke-width: 2px;
}

.sibling-link,
.spouse-link,
.child-link {
  fill: none;
}

/* Numéros et symboles de mariage */
.marriage-number {
  font-size: 0.95rem;
  fill: var(--text-secondary);
}

.marriage-symbol-year {
  fill: var(--text-primary);
  font-weight: 500;
  pointer-events: none;
}


/* ========================================
TOOLTIPS GÉNÉRAUX
======================================== */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip-wrapper .tooltip {
  position: absolute;
  left: 50%;
  top: 200%;
  transform: translateX(-50%);
  background: var(--bg-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
  z-index: 10000;
}

.tooltip-wrapper:hover .tooltip {
  opacity: 1;
}

/* ========================================
SYSTÈME DE STATISTIQUES FLEXIBLES
======================================== */

.stats-flex-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.stats-box h2 {
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: var(--accent-color);
}

/* Classes flex pour contrôler la taille */
.flex-1 {
  flex: 1 1 0;
  min-width: 300px;
}

.flex-2 {
  flex: 2 1 0;
  min-width: 300px;
}

.flex-3 {
  flex: 3 1 0;
  min-width: 300px;
}

.flex-full {
  flex: 1 1 100%;
  width: 100%;
}

.flex-fixed {
  flex: 0 0 auto;
}

.flex-no-shrink {
  flex: 1 0 auto;
  min-width: 300px;
}

.flex-no-grow {
  flex: 0 1 auto;
}

.flex-25 {
  flex: 0 0 25%;
  min-width: 250px;
}

.flex-33 {
  flex: 0 0 33.333%;
  min-width: 300px;
}

.flex-50 {
  flex: 0 0 50%;
  min-width: 350px;
}

.flex-66 {
  flex: 0 0 66.666%;
  min-width: 400px;
}

.flex-75 {
  flex: 0 0 75%;
  min-width: 450px;
}

/* Contenu des stats-box */
.stats-list {
  list-style: none;
}

.stats-value {
  font-weight: 600;
  color: var(--accent-color);
}

/* Barres de progression */
.progress-bar {
  height: 8px;
  background: var(--bg-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* Lieux */
.places-grid {
  display: flex;
  gap: 12px;
}

.places-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.places-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.place-item,
.event-item {
  display: flex;
  justify-content: space-between;
  background: var(--bg-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.place-item:hover,
.event-item:hover {
  background: var(--table-hover-bg);
  border-color: var(--accent-color);
}

.place-item {
  align-items: flex-end;
  padding: 10px 15px;
}

.place-name {
  font-weight: 500;
  color: var(--text-primary);
}

.place-count {
  font-weight: 600;
  color: var(--accent-color);
}

/* Événements */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.event-item {
  align-items: center;
  padding: 12px 15px;
}

.event-info {
  flex: 1;
}

.event-name {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.event-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.event-date {
  font-weight: 600;
  color: var(--accent-color);
}

/* Fréquences */
.frequency-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.frequency-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: var(--bg-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.frequency-item:hover {
  background: var(--table-hover-bg);
  border-color: var(--accent-color);
}

.frequency-name {
  font-weight: 500;
  color: var(--text-primary);
}

.frequency-count {
  font-weight: 600;
  color: var(--accent-color);
  padding: 4px 12px;
  background: var(--accent-color-alpha-light);
  border-radius: var(--radius-sm);
}

/* État vide */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: var(--text-secondary);
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
}

/* Spinner de chargement */
.loading-spinner {
  text-align: center;
  padding: 20px;
  color: var(--accent-color);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ========================================
RESPONSIVE DESIGN
======================================== */

/* --- Écrans ≤ 768px : mobiles standards --- */
@media (max-width: 768px) {
  body {
    margin-left: 0px;
    padding: 10px 10px;
  }

  .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
  }

  .controls-title {
    justify-content: center;
  }

  .controls-header {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    gap: 0px;
    align-items: center;
    justify-content: center;
  }

  .tab-button {
    padding: 5px 15px;
    font-size: 0.7rem;
    border: none;
    gap: 8px;
  }

  .search-bar,
  .search-bar.tree-search,
  .controls-actions .search-bar,
  .controls-actions .search-input-wrapper {
    width: 100%;
  }

  .suggestion-details {
    flex-wrap: wrap;
    font-size: 0.7rem;
  }

  .name-full { display: none; }
  .name-initials { display: inline; font-size: 0.5rem; }
  .date-full { display: none; }
  .date-year { display: inline; }

  .person-panel {
    width: 100%;
    max-width: 350px;
  }

  .lieu-badge {
    font-size: 0.55rem;
  }

  .legend {
    top: auto;
    bottom: 10px;
    right: 60px;
    max-width: 220px;
    font-size: 0.85rem;
  }

  .tree-container {
    /* Reste en plein écran sur mobile aussi */
    width: 100vw;
    height: 100vh;
  }

  .stats-flex-row {
    flex-direction: column;
    gap: 15px;
  }

  .stats-box,
  .flex-25,
  .flex-33,
  .flex-50,
  .flex-66,
  .flex-75 {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .stats-grid,
  .stats-details {
    width: 100%;
    margin: 0 auto 14px auto;
    text-align: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.2rem;
  }

  .stat-card {
    width: auto;
    flex: 1;
    padding: 0.1rem 0.1rem;
    font-size: 0.75rem;
  }

  .stat-card-header {
    margin-bottom: 0rem;
    flex-direction: column;
  }

  /* Formulaires en colonne */
  .form-body,
  .controls-actions {
    flex-direction: column;
    margin-top: 20px;
  }

  .form-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    justify-content: center;
  }

  .form-header .header-search {
    order: 1;
    width: 100%;
    min-width: 100%;
  }

  .form-header .status-group {
    order: 2;
    flex-direction: row !important;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    width: auto;
    min-width: unset;
  }

  .form-header .status-group .status-button {
    width: auto;
    min-width: unset;
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .form-header .gender-select {
    order: 2;
    flex: 0 0 auto;
    width: 28%;
    min-width: unset;
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .status-button,
  .relation-section,
  .btn-submit,
  .action-button {
    width: 100%;
    justify-content: center;
  }

  .form-buttons-container {
    flex-direction: row;
  }

  .form-buttons-container .btn-submit {
    width: auto;
    min-width: unset;
    flex: 1;
  }

  /* Tableaux scrollables */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 0.75rem;
  }

  /* Index alphabétique compact */
  .alphabet-index {
    gap: 3px;
  }

  .letter-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  /* Pagination compacte */
  .pagination {
    gap: 5px;
  }

  .page-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* Boutons en colonne */
  .marriage-item {
    flex-direction: column;
    gap: 10px;
  }

  .marriage-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  /* Burger menu */
  .burger-menu {
    display: flex;
    position: fixed;
    left: 10px;
    width: 32px;
    height: 32px;
    z-index: 4000;
    margin: 0;
  }

  .burger-nav {
    display: block;
    width: 280px;
    left: -280px;
  }

  .burger-nav-header {
    padding: 10px;
  }

  .burger-nav-header h2 {
    font-size: 1.1rem;
  }

  .burger-nav-item {
    gap: 15px;
    padding: 4px 20px;
    font-size: 0.8rem;
  }

  /* Masquer le root-tab sur mobile */
  .root-tab {
    display: none !important;
  }

  /* Top bar */
  .top-fixed-bar {
    height: auto;
    min-height: 70px;
    padding: 10px 10px 8px 50px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-tertiary);
  }

  .desktop-only {
    display: none !important;
  }

  .controls-title {
    font-size: 0.9rem;
    gap: 6px;
  }

  .current-person-wrapper {
    display: initial !important;
    margin-top: 8px;
    font-size: 0.75em;
    text-align: center;
    width: 100%;
  }

  .controls-actions {
    gap: 4px;
  }

  .legend-inline {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .legend-controls {
    display: flex;
    gap: 2px;
  }

  .checkbox-inline {
    font-size: 0;
  }

  .checkbox-inline i {
    font-size: 0.8rem;
  }

  .checkbox-inline input {
    width: 12px;
    height: 12px;
  }

  .navigation-help-inline {
    display: none !important;
  }

  /* Afficher les contrôles zoom */
  .zoom-controls {
    display: flex;
    gap: 5px;
  }

  .zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  /* Panneau plein écran sur mobile */
  .person-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    margin-top: 0;
    top: 70px;
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
  }

  .person-panel.is-open {
    transform: translateX(0);
  }

  /* Ajuster le contenu du panneau */
  .panel-content-scroll {
    padding: 15px;
  }

  /* Controls-actions : recherche + générations sur une ligne */
  .controls-actions {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }

  .controls-actions .search-bar {
    flex: 1;
    min-width: 150px;
  }

  .controls-actions .generation-select {
    width: auto;
    min-width: 120px;
  }

  /* Masquer les boutons d'action desktop sur mobile */
  .controls-actions .action-button {
    display: none !important;
  }

  /* Masquer le bouton centrer desktop quand sur mobile */
  #centerButton {
    display: none;
  }
}

/* --- Écrans ≤ 480px : petits mobiles --- */
@media (max-width: 480px) {
  .container {
    max-width: 100%;
    padding: 10px;
    font-size: 0.75rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .form-control,
  .relation-select,
  .search-input {
    font-size: 0.8rem;
  }

  .table {
    font-size: 0.7rem;
  }

  .table th {
    font-size: 0.75rem;
  }

  .table td {
    font-size: 0.55rem;
  }

  .person-panel {
    width: 100%;
  }

  .legend {
    bottom: 5px;
    right: 50px;
    max-width: 180px;
    font-size: 0.75rem;
  }

  .burger-nav {
    width: 275px;
    left: -275px;
  }

  .burger-nav-item {
    padding: 4px 15px;
    gap: 12px;
  }

  .zoom-controls {
    bottom: 15px;
    gap: 4px;
  }

  .zoom-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .person-panel {
    margin-top: 0;
    top: 70px;
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
  }

  .controls-actions .search-bar {
    min-width: 120px;
  }

  .controls-actions .generation-select {
    min-width: 100px;
    font-size: 0.85rem;
  }
}

/* ========================================
ANIMATIONS
======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
UTILITAIRES
======================================== */
.text-center {
  text-align: center;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 2rem;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-1 {
  gap: 1rem;
}

.hidden {
  display: none;
}

/* ========================================
   GESTION DES LIEUX - STYLES
   ======================================== */

.lieu-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin: 0 3px;
}

.badge-naissance {
  background: rgba(76, 175, 80, 0.2);
  color: var(--chart-color-4);
}

.badge-deces {
  background: rgba(128, 128, 128, 0.2);
  color: var(--chart-color-3);
}

.badge-mariage {
  background: rgba(255, 105, 180, 0.2);
  color: var(--chart-color-2);
}

.badge-parent {
  background: rgba(0, 123, 255, 0.2);
  color: var(--chart-color-1);
}

.badge-enfant {
  background: rgba(40, 167, 69, 0.2);
  color: var(--chart-color-4);
}

.badge-fratrie {
  background: rgba(255, 193, 7, 0.2);
  color: var(--chart-color-5);
}

.details-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.details-modal.active {
  display: flex;
}

.details-content {
  background: var(--bg-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--accent-color);
}

.person-item {
  padding: 10px 15px;
  background: var(--bg-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.person-item:hover {
  background: var(--table-hover-bg);
}

.lieu-text {
  margin-right: 1rem;
}

.person-info {
  font-weight: 500;
  font-size: 0.8rem;
}

.person-date {
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding-left: 10px;
}

.edit-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.edit-modal.active {
  display: flex;
}

.edit-content {
  background: var(--bg-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.stat-number {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.action-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-showDetails {
  background: var(--bg-tertiary);
  margin-right: 12px;
  border: none;
  color: #ff9800;
}

.btn-showDetails:hover {
  opacity: 0.8;
  transform: translateY(-1px);
  cursor: pointer;
}

.btn-delete,
.btn-close-modal {
  background: transparent;
  color: #f44336;
  border: none;
}

.btn-delete:hover,
.btn-close-modal:hover {
  opacity: 0.8;
  cursor: pointer;
  transform: translateY(-1px);
}

.empty-message {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-style: italic;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--accent-color);
}

/* ========================================
   MENU BURGER (Mobile uniquement ≤768px)
   ======================================== */

/* Bouton burger - masqué par défaut sur desktop */
.burger-menu {
  background: var(--button-bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.burger-menu:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

.burger-menu span {
  display: block;
  width: 20px;
  height: 3px;
  background: var(--button-text);
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* Navigation burger - masquée par défaut sur desktop */
.burger-nav {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  background: var(--bg-color);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  z-index: 4000;
  overflow-y: auto;
  transition: left var(--transition-base);
}

.burger-nav.active {
  left: 0;
}

/* En-tête du menu */
.burger-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
}

.burger-nav-header h2 {
  margin: 0 0 0 10px;
  font-size: 1.3rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.burger-nav-header h2 i {
  color: var(--accent-color);
}

.burger-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.burger-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Liste de navigation */
.burger-nav-list {
  list-style: none;
  margin: 0;
  padding: 0px 0px 10px 0px;
}

.burger-nav-list li {
  margin: 0;
}

.burger-nav-item {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.burger-nav-item:hover {
  background: var(--bg-tertiary);
  border-left-color: var(--accent-color);
}

.burger-nav-item.active {
  background: var(--table-hover-bg);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

.burger-nav-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  color: var(--accent-color);
}

/* Icônes jour/nuit burger menu : lune en mode clair, soleil en mode sombre */
.burger-nav-item .fa-sun { display: none; }
.burger-nav-item .fa-moon { display: inline-block; }
.dark-mode .burger-nav-item .fa-sun { display: inline-block; }
.dark-mode .burger-nav-item .fa-moon { display: none; }

.burger-nav-item span {
  flex: 1;
}

/* Divider */
.burger-nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 10px 20px;
}

/* Overlay */
.burger-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3500;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.burger-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mode sombre - ajustements spécifiques */
.dark-mode .burger-nav {
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.dark-mode .burger-menu {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}


/* Desktop - masquer le burger menu et afficher root-tab */
@media (min-width: 769px) {
  .burger-menu,
  .burger-nav,
  .burger-overlay {
    display: none !important;
  }

  .zoom-controls {
    display: none;
  }

  .root-tab {
    display: block;
  }
}

/* ========================================
   BARRE FIXE SUPÉRIEURE (TOP BAR)
   ======================================== */

.top-fixed-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 45px;
  background: var(--bg-tertiary);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 15px;
  z-index: 3000;
  box-shadow: var(--shadow-md);
}

/* Titre desktop */
.desktop-only {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

/* Nom de la personne */
.current-person-wrapper {
  font-size: 0.8em;
  color: var(--text-secondary);
  white-space: nowrap;
  display: none;
}

/* Légende inline */
.legend-inline {
  margin-left: auto;
  display: flex;
  color: var(--text-primary);
  gap: 3px;
  font-size: 0.8em;
}

.legend-controls {
  display: flex;
  gap: 15px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85em;
  cursor: pointer;
}

.checkbox-inline input {
  transform: scale(0.9);
  cursor: pointer;
}

.navigation-help-inline {
  font-size: 0.85em;
  margin-left: 10px;
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  gap: 5px;
}

.navigation-help-inline i,
.checkbox-inline i {
  color: var(--accent-color);
}


/* ========================================
   AMÉLIORATIONS MOBILE - ARBRE
   ======================================== */

/* Touch feedback sur les nœuds */
.node rect {
  -webkit-tap-highlight-color: transparent;
}

.node:active rect {
  filter: brightness(0.9);
  transform: scale(0.98);
}

.node.touched rect {
  filter: brightness(1.1);
  stroke-width: 3px;
}

/* Boutons de zoom flottants */
.zoom-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  gap: 8px;
  z-index: 2500;
}

.zoom-btn {
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.zoom-btn:active {
  transform: scale(0.95);
  background: var(--accent-color);
  color: white;
}

.zoom-btn:hover {
  background: var(--accent-color);
  color: white;
}

/* Bouton centrer mobile */
.zoom-btn.center-btn {
  background: var(--accent-color);
  color: white;
}

.zoom-btn.center-btn:active {
  background: var(--button-hover);
}

