/* =============================================================
   MODAL CHARACTER EDIT - STYLES SIMPLES
   ============================================================= */

.character-edit-tab {
  display: none;
  padding: 20px;
}

.character-edit-tab.active {
  display: block;
}

.character-edit-modal .house-modal-footer {
  padding: 20px;
}

/* =============================================================
   FORMULAIRE D'ÉDITION - STYLE SOMBRE
   ============================================================= */

.character-edit-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: 15px;
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(100, 150, 255, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  color: white;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(100, 150, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 150, 255, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.form-group select {
  cursor: pointer;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px !important;
  padding-right: 36px !important;
}

.form-group select option {
  background: rgba(30, 30, 50, 0.95);
  color: white;
  padding: 10px;
}

/* Style pour les dates */
.form-group input[type="date"] {
  color-scheme: dark;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* Onglet Apparence */
.character-edit-appearance {
  text-align: center;
}

.current-character-preview {
  margin: 15px 0;
}

.current-character-preview img {
  width: 128px;
  height: 128px;
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 10px;
}

.character-creator-container {
  margin-top: 15px;
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 10px;
  overflow: hidden;
}

.character-creator-container iframe {
  width: 100%;
  height: 600px;
  border: none;
}

/* Boutons d'édition */
.ancestor-action-btn.edit-btn {
  background: #f59e0b;
  color: white;
  transition: all 0.3s ease;
}

.ancestor-action-btn.edit-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Info modal character edit button */
.character-info-actions {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  border-top: 1px solid rgba(100, 150, 255, 0.2);
}

.character-info-actions .btn {
  transition: all 0.3s ease;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
}

.character-info-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modal pour les infos de personnage */
.character-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.character-info-content {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  border-radius: 20px;
  backdrop-filter: blur(15px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(100, 150, 255, 0.3);
  color: white;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.character-info-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.character-info-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.character-info-image {
  text-align: center;
  padding: 20px 20px 10px;
}

.character-info-image img {
  width: 120px;
  height: 120px;
  border-radius: 15px;
  border: 3px solid rgba(100, 150, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.character-info-content h3 {
  text-align: center;
  margin: 0 20px 15px;
  font-size: 1.5em;
  color: white;
}

.character-info-details {
  padding: 0 20px 15px;
}

.character-info-details p {
  margin: 8px 0;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
}

.character-info-details .biography {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
  border: 1px solid rgba(100, 150, 255, 0.2);
  margin-top: 15px;
  line-height: 1.5;
  font-style: italic;
}

/* Responsivité simple */
@media (max-width: 768px) {
  .character-creator-container iframe {
    height: 500px;
  }
}

/* Mobile pour les cartes ancêtres */
@media (max-width: 480px) {
  .ancestor-actions-row {
    flex-direction: column;
    gap: 3px;
  }
  
  .ancestor-action-btn {
    width: 100%;
    text-align: center;
  }
}

/* =============================================================
   CHARACTER CREATOR MODAL - STYLES SOMBRES
   ============================================================= */

.character-creator-modal {
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(40, 40, 60, 0.98));
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(100, 150, 255, 0.3);
  width: 98%;
  max-width: 1800px;
  height: 95vh;
  max-height: 95vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.character-creator-header {
  background: linear-gradient(135deg, rgba(100, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(100, 150, 255, 0.3);
  color: white;
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.character-creator-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.character-creator-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.character-creator-preview {
  flex: 1;
  background: rgba(30, 30, 45, 0.5);
  border-right: 1px solid rgba(100, 150, 255, 0.2);
  min-height: 600px;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.character-creator-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.character-creator-form {
  width: 400px;
  padding: 25px;
  overflow-y: auto;
  background: rgba(30, 30, 45, 0.7);
  backdrop-filter: blur(10px);
}

.character-creator-form h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid rgba(100, 150, 255, 0.5);
  padding-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
  .character-creator-content {
    flex-direction: column;
  }
  
  .character-creator-preview {
    border-right: none;
    border-bottom: 1px solid #e1e8ed;
    min-height: 400px;
  }
  
  .character-creator-form {
    width: 100%;
  }
}

/* =============================================================
   ANCESTORS MODAL - STYLES
   ============================================================= */

.ancestors-modal-header {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  color: white;
  padding: 20px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(15px);
  border-bottom: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 20px 20px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.ancestors-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  flex: 1;
}

/* === Derniers portraits importes (banner en haut de la modal) === */
.ancestors-recent-portraits {
  margin: 18px 24px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(199, 144, 30, 0.12), rgba(27, 67, 50, 0.08));
  border: 1px solid rgba(199, 144, 30, 0.3);
  border-radius: 12px;
}
.ancestors-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ancestors-recent-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #FFD700;
  letter-spacing: 0.3px;
}
.ancestors-recent-link {
  font-size: 12px;
  color: #C7901E;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.ancestors-recent-link:hover { color: #FFD700; text-decoration: underline; }

.ancestors-recent-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.ancestors-recent-strip::-webkit-scrollbar { height: 6px; }
.ancestors-recent-strip::-webkit-scrollbar-thumb {
  background: rgba(199, 144, 30, 0.5);
  border-radius: 3px;
}

.ancestors-recent-card {
  flex: 0 0 auto;
  width: 110px;
  text-decoration: none;
  color: inherit;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.ancestors-recent-card:hover {
  transform: translateY(-2px);
  border-color: #C7901E;
  box-shadow: 0 4px 12px rgba(199, 144, 30, 0.4);
}
.ancestors-recent-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.ancestors-recent-meta {
  padding: 6px 8px;
  font-size: 11px;
}
.ancestors-recent-name {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ancestors-recent-sub {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: rgba(255,255,255,0.55);
  font-size: 10px;
}
.ancestors-recent-sub span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ancestors-modal-subtitle {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
  position: absolute;
  bottom: 20px;
  left: 20px;
}

.ancestors-create-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  margin-left: auto;
  margin-right: 50px;
}

.ancestors-create-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

/* Transformer la grille en liste verticale */
.ancestors-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 20px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Cartes d'ancêtres modernisées */
.ancestor-card {
  background: rgba(40, 40, 60, 0.6) !important;
  border: 2px solid rgba(100, 150, 255, 0.2) !important;
  border-radius: 10px !important;
  padding: 10px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(10px) !important;
  position: relative !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  height: auto !important;
}

.ancestor-card::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 4px !important;
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
  transform: scaleX(0) !important;
  transition: transform 0.3s !important;
}

.ancestor-card:hover {
  background: rgba(50, 50, 70, 0.8) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 25px rgba(100, 150, 255, 0.2) !important;
}

.ancestor-card:hover::before {
  transform: scaleX(1) !important;
}

/* Header avec image et titre */
.ancestor-header {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 0 !important;
}

.ancestor-image {
  width: 60px !important;
  height: 60px !important;
  flex-shrink: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background: rgba(60, 60, 80, 0.8) !important;
  border: 2px solid rgba(100, 150, 255, 0.3) !important;
  position: relative !important;
}

.ancestor-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
}

/* Titre et infos */
.ancestor-title {
  flex: 1 !important;
  min-width: 0 !important;
}

.ancestor-name {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: white !important;
  margin-bottom: 8px !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.ancestor-status-badge {
  font-size: 13px !important;
  padding: 6px 12px !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  display: inline-block !important;
  width: fit-content !important;
}

.ancestor-status-badge.has-house {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.ancestor-status-badge.no-house {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

/* Informations détaillées */
.ancestor-info-section {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.ancestor-info-item {
  font-size: 14px !important;
  color: rgba(255, 255, 255, 0.8) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(100, 150, 255, 0.1) !important;
}

.ancestor-info-item .info-icon {
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

.ancestor-info-item .info-text {
  flex: 1 !important;
}

.ancestor-actions-section {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: auto !important;
}

.primary-actions {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.secondary-actions {
  display: flex !important;
  gap: 8px !important;
  justify-content: stretch !important;
  flex-wrap: wrap !important;
}

.ancestor-action-btn {
  flex: 1 !important;
  padding: 8px 10px !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  backdrop-filter: blur(10px) !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.ancestor-action-btn.view-btn {
  background: rgba(100, 150, 255, 0.2) !important;
  color: #6495ff !important;
  border: 1px solid rgba(100, 150, 255, 0.3) !important;
}

.ancestor-action-btn.view-btn:hover {
  background: rgba(100, 150, 255, 0.3) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(100, 150, 255, 0.3) !important;
}

.ancestor-action-btn.assign-btn {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.ancestor-action-btn.assign-btn:hover {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  color: #6ee7b7 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
}

.ancestor-action-btn.delete-btn {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.ancestor-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}

.ancestor-action-btn.edit-btn {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.ancestor-action-btn.edit-btn:hover {
  background: rgba(245, 158, 11, 0.3) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fbbf24 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3) !important;
}

/* =============================================================
   ACTION BUTTONS STYLES (Required for ancestor buttons)
   ============================================================= */

.action-btn {
  flex: 1 !important;
  padding: 10px 16px !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  outline: none !important;
  backdrop-filter: blur(10px) !important;
}

.assign-btn {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.assign-btn:hover {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  color: #6ee7b7 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
}

.primary-btn {
  background: rgba(100, 150, 255, 0.2) !important;
  color: #6495ff !important;
  border: 1px solid rgba(100, 150, 255, 0.3) !important;
}

.primary-btn:hover {
  background: rgba(100, 150, 255, 0.3) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(100, 150, 255, 0.3) !important;
}

.secondary-btn {
  background: rgba(100, 116, 139, 0.2) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(100, 116, 139, 0.3) !important;
}

.secondary-btn:hover {
  background: rgba(100, 116, 139, 0.3) !important;
  border-color: rgba(100, 116, 139, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3) !important;
}

.danger-btn {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.danger-btn:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}

.success-btn {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.success-btn:hover {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  color: #6ee7b7 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
}

/* Responsive */
@media (max-width: 480px) {
  .ancestor-actions-row {
    flex-direction: column;
    gap: 3px;
  }
  
  .ancestor-action-btn {
    width: 100%;
    text-align: center;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
  }
}

.assignment-character-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.assignment-character-image {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(60, 60, 80, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(100, 150, 255, 0.3);
}

.assignment-character-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.assignment-character-details {
  flex: 1;
}

.assignment-character-name {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0 0 4px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .assignment-character-info {
    gap: 12px;
  }
  
  .assignment-character-image {
    width: 50px;
    height: 50px;
  }
  
  .assignment-character-image img {
    width: 40px;
    height: 40px;
  }
  
  .assignment-character-name {
    font-size: 18px;
  }
}

/* =============================================================
   CHARACTER INFO MODAL - STYLES
   ============================================================= */

.character-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.character-info-content {
  background: white;
  border-radius: 16px;
  padding: 25px;
  max-width: 600px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.character-info-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.character-info-close:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.character-info-image {
  width: 128px;
  height: 128px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
}

.character-info-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.character-info-content h3 {
  text-align: center;
  margin: 0 0 20px 0;
  font-size: 24px;
  color: #2c3e50;
}

.character-info-details {
  margin-bottom: 20px;
}

.character-info-details p {
  margin: 8px 0;
  font-size: 14px;
  color: #5a6c7d;
}

.character-info-details p.biography {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e1e8ed;
  font-style: italic;
  line-height: 1.5;
}

.character-info-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

/* Character placement marker */
.character-placement-marker {
  cursor: pointer;
  transition: all 0.2s;
}

.character-placement-marker:hover {
  transform: scale(1.1);
}

/* =============================================================
   CARTES ANCÊTRES COMPACTES - NOUVEAU DESIGN
   ============================================================= */

/* Carte compacte */
.ancestor-card-compact {
  background: rgba(40, 40, 60, 0.7) !important;
  border: 2px solid rgba(100, 150, 255, 0.2) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
  backdrop-filter: blur(10px) !important;
}

.ancestor-card-compact:hover {
  background: rgba(50, 50, 70, 0.85) !important;
  border-color: rgba(100, 150, 255, 0.4) !important;
  box-shadow: 0 6px 20px rgba(100, 150, 255, 0.2) !important;
}

.ancestor-card-compact.expanded {
  background: rgba(50, 50, 70, 0.9) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
}

/* Vue compacte (toujours visible) */
.ancestor-compact-view {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 15px !important;
}

/* Avatar avec badge genre */
.ancestor-avatar {
  width: 50px !important;
  height: 50px !important;
  flex-shrink: 0 !important;
  position: relative !important;
  border-radius: 10px !important;
  overflow: visible !important;
  background: rgba(60, 60, 80, 0.8) !important;
  border: 2px solid rgba(100, 150, 255, 0.3) !important;
}

.ancestor-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
  border-radius: 8px !important;
}

/* Badge de genre */
.gender-badge {
  position: absolute !important;
  top: -6px !important;
  right: -6px !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: bold !important;
  border: 2px solid rgba(30, 30, 50, 0.9) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.gender-badge.gender-female {
  background: linear-gradient(135deg, #ff69b4, #ff1493) !important;
  color: white !important;
}

.gender-badge.gender-male {
  background: linear-gradient(135deg, #4a90e2, #2563eb) !important;
  color: white !important;
}

/* Infos compactes */
.ancestor-info-compact {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.ancestor-name-compact {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: white !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  word-wrap: break-word !important;
  line-height: 1.3 !important;
}

.ancestor-meta-compact {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
}

.years-badge,
.profession-badge,
.house-info,
.placement-badge {
  font-size: 11px !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.years-badge {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.profession-badge {
  background: rgba(139, 92, 246, 0.2) !important;
  color: #a78bfa !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.house-info {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.house-info.no-house {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.placement-badge.placed {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

/* Flèche d'expansion */
.expand-arrow {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  background: rgba(100, 150, 255, 0.1) !important;
  transition: all 0.3s !important;
}

.expand-arrow svg {
  transition: transform 0.3s !important;
  color: rgba(255, 255, 255, 0.7) !important;
}

.ancestor-card-compact:hover .expand-arrow {
  background: rgba(100, 150, 255, 0.2) !important;
}

/* Vue détaillée (cachée par défaut) */
.ancestor-expanded-view {
  padding: 0 15px 15px 15px !important;
  display: none !important;
  overflow: hidden !important;
  max-height: 0 !important;
  opacity: 0 !important;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out !important;
}

/* Quand la carte est expanded, forcer l'affichage */
.ancestor-card-compact.expanded .ancestor-expanded-view {
  display: block !important;
  max-height: 500px !important;
  opacity: 1 !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section détails */
.ancestor-details-section {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin-bottom: 12px !important;
  padding: 12px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(100, 150, 255, 0.1) !important;
}

.ancestor-detail-item {
  font-size: 13px !important;
  color: rgba(255, 255, 255, 0.85) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.detail-icon {
  font-size: 14px !important;
  flex-shrink: 0 !important;
  opacity: 0.9 !important;
}

.detail-text {
  flex: 1 !important;
  line-height: 1.4 !important;
}

/* Actions compactes */
.ancestor-actions-compact {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 6px !important;
}

.action-btn-compact {
  padding: 8px 12px !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  backdrop-filter: blur(10px) !important;
}

.action-btn-compact:hover {
  transform: translateY(-1px) !important;
}

/* Boutons spécifiques */
.action-btn-compact.map-btn,
.action-btn-compact.place-btn {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.action-btn-compact.map-btn:hover,
.action-btn-compact.place-btn:hover {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3) !important;
}

.action-btn-compact.assign-btn {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.action-btn-compact.assign-btn:hover {
  background: rgba(245, 158, 11, 0.3) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3) !important;
}

.action-btn-compact.photo-btn {
  background: rgba(139, 92, 246, 0.2) !important;
  color: #a78bfa !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.action-btn-compact.photo-btn:hover {
  background: rgba(139, 92, 246, 0.3) !important;
  border-color: rgba(139, 92, 246, 0.5) !important;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3) !important;
}

.action-btn-compact.family-btn {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.action-btn-compact.family-btn:hover {
  background: rgba(34, 197, 94, 0.3) !important;
  border-color: rgba(34, 197, 94, 0.5) !important;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3) !important;
}

.action-btn-compact.view-btn {
  background: rgba(100, 150, 255, 0.2) !important;
  color: #6495ff !important;
  border: 1px solid rgba(100, 150, 255, 0.3) !important;
}

.action-btn-compact.view-btn:hover {
  background: rgba(100, 150, 255, 0.3) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
  box-shadow: 0 2px 10px rgba(100, 150, 255, 0.3) !important;
}

.action-btn-compact.edit-btn {
  background: rgba(251, 146, 60, 0.2) !important;
  color: #fb923c !important;
  border: 1px solid rgba(251, 146, 60, 0.3) !important;
}

.action-btn-compact.edit-btn:hover {
  background: rgba(251, 146, 60, 0.3) !important;
  border-color: rgba(251, 146, 60, 0.5) !important;
  box-shadow: 0 2px 10px rgba(251, 146, 60, 0.3) !important;
}

.action-btn-compact.delete-btn {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.action-btn-compact.delete-btn:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3) !important;
}

/* Responsive pour cartes compactes */
@media (max-width: 768px) {
  .ancestor-compact-view {
    padding: 10px 12px !important;
  }

  .ancestor-avatar {
    width: 45px !important;
    height: 45px !important;
  }

  .gender-badge {
    width: 20px !important;
    height: 20px !important;
    font-size: 11px !important;
  }

  .ancestor-name-compact {
    font-size: 14px !important;
  }

  .ancestor-profession-compact {
    font-size: 11px !important;
  }

  .ancestor-actions-compact {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
  }

  .action-btn-compact {
    font-size: 11px !important;
    padding: 7px 10px !important;
  }
}

/* ==================== TOOLBAR RECHERCHE + TRI ==================== */
.anc-toolbar {
  margin-bottom: 16px;
  padding: 0 16px;
}

.anc-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.anc-stat {
  background: rgba(255,255,255,0.05);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}
.anc-stat-alive { color: #4CAF7D; }
.anc-stat-dead { color: #e57373; }

.anc-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.anc-search {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.anc-search:focus {
  border-color: rgba(201,149,42,0.5);
}
.anc-search::placeholder {
  color: rgba(255,255,255,0.3);
}

.anc-sort-btns {
  display: flex;
  gap: 4px;
}
.anc-sort-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.anc-sort-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}
.anc-sort-btn.active {
  background: rgba(201,149,42,0.2);
  border-color: rgba(201,149,42,0.4);
  color: #c9952a;
}

.anc-result-info {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
  font-style: italic;
}

@media (max-width: 600px) {
  .anc-search-row { flex-direction: column; }
  .anc-sort-btns { width: 100%; justify-content: space-between; }
}