/* ==== Légende de l'arbre ==== */
.tree-legend {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.tree-legend.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Masquer le bouton toggle quand la légende est visible */
.tree-legend-toggle.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Bouton toggle de la légende */
.tree-legend-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  background: rgba(59, 130, 246, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  backdrop-filter: blur(10px);
  z-index: 1001;
  transition: all 0.3s ease;
}

.tree-legend-toggle:hover {
  background: rgba(59, 130, 246, 1);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Header de la légende avec bouton fermer */
.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.legend-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.tree-legend h3 {
  margin: 0;
  font-size: 0.9rem;
  color: #1f2937;
  font-weight: 600;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.legend-color {
  width: 24px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

.sibling-color {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #3b82f6;
}

.spouse-color {
  background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
  border-color: #a855f7;
}

.child-color {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.selected-color {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  border-color: #f97316;
  border-width: 3px;
}

.legend-gender {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.legend-border {
  width: 24px;
  height: 16px;
  border-radius: 4px;
  background: #ffffff;
  border: 3px solid;
}

.male-border {
  border-color: #3b82f6;
}

.female-border {
  border-color: #ec4899;
}

/* Légende en mode sombre */
:root.theme-dark .tree-legend {
  background: rgba(31, 41, 55, 0.95);
  border-color: #374151;
  color: #f3f4f6;
}

:root.theme-dark .tree-legend h3 {
  color: #f3f4f6;
}

:root.theme-dark .legend-item {
  color: #d1d5db;
}

:root.theme-dark .legend-color {
  border-color: #374151;
}

:root.theme-dark .tree-legend-toggle {
  background: rgba(59, 130, 246, 0.9);
}

:root.theme-dark .tree-legend-toggle:hover {
  background: rgba(59, 130, 246, 1);
}

:root.theme-dark .legend-close {
  color: #9ca3af;
}

:root.theme-dark .legend-close:hover {
  background: #374151;
  color: #f3f4f6;
}

/* Styles pour le thème sombre */
:root.theme-dark .person-card,
:root.theme-dark .spouse-card {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

:root.theme-dark .person-card.male,
:root.theme-dark .spouse-card.male {
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

:root.theme-dark .person-card.female,
:root.theme-dark .spouse-card.female {
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.2);
}

:root.theme-dark .person-card.male:hover,
:root.theme-dark .spouse-card.male:hover {
  box-shadow: 0 8px 20px rgba(96, 165, 250, 0.3);
}

:root.theme-dark .person-card.female:hover,
:root.theme-dark .spouse-card.female:hover {
  box-shadow: 0 8px 20px rgba(244, 114, 182, 0.3);
}

:root.theme-dark .first-name {
  color: #f3f4f6;
}

:root.theme-dark .last-name {
  color: #d1d5db;
}

:root.theme-dark .dates {
  color: #9ca3af;
}

/* Frères et sœurs en mode sombre */
:root.theme-dark .person-card.sibling {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-color: #3b82f6;
}

:root.theme-dark .person-card.sibling:hover {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border-color: #60a5fa;
}

/* Personne sélectionnée en mode sombre */
:root.theme-dark .person-card.selected {
  background: linear-gradient(135deg, #c2410c 0%, #dc2626 100%);
  border-color: #ea580c;
}

:root.theme-dark .person-card.selected .first-name {
  color: #fed7aa;
}

:root.theme-dark .person-card.selected .last-name {
  color: #fdba74;
}

/* Conjoints en mode sombre */
:root.theme-dark .spouse-card {
  background: linear-gradient(135deg, #581c87 0%, #6b21a8 100%);
  border-color: #7c3aed;
}

:root.theme-dark .spouse-card:hover {
  background: linear-gradient(135deg, #6b21a8 0%, #7c3aed 100%);
  border-color: #8b5cf6;
}

/* Enfants en mode sombre */
:root.theme-dark .person-card.child {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  border-color: #059669;
}

:root.theme-dark .person-card.child:hover {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  border-color: #10b981;
}

:root.theme-dark .horizontal-bar,
:root.theme-dark .sibling-connection {
  background-color: #6b7280;
}

:root.theme-dark .spouse-connection {
  filter: brightness(1.3);
}

:root.theme-dark .children-connection-vertical,
:root.theme-dark .children-connection-horizontal {
  background-color: #a78bfa;
}

/* Responsive */
@media (max-width: 768px) {
  .siblings-group {
    gap: 1.5rem;
    padding-top: 25px;
    margin-top: 15px;
  }
  
  .children-groups {
    gap: 2rem;
  }
  
  .children-group {
    gap: 1rem;
  }
  
  .generation-1 {
    margin-top: 80px;
  }
  
  .person-card, .spouse-card {
    min-width: 140px;
    padding: 0.8rem 1rem;
    padding-top: 1.5rem;
  }
  
  /* Ajustements pour la personne sélectionnée sur mobile */
  .person-card.selected {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4), 0 0 0 3px rgba(249, 115, 22, 0.1);
  }
  
  .person-card.selected:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.5), 0 0 0 3px rgba(249, 115, 22, 0.15);
  }
  
  @keyframes selectedPulse {
    0%, 100% {
      box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4), 0 0 0 3px rgba(249, 115, 22, 0.1);
    }
    50% {
      box-shadow: 0 6px 24px rgba(249, 115, 22, 0.6), 0 0 0 4px rgba(249, 115, 22, 0.2);
    }
  }
  
  .person-card.child {
    min-width: 120px;
    padding: 0.6rem 0.8rem;
    padding-top: 1.2rem;
  }
  
  .gender-icon {
    width: 16px;
    height: 16px;
    top: 6px;
    left: 6px;
  }
  
  .person-card.child .gender-icon {
    width: 14px;
    height: 14px;
    top: 4px;
    left: 4px;
  }
  
  .first-name {
    font-size: 0.9rem;
  }
  
  .last-name {
    font-size: 0.85rem;
  }
  
  .dates {
    font-size: 0.8rem;
  }
  
  .person-card.child .first-name {
    font-size: 0.85rem;
  }
  
  .person-card.child .last-name {
    font-size: 0.8rem;
  }
  
  .person-card.child .dates {
    font-size: 0.75rem;
  }
  

  
  .tree-container{padding:0.5rem}
  .family-tree-section{padding:0.5rem}
  
  /* Légende responsive */
  .tree-legend {
    bottom: 10px;
    left: 10px;
    font-size: 0.8rem;
    padding: 0.75rem;
  }
  
  .tree-legend h3 {
    font-size: 0.85rem;
  }
  
  .legend-item {
    font-size: 0.75rem;
  }
  
  .legend-color,
  .legend-shadow {
    width: 20px;
    height: 14px;
  }
  
  /* Ajustements des connecteurs pour mobile */
  .siblings-horizontal-bar{height:2px}
  .person-card.sibling::before{width:2px;height:15px;top:-15px}
  .person-card.selected + .spouse-card::after, .spouse-card + .spouse-card::after{height:2px}
}/* static/css/ma-genealogie-tree.css */
/* Styles spécifiques pour l'arbre généalogique */

/* ==== Arbre généalogique ==== */
.family-tree-section{
  width:100%;
  max-width: 100vw;
  margin:0;
  padding:1rem;
  min-height:100vh;
  overflow-x: hidden;
}

.tree-header{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:0rem;
  border-bottom:2px solid rgba(59, 130, 246, 0.1);
  padding-bottom:1rem;
  position:relative;
}

.tree-header h2{
  font-size:1.8rem;
  margin:0;
  color:#1f2937;
  font-weight:600;
}

.back-btn{
  background:linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color:white;
  border:none;
  border-radius:10px;
  padding:.75rem 1.5rem;
  text-decoration:none;
  font-weight:500;
  cursor:pointer;
  transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:0 4px 12px rgba(107, 114, 128, 0.3);
  position:absolute;
  right:0;
}

.back-btn:hover{
  background:linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform:translateY(-2px);
  box-shadow:0 8px 20px rgba(107, 114, 128, 0.4);
}

/* Style pour l'ancien tree-container utilisé quand il n'y a pas le panneau d'infos */
.tree-container-legacy{
  overflow:hidden;
  padding:0;
  position:relative;
  width:100vw;
  height:100vh;
  cursor:grab;
  touch-action:none;
  /* Empêcher la sélection dans tout le conteneur */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.tree-container:active{
  cursor:grabbing;
}

.tree-wrapper{
  min-width:max-content;
  display:flex;
  flex-direction:column;
  align-items:center;
  position:relative;
  transform-origin:center center;
  transition:transform 0.2s ease;
  padding:0.5rem 2rem 2rem 2rem;
}

.generation{
  display:flex;
  flex-direction:column;
  align-items:center;
  margin:1rem 0;
}

.generation-0{
  position:relative;
}

.generation-1{
  position:relative;
  margin-top:100px;
}

/* ==== Style unifié pour toutes les cartes ==== */
.person-card, .spouse-card {
  position: relative;
  min-width: 180px;
  height: 90px;
  padding: 0 15px;
  background: #ffffff;
  border: 3px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 3;
  /* Empêcher la sélection du texte */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-sizing: border-box;
}

/* Bordures selon le genre */
.person-card.male, .spouse-card.male {
  border-color: #3b82f6;
}

.person-card.female, .spouse-card.female {
  border-color: #ec4899;
}

/* Prénom - positionné en haut */
.first-name {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* Nom de famille - centré verticalement */
.last-name {
  position: absolute;
  top: 50%;
  left: 15px;
  right: 15px;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  margin: 0;
  padding: 0;
}

/* Dates - positionnées en bas */
.dates {
  position: absolute;
  bottom: 15px;
  left: 15px;
  right: 15px;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
  line-height: 16px;
  text-align: center;
}

/* Ombre sous les dates selon le genre */
.person-card.male .dates::after,
.spouse-card.male .dates::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 4px;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0.2) 40%, transparent 100%);
  filter: blur(2px);
  transition: all 0.3s ease;
}

.person-card.female .dates::after,
.spouse-card.female .dates::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 4px;
  background: radial-gradient(ellipse at center, rgba(236, 72, 153, 0.4) 0%, rgba(236, 72, 153, 0.2) 40%, transparent 100%);
  filter: blur(2px);
  transition: all 0.3s ease;
}

/* Hover - ombre plus intense */
.person-card.male:hover .dates::after,
.spouse-card.male:hover .dates::after {
  width: 80%;
  height: 6px;
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.6) 0%, rgba(37, 99, 235, 0.3) 40%, transparent 100%);
  filter: blur(3px);
}

.person-card.female:hover .dates::after,
.spouse-card.female:hover .dates::after {
  width: 80%;
  height: 6px;
  background: radial-gradient(ellipse at center, rgba(219, 39, 119, 0.6) 0%, rgba(219, 39, 119, 0.3) 40%, transparent 100%);
  filter: blur(3px);
}

/* Ombres selon le genre - SOUS LA CARTE */
.person-card.male {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.person-card.female {
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.25);
}

.spouse-card.male {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.spouse-card.female {
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.25);
}

/* Hover avec ombre renforcée selon le genre */
.person-card:hover, .spouse-card:hover {
  transform: translateY(-3px);
}

.person-card.male:hover {
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.person-card.female:hover {
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
}

.spouse-card.male:hover {
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.spouse-card.female:hover {
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
}

/* ==== Nouvelles couleurs avec gradients ==== */

/* Frères et sœurs - Bleu */
.person-card.sibling {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.person-card.sibling:hover {
  background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
}

/* Personne sélectionnée - Orange avec bordure épaisse et effets visuels */
.person-card.selected {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  border-width: 4px;
  border-color: #f97316 !important;
  box-shadow: 0 8px 32px rgba(249, 115, 22, 0.4), 0 0 0 4px rgba(249, 115, 22, 0.1);
  transform: scale(1.1);
  z-index: 10;
  position: relative;
}

.person-card.selected:hover {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  cursor: default;
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(249, 115, 22, 0.5), 0 0 0 4px rgba(249, 115, 22, 0.15);
}

/* Animation subtile de pulsation pour la personne sélectionnée */
.person-card.selected {
  animation: selectedPulse 3s ease-in-out infinite;
}

@keyframes selectedPulse {
  0%, 100% {
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.4), 0 0 0 4px rgba(249, 115, 22, 0.1);
  }
  50% {
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.6), 0 0 0 6px rgba(249, 115, 22, 0.2);
  }
}

/* Textes de la personne sélectionnée - NOIR comme les autres */
.person-card.selected .first-name {
  color: #1f2937;
  font-weight: 700;
}

.person-card.selected .last-name {
  color: #374151;
  font-weight: 600;
}

.person-card.selected .dates {
  color: #6b7280;
}

/* Conjoints - Violet */
.spouse-card {
  background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
}

.spouse-card:hover {
  background: linear-gradient(135deg, #d8b4fe 0%, #c084fc 100%);
}

/* Enfants - Vert */
.person-card.child {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  min-width: 160px;
  height: 80px;
}

.person-card.child:hover {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
}

.person-card.child .first-name {
  font-size: 14px;
  top: 12px;
}

.person-card.child .last-name {
  font-size: 15px;
}

.person-card.child .dates {
  font-size: 12px;
  bottom: 12px;
}

/* ==== Groupes d'enfants ==== */
.children-groups{
  display:flex;
  gap:4rem;
  justify-content:center;
  align-items:flex-start;
  position:relative;
}

.children-group{
  display:flex;
  gap:2rem;
  position:relative;
  align-items:flex-start;
}

/* ==== Connexions enfants ==== */
.children-connection-vertical{
  position:absolute;
  background-color:#000000;
  z-index:1;
}

.children-connection-horizontal{
  position:absolute;
  background-color:#000000;
  z-index:1;
}

/* ==== Contrôles de navigation de l'arbre ==== */
.tree-controls{
  position:absolute;
  top:5rem;
  left:1rem;
  display:flex;
  flex-direction:column;
  gap:0.5rem;
  z-index:1000;
}

.tree-control-btn{
  background:linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border:1px solid rgba(59, 130, 246, 0.12);
  border-radius:8px;
  padding:0.5rem;
  cursor:pointer;
  transition:all 0.2s ease;
  box-shadow:0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter:blur(10px);
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
}

.tree-control-btn:hover{
  background:linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-color:rgba(59, 130, 246, 0.3);
  transform:translateY(-2px);
  box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);
}

.tree-control-btn:active{
  transform:translateY(0);
}

/* Position relative pour le conteneur principal */
.family-tree-section{
  position:relative;
  width:100vw;
  left:50%;
  right:50%;
  margin-left:-50vw;
  margin-right:-50vw;
}

/* ==== Conteneur principal avec l'arbre et le panneau d'informations ==== */
.tree-main-container {
  display: flex;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Panneau d'informations à droite */
.tree-info-panel {
  width: 350px;
  min-width: 350px;
  background: rgba(255, 255, 255, 0.95);
  border-left: 1px solid #e5e7eb;
  backdrop-filter: blur(10px);
  overflow-y: auto;
  z-index: 1000;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

.tree-info-content {
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tree-info-header {
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.tree-info-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tree-info-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  flex: 1;
}

.tree-info-toggle {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: #6b7280;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
}

.tree-info-toggle:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

/* État réduit du panneau */
.tree-info-panel.collapsed {
  width: 40px;
  min-width: 40px;
}

.tree-info-panel.collapsed .tree-info-content {
  padding: 1rem 0.5rem;
}

.tree-info-panel.collapsed .tree-info-header h3,
.tree-info-panel.collapsed .tree-info-occupation,
.tree-info-panel.collapsed .tree-info-events {
  display: none;
}

.tree-info-panel.collapsed .tree-info-toggle {
  transform: rotate(180deg);
}

.tree-info-occupation {
  font-size: 0.9rem;
  color: #6b7280;
  font-style: italic;
  margin-top: 0.25rem;
}

.tree-info-events h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
}

.tree-info-events-list {
  flex: 1;
  overflow-y: auto;
}

.tree-info-placeholder {
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  margin: 2rem 0;
}

/* Événement dans le panneau */
.tree-event-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tree-event-item:hover {
  background: #f9fafb;
}

.tree-event-item:last-child {
  border-bottom: none;
}

.tree-event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.tree-event-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.9rem;
  flex: 1;
}

.tree-event-date {
  color: #6b7280;
  font-size: 0.8rem;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.tree-event-place {
  color: #6b7280;
  font-size: 0.8rem;
}

/* Détails d'événement expandés */
.tree-event-details {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  display: none;
}

.tree-event-details.expanded {
  display: block;
}

.tree-event-detail-item {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.tree-event-detail-label {
  font-weight: 600;
  color: #374151;
}

.tree-event-detail-content {
  color: #6b7280;
  margin-left: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.tree-event-detail-content a {
  color: #3b82f6;
  text-decoration: underline;
  word-break: break-all;
}

/* Ajustements pour le conteneur de l'arbre */
.tree-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ==== Connexions entre frères et sœurs ==== */
.siblings-group {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
  padding-top: 30px;
}

/* Permettre les marges personnalisées pour les conjoints */
.spouse-card {
  flex-shrink: 0;
}

/* Forcer l'alignement */
.siblings-group > * {
  align-self: center !important;
  vertical-align: middle !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

/* Barre horizontale qui relie tous les frères et sœurs */
.horizontal-bar {
  position: absolute;
  height: 1px;
  background-color: #000000;
  z-index: 1;
}

/* Connecteurs verticaux pour chaque frère/sœur */
.sibling-connection {
  position: absolute;
  width: 1px;
  background-color: #000000;
  z-index: 2;
}

/* Connexions entre conjoints */
.spouse-connection {
  position: absolute;
  height: 1px;
  background-color: #000000;
  z-index: 1;
  transition: all 0.3s ease;
}

/* Animation au survol des connexions */
.spouse-connection:hover {
  height: 3px;
  filter: brightness(1.2);
}

/* S'assurer que les cartes sont au-dessus des connexions */
.person-card, .spouse-card {
  position: relative;
  z-index: 3;
}

/* Styles pour le thème sombre */
:root.theme-dark .person-card,
:root.theme-dark .spouse-card {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border-color: #4b5563;
  color: #f3f4f6;
}

:root.theme-dark .person-card:hover,
:root.theme-dark .spouse-card:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  border-color: #6b7280;
}

:root.theme-dark .first-name {
  color: #f3f4f6;
}

:root.theme-dark .last-name {
  color: #d1d5db;
}

:root.theme-dark .dates {
  color: #9ca3af;
}

:root.theme-dark .person-card.selected {
  background: linear-gradient(135deg, #c2410c 0%, #dc2626 100%);
  border-color: #ea580c !important;
  color: #fed7aa;
  box-shadow: 0 8px 32px rgba(234, 88, 12, 0.4), 0 0 0 4px rgba(234, 88, 12, 0.1);
  transform: scale(1.1);
  z-index: 10;
}

:root.theme-dark .person-card.selected:hover {
  background: linear-gradient(135deg, #c2410c 0%, #dc2626 100%);
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(234, 88, 12, 0.5), 0 0 0 4px rgba(234, 88, 12, 0.15);
}

:root.theme-dark .person-card.selected .first-name {
  color: #fed7aa;
}

/* Animation pour le mode sombre */
:root.theme-dark .person-card.selected {
  animation: selectedPulseDark 3s ease-in-out infinite;
}

@keyframes selectedPulseDark {
  0%, 100% {
    box-shadow: 0 8px 32px rgba(234, 88, 12, 0.4), 0 0 0 4px rgba(234, 88, 12, 0.1);
  }
  50% {
    box-shadow: 0 8px 32px rgba(234, 88, 12, 0.6), 0 0 0 6px rgba(234, 88, 12, 0.2);
  }
}

:root.theme-dark .spouse-card {
  background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
  border-color: #d97706;
  color: #fef3c7;
}

:root.theme-dark .spouse-card:hover {
  background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
  border-color: #f59e0b;
}

:root.theme-dark .person-card.child {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  border-color: #10b981;
  color: #d1fae5;
}

:root.theme-dark .person-card.child:hover {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  border-color: #34d399;
}

:root.theme-dark .horizontal-bar,
:root.theme-dark .sibling-connection {
  background-color: #ffffff;
}

:root.theme-dark .spouse-connection {
  background-color: #ffffff;
}

:root.theme-dark .children-connection-vertical,
:root.theme-dark .children-connection-horizontal {
  background-color: #ffffff;
}

/* Panneau d'informations en mode sombre */
:root.theme-dark .tree-info-panel {
  background: rgba(31, 41, 55, 0.95);
  border-color: #374151;
}

:root.theme-dark .tree-info-header {
  border-color: #374151;
}

:root.theme-dark .tree-info-header h3 {
  color: #f3f4f6;
}

:root.theme-dark .tree-info-toggle {
  border-color: #4b5563;
  color: #9ca3af;
}

:root.theme-dark .tree-info-toggle:hover {
  background: #374151;
  border-color: #6b7280;
  color: #d1d5db;
}

:root.theme-dark .tree-info-occupation {
  color: #9ca3af;
}

:root.theme-dark .tree-info-events h4 {
  color: #d1d5db;
}

:root.theme-dark .tree-info-placeholder {
  color: #6b7280;
}

:root.theme-dark .tree-event-item {
  border-color: #4b5563;
}

:root.theme-dark .tree-event-item:hover {
  background: #374151;
}

:root.theme-dark .tree-event-title {
  color: #f3f4f6;
}

:root.theme-dark .tree-event-date,
:root.theme-dark .tree-event-place {
  color: #9ca3af;
}

:root.theme-dark .tree-event-details {
  border-color: #4b5563;
}

:root.theme-dark .tree-event-detail-label {
  color: #d1d5db;
}

:root.theme-dark .tree-event-detail-content {
  color: #9ca3af;
}

:root.theme-dark .tree-event-detail-content a {
  color: #60a5fa;
}

/* Responsive */
@media (max-width: 768px) {
  .siblings-group {
    gap: 1.5rem;
    padding-top: 25px;
    margin-top: 15px;
  }
  
  .children-groups {
    gap: 2rem;
  }
  
  .children-group {
    gap: 1rem;
  }
  
  .generation-1 {
    margin-top: 80px;
  }
  
  .person-card, .spouse-card {
    min-width: 140px;
    padding: 0.8rem 1rem;
  }
  
  /* Ajustements pour la personne sélectionnée sur mobile */
  .person-card.selected {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4), 0 0 0 3px rgba(249, 115, 22, 0.1);
  }
  
  .person-card.selected:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.5), 0 0 0 3px rgba(249, 115, 22, 0.15);
  }
  
  .person-card.child {
    min-width: 120px;
    padding: 0.6rem 0.8rem;
  }
  
  .gender-icon {
    width: 16px;
    height: 16px;
  }
  
  .person-card.child .gender-icon {
    width: 14px;
    height: 14px;
  }
  
  .first-name {
    font-size: 0.9rem;
  }
  
  .last-name {
    font-size: 0.85rem;
  }
  
  .dates {
    font-size: 0.8rem;
  }
  
  .person-card.child .first-name {
    font-size: 0.85rem;
  }
  
  .person-card.child .last-name {
    font-size: 0.8rem;
  }
  
  .person-card.child .dates {
    font-size: 0.75rem;
  }
  
  .horizontal-bar,
  .sibling-connection,
  .spouse-connection,
  .children-connection-vertical,
  .children-connection-horizontal {
    height: 1px;
  }
  
  .sibling-connection,
  .children-connection-vertical {
    width: 1px;
  }
  
  .tree-container{padding:0.5rem}
  .family-tree-section{padding:0.5rem}
  
  /* Ajustements des connecteurs pour mobile */
  .siblings-horizontal-bar{height:2px}
  .person-card.sibling::before{width:2px;height:15px;top:-15px}
  .person-card.selected + .spouse-card::after, .spouse-card + .spouse-card::after{height:2px}
  
  /* Panneau d'informations en mode mobile */
  .tree-main-container {
    flex-direction: column;
    height: auto;
  }
  
  .tree-info-panel {
    width: 100%;
    min-width: auto;
    height: 300px;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    order: 2;
  }
  
  .tree-container {
    height: 50vh;
    min-height: 400px;
    order: 1;
  }
  
  .tree-info-content {
    padding: 1rem;
  }
  
  .tree-info-header h3 {
    font-size: 1.1rem;
  }
  
  .tree-info-toggle {
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
  }
  
  /* Sur mobile, masquer le panneau par défaut s'il est réduit */
  .tree-info-panel.collapsed {
    display: none;
  }
  
  .tree-event-item {
    padding: 0.5rem;
  }
  
  .tree-event-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .tree-event-title {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
  }
  
  .tree-event-date {
    font-size: 0.75rem;
    margin-left: 0;
  }
  
  .tree-event-place {
    font-size: 0.75rem;
  }
}

/* ==== Génération des parents ==== */
.generation-1 {
  margin-bottom: 100px;
}

.parents-group {
  display: flex;
  gap: 4rem;
  justify-content: center;
  position: relative;
}

/* Cartes des parents avec couleur distincte */
.person-card.parent {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.person-card.parent:hover {
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
}

/* Connexions parents */
.parent-connection-vertical,
.parent-connection-horizontal {
  background-color: #000000;
  z-index: 1;
}

