/* =============================================================
   ARBRE GÉNÉALOGIQUE — Ultra compact
   ============================================================= */

#familyTreeModal.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}
#familyTreeModal.modal.active { display: flex; }

#familyTreeModal .modal-content {
  background: #111520;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  max-height: 90vh;
  overflow: hidden;
}

#familyTreeModal .modal-header {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#familyTreeModal .modal-header h2 {
  margin: 0; font-size: 15px; font-weight: 700; color: #fff;
}
#familyTreeModal .modal-close {
  background: rgba(255,255,255,0.06); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#familyTreeModal .modal-close:hover { background: rgba(255,255,255,0.12); }

#familyTreeModal .modal-body {
  padding: 16px; overflow-y: auto; max-height: calc(90vh - 50px);
}

/* Container */
.family-tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Rangées */
.family-tree-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Label discret */
.family-tree-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

/* Connecteur vertical */
.ft-connector {
  width: 1px;
  height: 16px;
  background: rgba(201,149,42,0.3);
}

/* Containers */
.parents-container,
.siblings-container,
.children-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 4px 0;
}

/* ==================== CARTE MINI ==================== */
.family-person-card {
  position: relative;
  width: 80px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.family-person-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201,149,42,0.4);
  background: rgba(255,255,255,0.06);
}

.family-person-card.main-character {
  border: 1.5px solid #c9952a;
  background: rgba(201,149,42,0.06);
  box-shadow: 0 0 8px rgba(201,149,42,0.15);
}
.family-person-card.spouse {
  border-color: #d4729a;
  background: rgba(212,114,154,0.04);
}

/* Image mini */
.family-person-image {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 4px;
  background: rgba(0,0,0,0.2);
  image-rendering: pixelated;
}

/* Nom compact */
.family-person-name {
  font-weight: 600;
  font-size: 9px;
  color: rgba(255,255,255,0.9);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}

/* Dates mini */
.family-person-dates {
  font-size: 8px;
  color: rgba(255,255,255,0.35);
}

/* Genre icon */
.family-person-gender {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  opacity: 0.5;
}
.family-person-gender img { width: 100%; height: 100%; }

/* Badge mini */
.family-top-badge {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 7px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.family-top-badge.main { background: #c9952a; color: #000; }
.family-top-badge.parent { background: #7c5cbf; color: #fff; }
.family-top-badge.child { background: #2d9d5a; color: #fff; }
.family-top-badge.sibling { background: #d4891e; color: #fff; }
.family-top-badge.spouse { background: #d4729a; color: #fff; }

/* Boutons action (apparaissent au survol) */
.family-locate-btn,
.family-delete-relation-btn {
  position: absolute;
  width: 18px !important; height: 18px !important;
  border-radius: 50% !important;
  border: none !important;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 !important;
  box-shadow: none !important;
  opacity: 0;
  transition: opacity 0.15s !important;
}
.family-person-card:hover .family-locate-btn,
.family-person-card:hover .family-delete-relation-btn {
  opacity: 1;
}

.family-locate-btn {
  bottom: 3px; left: 3px;
  background: rgba(59,130,246,0.8) !important;
}
.family-locate-btn img { width: 10px; height: 10px; }

.family-delete-relation-btn {
  bottom: 3px; right: 3px;
  background: rgba(239,68,68,0.7) !important;
  font-size: 9px !important;
}

/* Message vide */
.family-empty-message {
  padding: 12px;
  color: rgba(255,255,255,0.2);
  font-size: 10px;
  font-style: italic;
  text-align: center;
}

/* Bouton ajouter */
#addRelationButtonContainer { margin-bottom: 12px; }
#addRelationButtonContainer button {
  background: rgba(201,149,42,0.12) !important;
  border: 1px solid rgba(201,149,42,0.3) !important;
  color: #c9952a !important;
  padding: 6px 16px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  box-shadow: none !important;
}
#addRelationButtonContainer button:hover {
  background: rgba(201,149,42,0.2) !important;
  transform: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .family-person-card { width: 70px; }
  .family-person-image { height: 54px; }
  .family-person-name { font-size: 8px; }
}
