/* ======================== */
/*  STYLE MODERNISÉ         */
/* ======================== */

:root {
    /* Palette de couleurs harmonieuse */
    --primary-color: #2C3E50;      /* Bleu foncé élégant */
    --secondary-color: #18BC9C;    /* Turquoise */
    --accent-color: #F39C12;       /* Orange doré */
    --light-color: #ECF0F1;        /* Gris clair */
    --dark-color: #2C3E50;         /* Bleu foncé */
    
    /* Couleurs par génération */
    --gen1-color: #8E44AD;         /* Violet */
    --gen2-color: #3498DB;         /* Bleu */
    --gen3-color: #2ECC71;         /* Vert */
    --gen4-color: #E74C3C;         /* Rouge */
    --gen5-color: #F1C40F;         /* Jaune */
    
    /* Couleurs neutres */
    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --medium-gray: #E9ECEF;
    --dark-gray: #6C757D;
    --black: #212529;
    
    /* Effets */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --shadow-xl: 0 12px 48px rgba(0,0,0,0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

/* ======================== */
/*  RESET & BASE            */
/* ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--black);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* ======================== */
/*  LAYOUT PRINCIPAL        */
/* ======================== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ======================== */
/*  HEADER MODERNISÉ        */
/* ======================== */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.header-tagline {
    font-size: 1.2rem;
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ======================== */
/*  BOUTONS & ACTIONS       */
/* ======================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-photos {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-photos:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ======================== */
/*  SECTION RECHERCHE       */
/* ======================== */
.search-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 100;
}

.search-container {
    display: grid;
    gap: 1.5rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(24, 188, 156, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-gray);
}

.search-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-filters {
    display: flex;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius-sm);
    background: white;
    font-size: 0.9rem;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.search-results-info {
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.search-results-info.highlight {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 4px solid var(--secondary-color);
}

/* ======================== */
/*  NAVIGATION GÉNÉRATION   */
/* ======================== */
.generation-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.nav-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 50px;
    background: var(--light-gray);
    color: var(--dark-color);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    text-align: center;
}

.nav-btn:hover {
    background: var(--medium-gray);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ======================== */
/*  ARBRE GÉNÉALOGIQUE      */
/* ======================== */
.tree-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    position: relative;
    min-height: 600px;
    overflow: hidden;
}

.tree-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius-sm);
    overflow: auto;
    padding: 2rem;
}

.tree-wrapper {
    position: relative;
    min-width: fit-content;
    min-height: fit-content;
}

/* Nœuds de l'arbre */
.family-node {
    position: absolute;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
    border: 2px solid transparent;
    z-index: 10;
}

.family-node:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.family-node.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.family-node.highlighted {
    animation: pulse 2s infinite;
    border-color: var(--secondary-color);
}

/* Styles par génération */
.family-node.gen-1 { border-left: 4px solid var(--gen1-color); }
.family-node.gen-2 { border-left: 4px solid var(--gen2-color); }
.family-node.gen-3 { border-left: 4px solid var(--gen3-color); }
.family-node.gen-4 { border-left: 4px solid var(--gen4-color); }
.family-node.gen-5 { border-left: 4px solid var(--gen5-color); }

/* Contenu des nœuds */
.node-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.node-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    overflow: hidden;
}

.node-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.node-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.node-details {
    font-size: 0.85rem;
    color: var(--dark-gray);
}

.node-relation {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-style: italic;
    margin-top: 0.5rem;
}

/* Connexions entre nœuds */
.tree-connection {
    position: absolute;
    background: var(--dark-gray);
    z-index: 1;
}

.tree-connection.horizontal {
    height: 2px;
}

.tree-connection.vertical {
    width: 2px;
}

/* ======================== */
/*  MODAL D'INFORMATIONS    */
/* ======================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.member-modal {
    background: white;
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}
/* Styles pour la mention décédé */
.deceased-badge {
    background-color: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: normal;
    margin-left: 8px;
    vertical-align: middle;
}

.family-node.deceased {
    opacity: 0.9;
    border-left: 3px solid #dc3545;
}

.node-deceased {
    color: #dc3545;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 2px;
}


.descendants-select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.descendants-actions {
    margin-top: 15px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline:hover {
    background: var(--secondary-color);
    color: white;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .contact-buttons {
        flex-direction: column;
    }
   
    .contact-btn {
        min-width: 100%;
    }
   
    .descendants-dropdown {
        flex-direction: column;
    }
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 2rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.modal-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-title h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal-title p {
    opacity: 0.9;
}

.modal-content {
    padding: 2rem;
}

.modal-section {
    margin-bottom: 2rem;
}

.modal-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-gray);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.9rem;
}

.info-value {
    color: var(--primary-color);
    font-size: 1rem;
}

.family-connections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.connection-card {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--secondary-color);
}

.connection-name {
    font-weight: 600;
    color: var(--primary-color);
}

.connection-role {
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 0.25rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--light-gray);
}

.modal-close {
    background: var(--light-gray);
    color: var(--dark-color);
}

.modal-close:hover {
    background: var(--medium-gray);
}

/* ======================== */
/*  LEGENDE & CONTROLES     */
/* ======================== */
.controls-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.legend-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.legend-section {
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
}

.legend-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-text {
    font-size: 0.9rem;
    color: var(--dark-color);
}

.tree-controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.zoom-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--medium-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.zoom-btn:hover {
    background: var(--light-gray);
    transform: scale(1.1);
}

/* ======================== */
/*  FOOTER AMÉLIORÉ         */
/* ======================== */
.site-footer {
    background: var(--primary-color);
    color: white;
    padding: 3rem 0 2rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: white;
}

.footer-section p {
    opacity: 0.8;
    line-height: 1.8;
}

.creator-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
}

.creator-info {
    text-align: center;
}

.creator-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.creator-title {
    opacity: 0.8;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ======================== */
/*  ANIMATIONS              */
/* ======================== */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* ======================== */
/*  RESPONSIVE DESIGN       */
/* ======================== */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-tagline {
        font-size: 1rem;
    }
    
    .tree-container {
        height: 400px;
    }
    
    .family-node {
        min-width: 160px;
        padding: 0.75rem;
    }
    
    .modal-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .modal-avatar {
        width: 80px;
        height: 80px;
    }
    
    .modal-title h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .search-controls {
        flex-direction: column;
    }
    
    .nav-buttons {
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .family-node {
        min-width: 140px;
    }
}

/* ======================== */
/*  UTILITAIRES             */
/* ======================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
/* ======================== */
/*  SUGGESTIONS DE RECHERCHE */
/* ======================== */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius-sm);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    display: none;
    margin-top: 5px;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--light-gray);
    transition: var(--transition);
}

.suggestion-item:hover {
    background-color: var(--light-gray);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.suggestion-details {
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 4px;
}

/* ======================== */
/*  EN-TÊTE QUI DISPARAÎT   */
/* ======================== */
.site-header {
    transition: transform 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ======================== */
/*  CONNEXIONS DE L'ARBRE   */
/* ======================== */
.tree-connection {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

/* ======================== */
/*  NOTIFICATIONS           */
/* ======================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--accent-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ======================== */
/*  BOUTON VUE D'ENSEMBLE   */
/* ======================== */
.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}
/* ======================== */
/*  LISTE DÉROULANTE MEMBRES */
/* ======================== */
.member-select-container {
    position: relative;
    min-width: 250px;
}

.member-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius-sm);
    background: white;
    font-size: 0.95rem;
    color: var(--dark-color);
    font-weight: bold;
    /* text-align: center;*/
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.member-select:hover {
    border-color: var(--secondary-color);
}

.member-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(24, 188, 156, 0.1);
}

.select-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-gray);
    pointer-events: none;
}

.member-select option {
    padding: 10px;
    font-size: 0.95rem;
}

.member-select option[value=""] {
    color: var(--dark-gray);
    font-style: italic;
}

/* Ajustement pour responsive */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .member-select-container {
        min-width: 100%;
    }
}
/* Animation pour l'icône de chargement */
.fa-spin {
    animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}
/* ======================== */
/*  FONCTIONNALITÉ DESCENDANTS */
/* ======================== */
.btn-descendants {
    background: linear-gradient(135deg, var(--gen4-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.btn-descendants:hover {
    background: linear-gradient(135deg, var(--gen5-color), var(--gen4-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.view-mode-indicator {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-md);
    margin-left: auto;
}

.btn-reset-view {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset-view:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Styles pour les nœuds de descendants */
.family-node.descendant-highlight {
    border: 3px solid var(--accent-color) !important;
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.3);
    animation: pulseDescendant 2s infinite;
}

.family-node.descendant-main {
    border: 4px solid var(--secondary-color) !important;
    box-shadow: 0 0 25px rgba(24, 188, 156, 0.4);
    transform: scale(1.05);
    z-index: 1000;
}

@keyframes pulseDescendant {
    0% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
    }
}

/* Légende pour la vue descendants */
.descendants-legend {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 10px auto 20px;
    max-width: 1200px;
    box-shadow: var(--shadow-lg);
    display: none;
}

.descendants-legend.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.legend-descendant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.legend-descendant-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-descendant-main {
    background-color: var(--secondary-color);
    border: 2px solid white;
}

.legend-descendant-highlight {
    background-color: var(--accent-color);
}
/* ======================== */
/*  ARBRE DES DESCENDANTS OPTIMISÉ */
/* ======================== */
.family-node.descendant-highlight {
    border: 3px solid var(--accent-color) !important;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.2);
    animation: pulseDescendant 2s infinite;
    min-width: 220px;
    max-width: 220px;
}

.family-node.descendant-main {
    border: 4px solid var(--secondary-color) !important;
    box-shadow: 0 8px 25px rgba(24, 188, 156, 0.3);
    transform: scale(1.05);
    z-index: 1000;
}

.family-node.descendant-highlight .node-avatar {
    background: linear-gradient(135deg, var(--gen4-color), var(--accent-color)) !important;
}

.family-node.descendant-main .node-avatar {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color)) !important;
}

.node-children-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(24, 188, 156, 0.1);
    border-radius: 12px;
    width: fit-content;
}

/* Connexions des descendants */
.tree-connection.descendant-connection {
    height: 3px !important;
    background: linear-gradient(90deg, var(--accent-color), var(--gen4-color)) !important;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.3);
}

.connection-junction {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 50%;
    left: 0;
    top: -4px;
    box-shadow: 0 0 5px rgba(24, 188, 156, 0.8);
    animation: pulseJunction 2s infinite;
}

@keyframes pulseJunction {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes pulseDescendant {
    0% {
        box-shadow: 0 5px 15px rgba(243, 156, 18, 0.2);
    }
    50% {
        box-shadow: 0 5px 20px rgba(243, 156, 18, 0.4);
    }
    100% {
        box-shadow: 0 5px 15px rgba(243, 156, 18, 0.2);
    }
}

/* Styles pour la vue compacte */
.tree-wrapper.compact {
    padding: 40px !important;
    display: block !important;
}

/* Indicateur de vue */
.view-mode-indicator {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-lg);
    margin-left: auto;
}

.view-mode-indicator .current-view-text {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Bouton de réinitialisation */
.btn-reset-view {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-reset-view:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}
/* ======================== */
/*  MODE RESPONSIVE - TÉLÉPHONE */
/* ======================== */
@media (max-width: 768px) {
    /* Modal actions sur mobile */
    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Masquer le bouton "Voir la famille" sur mobile */
    .modal-actions .btn-primary:not(.modal-close) {
        display: none !important;
    }
    
    /* Afficher uniquement le bouton Fermer en premier */
    .modal-actions .modal-close {
        order: 1;
        margin-top: 10px;
    }
    
    /* Bouton descendants sur une nouvelle ligne */
    .modal-actions .btn-descendants {
        order: 2;
    }
    
    /* Ajustements pour l'en-tête sur mobile */
    .header-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .member-select-container {
        width: 100%;
    }
    
    .view-mode-indicator {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
    
    /* Ajustements pour l'arbre sur mobile */
    .tree-container {
        height: 500px;
        padding: 10px;
    }
    
    .family-node {
        min-width: 180px;
        max-width: 180px;
        padding: 12px;
    }
    
    .node-name {
        font-size: 0.95rem;
    }
    
    .node-details {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    /* En-tête */
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-tagline {
        font-size: 1rem;
    }
    
    /* Modal */
    .modal-header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .modal-avatar {
        width: 80px;
        height: 80px;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .modal-title h2 {
        font-size: 1.5rem;
    }
    
    /* Arbre sur très petit écran */
    .family-node {
        min-width: 160px;
        max-width: 160px;
        padding: 10px;
    }
    
    .tree-container {
        height: 400px;
    }
    
    /* Boutons de contrôle */
    .search-btn span,
    .btn span:not(.select-icon) {
        display: none;
    }
    
    .search-btn i,
    .btn i {
        margin-right: 0;
    }
}
/* Bouton Fermer prioritaire sur mobile */
.mobile-close-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-close-btn {
        display: flex;
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        z-index: 100;
        border: none;
    }
    
    /* Cacher le bouton Fermer dans modal-actions sur mobile */
    .modal-actions .modal-close:first-child {
        display: none;
    }
}

.form-modal {
    max-width: 700px !important;
    width: 90%;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 188, 156, 0.1);
}

.btn-edit {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-delete {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.ancestors-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.ancestor-gen {
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.ancestor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.ancestor-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.ancestor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left-color: var(--secondary-color);
}

.ancestor-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.ancestor-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ancestor-info strong {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.ancestor-info small {
    font-size: 0.75rem;
    color: var(--dark-gray);
}

.ancestor-relation {
    font-size: 0.7rem;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 5px;
    align-self: flex-start;
}

.btn-ancestor {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    width: 100%;
    margin-top: 15px;
}
.gallery-container {
    max-width: 800px;
    margin: 0 auto;
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 400px;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 12px;
    font-size: 0.95rem;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev { left: 15px; }
.gallery-next { right: 15px; }

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    overflow-x: auto;
}

.gallery-thumbnail {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbnail.active {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.gallery-info {
    text-align: center;
    margin-top: 15px;
    color: var(--dark-gray);
    font-size: 0.85rem;
}

.export-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

.export-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.export-btn i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.export-btn small {
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.9;
}

.export-png {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.export-pdf {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.export-csv {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.export-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.export-note {
    text-align: center;
    color: var(--dark-gray);
    font-size: 0.85rem;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
    padding: 20px;
}

#minimap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 250px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 10000;
    border: 1px solid #eee;
}

.minimap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 10px 10px 0 0;
}

.minimap-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
}

.minimap-canvas {
    position: relative;
    width: 200px;
    height: 150px;
    margin: 15px auto;
    background: #f5f5f5;
    border: 1px solid #ddd;
    overflow: hidden;
}

.minimap-viewport {
    position: absolute;
    border: 2px solid var(--secondary-color);
    background: rgba(24, 188, 156, 0.1);
    cursor: move;
}

#minimap.collapsed .minimap-canvas {
    display: none;
}

.btn-fullscreen {
    background: linear-gradient(135deg, var(--dark-color), var(--primary-color));
    color: white;
}

.statistics-container {
    max-width: 1000px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
}

.stats-header {
    text-align: center;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

.stat-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 8px;
}

.stats-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.chart-container h4 {
    margin-bottom: 15px;
    color: var(--dark-color);
    font-size: 1rem;
}

.stats-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stats-table-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th {
    text-align: left;
    padding: 10px;
    background: #f8f9fa;
    font-size: 0.8rem;
    color: var(--dark-gray);
}

.stats-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.stats-table tr:hover td {
    background: rgba(24, 188, 156, 0.05);
}

.rank {
    display: inline-block;
    width: 25px;
    height: 25px;
    line-height: 25px;
    text-align: center;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .stats-charts,
    .stats-tables {
        grid-template-columns: 1fr;
    }
}

.share-dialog {
    max-width: 500px;
}

.share-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.share-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.share-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.share-title h3 {
    margin: 0 0 5px 0;
    color: var(--dark-color);
}

.share-title p {
    margin: 0;
    color: var(--dark-gray);
    font-size: 0.85rem;
}

.share-url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.share-url-container input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #f8f9fa;
}

.share-social {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.facebook { background: #1877f2; }
.whatsapp { background: #25D366; }
.email { background: #6c757d; }
.twitter { background: #1da1f2; }

.share-qrcode {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

#qrcode {
    display: inline-block;
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

/* Bouton de partage dans la modal */
.btn-share {
    background: linear-gradient(135deg, #6c5ce7, #a463f5);
    color: white;
    margin-left: 10px;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.btn-share i {
    margin-right: 5px;
}

.autosave-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding-left: 15px;
    border-left: 1px solid #ddd;
}

.autosave-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--dark-gray);
    transition: all 0.3s;
}

.autosave-indicator.saved {
    background: var(--secondary-color);
    color: white;
}

.btn-save, .btn-export {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-save:hover, .btn-export:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    color: white;
}

.restore-dialog {
    text-align: center;
    padding: 20px;
}

.restore-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.restore-warning {
    color: #e74c3c;
    font-size: 0.9rem;
    margin: 20px 0;
    padding: 10px;
    background: #fdeaea;
    border-radius: 8px;
}

.restore-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 25px;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 10px;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(15deg);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Animation de transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.family-node,
.modal-content,
.btn,
input,
select {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ============================
   STYLES DE LA BARRE D'OUTILS
   ============================ */
.tree-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    border: 1px solid rgba(24, 188, 156, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}
.tree-toolbar:hover {
    box-shadow: 0 8px 25px rgba(24, 188, 156, 0.15);
    border-color: rgba(24, 188, 156, 0.3);
}

/* Style de base des boutons */
.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Effet de brillance au survol */
.toolbar-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.toolbar-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Icônes */
.toolbar-btn i {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
    color: inherit;
}

.toolbar-btn:hover i {
    transform: scale(1.1);
}

/* État actif / enfoncé */
.toolbar-btn:active {
    transform: scale(0.95);
}

/* Tablettes (≤ 768px) - On réduit l'espace */
@media (max-width: 768px) {
    .tree-toolbar {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .toolbar-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}

/* Petits écrans (≤ 576px) - ON CACHE LE TEXTE ! */
@media (max-width: 576px) {
    .tree-toolbar {
        justify-content: center;
        padding: 10px;
    }
    
    /* Cacher le texte des boutons */
    .toolbar-btn span {
        display: none;
    }
    
    /* Garder seulement les icônes */
    .toolbar-btn {
        padding: 12px;
        min-width: auto;
        border-radius: 50%;
        aspect-ratio: 1 / 1; /* Forme parfaitement ronde */
    }
    
    /* Ajuster la taille des icônes */
    .toolbar-btn i {
        font-size: 1.3rem;
        margin: 0;
    }
    
    /* Bouton Ajouter spécial */
    .btn-add {
        background: linear-gradient(145deg, #18bc9c, #16a085) !important;
    }
}

/* Très petits écrans (≤ 380px) - Ajustement fin */
@media (max-width: 380px) {
    .tree-toolbar {
        gap: 6px;
    }
    
    .toolbar-btn {
        width: 45px;
        height: 45px;
        padding: 0;
    }
    
    .toolbar-btn i {
        font-size: 1.2rem;
    }
}
/* ============================
   THÈME SOMBRE
   ============================ */

body.dark-theme .tree-toolbar {
    background: #2c3e50;
    border-color: #4a5c6c;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

body.dark-theme .toolbar-btn {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5c6c;
}

body.dark-theme .btn-add {
    background: linear-gradient(145deg, #18bc9c, #16a085) !important;
}

/* BOUTON EXPORTER */
.toolbar-btn:first-child {
    background: linear-gradient(145deg, #ffffff, #f0f2f5);
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:first-child i {
    color: #27ae60;
}

.toolbar-btn:first-child:hover {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: white;
    border-color: #27ae60;
    box-shadow: 0 8px 18px rgba(39, 174, 96, 0.25);
}

.toolbar-btn:first-child:hover i {
    color: white;
}

/* BOUTON STATISTIQUES */
.toolbar-btn:nth-child(2) {
    background: linear-gradient(145deg, #ffffff, #f0f2f5);
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:nth-child(2) i {
    color: #3498db;
}

.toolbar-btn:nth-child(2):hover {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    border-color: #3498db;
    box-shadow: 0 8px 18px rgba(52, 152, 219, 0.25);
}

.toolbar-btn:nth-child(2):hover i {
    color: white;
}

/* BOUTON PLEIN ÉCRAN */
.toolbar-btn:nth-child(3) {
    background: linear-gradient(145deg, #ffffff, #f0f2f5);
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:nth-child(3) i {
    color: #9b59b6;
}

.toolbar-btn:nth-child(3):hover {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    color: white;
    border-color: #9b59b6;
    box-shadow: 0 8px 18px rgba(155, 89, 182, 0.25);
}

.toolbar-btn:nth-child(3):hover i {
    color: white;
}

/* BOUTON AJOUTER (SPÉCIAL) */
.btn-add {
    background: linear-gradient(145deg, #18bc9c, #16a085) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    position: relative;
    padding: 12px 28px;
}

.btn-add i {
    color: white !important;
}

.btn-add:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(24, 188, 156, 0.4);
}

.btn-add:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(24, 188, 156, 0.35);
}

/* BADGE DE NOTIFICATION (optionnel) */
.toolbar-btn {
    position: relative;
}

.toolbar-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: bold;
    border: 2px solid white;
}

/* ÉTAT DÉSACTIVÉ */
.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.toolbar-btn:disabled:hover {
    background: #f8f9fa;
    color: #2c3e50;
    transform: none;
    box-shadow: none;
}

.toolbar-btn:disabled:hover i {
    color: inherit;
    transform: none;
}

.toolbar-btn:disabled::before {
    display: none;
}

/* ============================
   VARIANTE COMPACTE (POUR PETITS ÉCRANS)
   ============================ */

@media (max-width: 768px) {
    .btn-share {
        display: inline-flex;
        align-items: center;
    }
    .tree-toolbar {
        padding: 10px 15px;
        gap: 8px;
        border-radius: 30px;
    }
    
    .toolbar-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .toolbar-btn i {
        font-size: 1rem;
    }
    .btn-share {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .tree-toolbar {
        justify-content: center;
    }
    
    .toolbar-btn {
        flex: 1;
        min-width: 120px;
    }
    .btn-share {
        display: inline-flex;
        align-items: center;
    }
    /* Version icônes seulement sur très petits écrans */
    @media (max-width: 480px) {
        .toolbar-btn span {
            display: none;
        }
        
        .toolbar-btn {
            min-width: auto;
            padding: 12px;
            border-radius: 50%;
        }
        
        .toolbar-btn i {
            font-size: 1.2rem;
            margin: 0;
        }
        
        .btn-add {
            padding: 12px;
        }
    }
}

/* ============================
   THÈME SOMBRE
   ============================ */

body.dark-theme .tree-toolbar {
    background: #2c3e50;
    border-color: #4a5c6c;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

body.dark-theme .toolbar-btn {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5c6c;
}

body.dark-theme .toolbar-btn i {
    color: #bdc3c7;
}

body.dark-theme .toolbar-btn:first-child,
body.dark-theme .toolbar-btn:nth-child(2),
body.dark-theme .toolbar-btn:nth-child(3) {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5c6c;
}

body.dark-theme .toolbar-btn:first-child i {
    color: #2ecc71;
}

body.dark-theme .toolbar-btn:nth-child(2) i {
    color: #3498db;
}

body.dark-theme .toolbar-btn:nth-child(3) i {
    color: #9b59b6;
}

body.dark-theme .toolbar-btn:first-child:hover {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

body.dark-theme .toolbar-btn:nth-child(2):hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

body.dark-theme .toolbar-btn:nth-child(3):hover {
    background: #9b59b6;
    color: white;
    border-color: #9b59b6;
}

body.dark-theme .btn-add {
    background: linear-gradient(145deg, #18bc9c, #16a085) !important;
}

/* ============================
   ANIMATIONS
   ============================ */

/* Animation d'entrée */
@keyframes toolbarSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tree-toolbar {
    animation: toolbarSlideIn 0.5s ease-out;
}

/* Effet de pulsation pour le bouton Ajouter */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(24, 188, 156, 0.5);
    }
    100% {
        box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    }
}

.btn-add {
    animation: pulse 2s infinite;
}

.btn-add:hover {
    animation: none;
}

/* ============================
   VARIANTE AVEC SÉPARATEURS
   ============================ */

.tree-toolbar.with-separators .toolbar-btn {
    border-radius: 0;
    margin: 0;
}

.tree-toolbar.with-separators .toolbar-btn:not(:last-child) {
    border-right: 1px solid rgba(0,0,0,0.05);
}

/* ============================
   EFFET DE SURBRILLANCE SUPPLÉMENTAIRE
   ============================ */

.toolbar-btn:hover {
    background-position: right center;
    background-size: 200% auto;
}

.toolbar-btn:first-child:hover {
    background-image: linear-gradient(to right, #27ae60 0%, #2ecc71 50%, #27ae60 100%);
}

.toolbar-btn:nth-child(2):hover {
    background-image: linear-gradient(to right, #3498db 0%, #5dade2 50%, #3498db 100%);
}

.toolbar-btn:nth-child(3):hover {
    background-image: linear-gradient(to right, #9b59b6 0%, #af7ac5 50%, #9b59b6 100%);
}

/* ============================
   INDICATEUR DE CHARGEMENT
   ============================ */

.toolbar-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.toolbar-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================
   TOOLTIP PERSONNALISÉ
   ============================ */

.toolbar-btn[title] {
    position: relative;
}

.toolbar-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    animation: tooltipFade 0.2s ease;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================
   STYLES POUR L'ASCENDANCE
   ============================ */

.ancestors-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
}

.ancestors-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--secondary-color);
}

.ancestors-count {
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-top: 5px;
}

.ancestor-generation {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.ancestor-gen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.ancestor-gen-title {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.ancestor-gen-count {
    background: var(--secondary-color);
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.ancestor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.ancestor-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary-color);
}

.ancestor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left-color: var(--secondary-color);
}

.ancestor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.ancestor-info {
    flex: 1;
}

.ancestor-name {
    font-size: 1rem;
    margin-bottom: 5px;
}

.ancestor-dates {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.ancestor-relation {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 10px;
    background: #e9ecef;
    border-radius: 12px;
    color: var(--dark-color);
}

/* Arbre en éventail */
.ancestor-tree {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.ancestor-fan {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding: 10px;
    overflow-x: auto;
}

.fan-node {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fan-root {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--secondary-color), #16a085);
    color: white;
    border-radius: 30px;
    font-weight: bold;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(24, 188, 156, 0.3);
}

.fan-parents {
    display: flex;
    gap: 30px;
    position: relative;
    padding-top: 20px;
}

.fan-parents::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: var(--secondary-color);
}

.fan-parent {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.fan-parent::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    width: 2px;
    height: 20px;
    background: var(--secondary-color);
}

.fan-parent-name {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.fan-parent-name:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.fan-unknown {
    background: #95a5a6 !important;
    cursor: default;
}

.fan-unknown:hover {
    transform: none;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--dark-gray);
    font-style: italic;
}

.ancestors-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

/* Thème sombre */
body.dark-theme .ancestor-generation {
    background: #2c3e50;
}

body.dark-theme .ancestor-card {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-theme .ancestor-relation {
    background: #4a5c6c;
    color: #ecf0f1;
}

body.dark-theme .ancestor-tree {
    background: #2c3e50;
}

.btn-ancestors {
    background: linear-gradient(135deg, #16a085, #0e6655);
    color: white;
}

.btn-ancestors i {
    margin-right: 5px;
}

/* ============================
   SECTION CONTACTS - MODAL
   ============================ */

#contactSection {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #ecf0f1);
}

#contactSection h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color, #2c3e50);
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

#contactSection h4 i {
    color: var(--secondary-color, #18bc9c);
    font-size: 1.1rem;
}

/* Conteneur des boutons */
.contact-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

/* Style de base des boutons de contact */
.contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    flex: 0 1 auto;
    min-width: 160px;
    letter-spacing: 0.3px;
}

/* Effet de brillance */
.contact-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.contact-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Icônes */
.contact-btn i {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.contact-btn:hover i {
    transform: scale(1.15);
}

/* ============================
   BOUTON D'APPEL
   ============================ */

.call-btn {
    background: linear-gradient(145deg, #28a745, #218838);
    box-shadow: 0 6px 14px rgba(40, 167, 69, 0.25);
}

.call-btn:hover {
    background: linear-gradient(145deg, #34ce57, #28a745);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.35);
}

.call-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(40, 167, 69, 0.25);
}

/* ============================
   BOUTON WHATSAPP
   ============================ */

.whatsapp-btn {
    background: linear-gradient(145deg, #25D366, #20bd59);
    box-shadow: 0 6px 14px rgba(37, 211, 102, 0.25);
}

.whatsapp-btn:hover {
    background: linear-gradient(145deg, #36e676, #25D366);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.35);
}

.whatsapp-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 211, 102, 0.25);
}

/* ============================
   VARIANTE COMPACTE
   ============================ */

.contact-buttons.compact .contact-btn {
    padding: 10px 20px;
    min-width: 140px;
    font-size: 0.9rem;
}

.contact-buttons.compact .contact-btn i {
    font-size: 1.1rem;
}

/* ============================
   VERSION PLEINE LARGEUR (MOBILE)
   ============================ */

.contact-buttons.full-width {
    flex-direction: column;
}

.contact-buttons.full-width .contact-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 14px 20px;
}

/* ============================
   ÉTAT DÉSACTIVÉ
   ============================ */

.contact-btn.disabled,
.contact-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.contact-btn.disabled:hover,
.contact-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================
   BADGE DE STATUT
   ============================ */

.contact-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

/* ============================
   INFO DE CONTACT SUPPLÉMENTAIRE
   ============================ */

.contact-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--dark-gray, #7f8c8d);
    border: 1px solid #e9ecef;
}

.contact-info i {
    color: var(--secondary-color, #18bc9c);
    margin-right: 6px;
}

.contact-info span {
    display: inline-flex;
    align-items: center;
}

.contact-info .copy-btn {
    background: none;
    border: none;
    color: var(--secondary-color, #18bc9c);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.contact-info .copy-btn:hover {
    background: rgba(24, 188, 156, 0.1);
}

/* ============================
   ANIMATIONS
   ============================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
    }
    50% {
        box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
    }
    100% {
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
    }
}

/* Animation subtile au chargement */
.contact-btn {
    animation: fadeIn 0.3s ease backwards;
}

.contact-btn:nth-child(1) { animation-delay: 0.1s; }
.contact-btn:nth-child(2) { animation-delay: 0.2s; }

/* Effet de pulsation pour WhatsApp (plus visible) */
.whatsapp-btn {
    animation: pulse 2s infinite;
}

.whatsapp-btn:hover {
    animation: none;
}

/* ============================
   THÈME SOMBRE
   ============================ */

body.dark-theme #contactSection {
    border-top-color: #4a5c6c;
}

body.dark-theme #contactSection h4 {
    color: #ecf0f1;
}

body.dark-theme .contact-info {
    background: #2c3e50;
    border-color: #4a5c6c;
    color: #bdc3c7;
}

body.dark-theme .call-btn {
    background: linear-gradient(145deg, #27ae60, #229954);
    box-shadow: 0 6px 14px rgba(39, 174, 96, 0.2);
}

body.dark-theme .whatsapp-btn {
    background: linear-gradient(145deg, #25D366, #1da851);
    box-shadow: 0 6px 14px rgba(37, 211, 102, 0.2);
}

/* ============================
   VERSION AVEC NUMÉRO VISIBLE
   ============================ */

.contact-btn.with-number {
    justify-content: space-between;
    padding: 12px 20px;
}

.contact-btn .phone-number {
    font-size: 0.85rem;
    opacity: 0.9;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    #contactSection h4 {
        font-size: 0.95rem;
    }
    
    .contact-buttons {
        gap: 12px;
    }
    
    .contact-btn {
        padding: 11px 20px;
        min-width: 140px;
        font-size: 0.9rem;
    }
    
    .contact-btn i {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    #contactSection {
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .contact-buttons {
        flex-direction: column;
    }
    
    .contact-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 14px 20px;
        min-width: auto;
    }
    
    .contact-btn i {
        font-size: 1.2rem;
        width: 24px;
        text-align: center;
    }
    
    .contact-info {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }
}

@media (max-width: 380px) {
    .contact-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    .contact-btn i {
        font-size: 1.1rem;
    }
}

/* ============================
   VARIANTE AVEC OMBRE DOUCE
   ============================ */

.contact-btn.soft {
    box-shadow: none;
    border: 1px solid rgba(0,0,0,0.05);
}

.contact-btn.soft:hover {
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

/* ============================
   ÉTIQUETTE "COPIE" AU SURVOL
   ============================ */

.contact-btn .copy-hint {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s, bottom 0.2s;
    pointer-events: none;
}

.contact-btn:hover .copy-hint {
    opacity: 1;
    bottom: -25px;
}

/* ============================
   IMPRESSION
   ============================ */

@media print {
    .contact-btn {
        background: none !important;
        color: black !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .contact-btn i {
        color: black !important;
    }
}

/* ============================
   MODAL - MENU D'ACTIONS COMPACT
   ============================ */

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    background: #f8fafc;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 16px 16px;
}

/* Bouton principal (Fermer) */
.modal-actions .btn-primary,
.modal-actions .modal-close-btn {
    background: linear-gradient(145deg, #bc1846, #ab2f5b);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(24, 188, 156, 0.2);
}

.modal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(24, 188, 156, 0.3);
}

/* ===== MENU DÉROULANT D'ACTIONS ===== */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-dropdown-toggle {
    background: white;
    border: 1px solid #e0e4e9;
    color: #2c3e50;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.actions-dropdown-toggle i {
    color: var(--secondary-color, #18bc9c);
    font-size: 1rem;
}

.actions-dropdown-toggle:hover {
    background: #f1f5f9;
    border-color: #18bc9c;
}

.actions-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    border: 1px solid rgba(24, 188, 156, 0.1);
}

.actions-dropdown:hover .actions-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Éléments du menu */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: #2c3e50;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

/* Couleurs des icônes par action */
.dropdown-item.modifier i { color: #f39c12; }
.dropdown-item.supprimer i { color: #e74c3c; }
.dropdown-item.photos i { color: #9b59b6; }
.dropdown-item.ancetres i { color: #16a085; }
.dropdown-item.partager i { color: #3498db; }
.dropdown-item.descendants i { color: #2ecc71; }

/* Séparateur */
.dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    .modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        padding: 16px;
    }
    
    .modal-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .actions-dropdown {
        width: 100%;
    }
    
    .actions-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .actions-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid #e9ecef;
        margin-top: 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }
    
    .actions-dropdown.active .actions-dropdown-menu {
        display: block;
    }
}

/* Thème sombre */
body.dark-theme .modal-actions {
    background: #2c3e50;
    border-top-color: #4a5c6c;
}

body.dark-theme .actions-dropdown-toggle {
    background: #34495e;
    border-color: #4a5c6c;
    color: #ecf0f1;
}

body.dark-theme .actions-dropdown-menu {
    background: #2c3e50;
    border-color: #4a5c6c;
}

body.dark-theme .dropdown-item {
    color: #ecf0f1;
}

body.dark-theme .dropdown-item:hover {
    background: #34495e;
}

body.dark-theme .dropdown-divider {
    background: #4a5c6c;
}

/* ============================
   TREE TOOLBAR - STYLE RESPONSIVE
   ============================ */

.tree-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    border: 1px solid rgba(24, 188, 156, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

/* Style de base des boutons */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.toolbar-btn i {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

/* Effet de brillance */
.toolbar-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.toolbar-btn:hover::before {
    width: 300px;
    height: 300px;
}

.toolbar-btn:hover i {
    transform: scale(1.1);
}

/* ============================
   BOUTONS SPÉCIFIQUES
   ============================ */

/* Exporter */
.toolbar-btn:first-child {
    background: white;
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:first-child i {
    color: #27ae60;
}

.toolbar-btn:first-child:hover {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
    box-shadow: 0 8px 18px rgba(39, 174, 96, 0.25);
}

.toolbar-btn:first-child:hover i {
    color: white;
}

/* Statistiques */
.toolbar-btn:nth-child(2) {
    background: white;
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:nth-child(2) i {
    color: #3498db;
}

.toolbar-btn:nth-child(2):hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 8px 18px rgba(52, 152, 219, 0.25);
}

.toolbar-btn:nth-child(2):hover i {
    color: white;
}

/* Plein écran */
.toolbar-btn:nth-child(3) {
    background: white;
    color: #2c3e50;
    border: 1px solid #e0e4e9;
}

.toolbar-btn:nth-child(3) i {
    color: #9b59b6;
}

.toolbar-btn:nth-child(3):hover {
    background: #9b59b6;
    color: white;
    border-color: #9b59b6;
    box-shadow: 0 8px 18px rgba(155, 89, 182, 0.25);
}

.toolbar-btn:nth-child(3):hover i {
    color: white;
}

/* Ajouter */
.btn-add {
    background: linear-gradient(145deg, #18bc9c, #16a085) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    border: none !important;
}

.btn-add i {
    color: white !important;
}

.btn-add:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(24, 188, 156, 0.4);
}

/* ============================
   RESPONSIVE - POINTS DE RUPTURE
   ============================ */

/* GRANDS ÉCRANS (1200px+) */
@media (min-width: 1200px) {
    .tree-toolbar {
        padding: 14px 28px;
    }
    
    .toolbar-btn {
        padding: 14px 28px;
        font-size: 1rem;
    }
}

/* ÉCRANS MOYENS (768px - 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .tree-toolbar {
        padding: 12px 20px;
        gap: 10px;
    }
    
    .toolbar-btn {
        padding: 11px 22px;
        font-size: 0.9rem;
    }
}

/* TABLETTES (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .tree-toolbar {
        padding: 15px;
        gap: 12px;
        border-radius: 30px;
        justify-content: center;
    }
    
    .toolbar-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
        flex: 0 1 auto;
        min-width: 120px;
    }
    
    .btn-add {
        min-width: 140px;
    }
}

/* PETITS ÉCRANS (480px - 575px) */
@media (max-width: 575px) {
    .tree-toolbar {
        padding: 12px;
        gap: 10px;
        border-radius: 25px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .toolbar-btn {
        padding: 12px 10px;
        font-size: 0.85rem;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Le bouton Ajouter prend toute la largeur */
    .btn-add {
        grid-column: span 2;
        order: -1;
        margin-bottom: 5px;
    }
}

/* TRÈS PETITS ÉCRANS (320px - 479px) */
@media (max-width: 479px) {
    .tree-toolbar {
        padding: 10px;
        gap: 8px;
        border-radius: 20px;
        grid-template-columns: 1fr;
    }
    
    .toolbar-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
        justify-content: flex-start;
        white-space: normal;
        word-break: break-word;
    }
    
    .btn-add {
        grid-column: span 1;
    }
    
    /* Centrer le texte sur petits écrans */
    .toolbar-btn {
        justify-content: center;
    }
}

/* ============================
   MODE ICÔNES UNIQUEMENT (ultra compact)
   ============================ */

@media (max-width: 380px) {
    .tree-toolbar {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
    }
    
    .toolbar-btn {
        padding: 12px;
        min-width: auto;
        flex: 0 0 auto;
    }
    
    /* Cacher le texte, garder seulement les icônes */
    .toolbar-btn span {
        display: none;
    }
    
    .toolbar-btn i {
        font-size: 1.2rem;
        margin: 0;
    }
    
    /* Ajuster les largeurs */
    .toolbar-btn:first-child,
    .toolbar-btn:nth-child(2),
    .toolbar-btn:nth-child(3),
    .btn-add {
        width: 48px;
        height: 48px;
        padding: 0;
        border-radius: 50%;
    }
    
    .btn-add {
        width: 48px;
        height: 48px;
    }
}

/* ============================
   VARIANTE FLOTTANTE (MOBILE)
   ============================ */

@media (max-width: 576px) {
    .tree-toolbar.floating {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        width: auto;
        margin: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* ============================
   BARRE DÉFILANTE (SI TROP D'ÉLÉMENTS)
   ============================ */

@media (max-width: 768px) {
    .tree-toolbar.scrollable {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 15px;
    }
    
    .tree-toolbar.scrollable::-webkit-scrollbar {
        height: 4px;
    }
    
    .tree-toolbar.scrollable::-webkit-scrollbar-thumb {
        background: var(--secondary-color);
        border-radius: 10px;
    }
    
    .tree-toolbar.scrollable .toolbar-btn {
        flex: 0 0 auto;
    }
}

/* ============================
   THÈME SOMBRE
   ============================ */

body.dark-theme .tree-toolbar {
    background: #2c3e50;
    border-color: #4a5c6c;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

body.dark-theme .toolbar-btn {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5c6c;
}

body.dark-theme .toolbar-btn:first-child,
body.dark-theme .toolbar-btn:nth-child(2),
body.dark-theme .toolbar-btn:nth-child(3) {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5c6c;
}

body.dark-theme .toolbar-btn:first-child i {
    color: #2ecc71;
}

body.dark-theme .toolbar-btn:nth-child(2) i {
    color: #5dade2;
}

body.dark-theme .toolbar-btn:nth-child(3) i {
    color: #af7ac5;
}

body.dark-theme .toolbar-btn:first-child:hover {
    background: #27ae60;
    color: white;
}

body.dark-theme .toolbar-btn:nth-child(2):hover {
    background: #3498db;
    color: white;
}

body.dark-theme .toolbar-btn:nth-child(3):hover {
    background: #9b59b6;
    color: white;
}

/* ============================
   ÉTATS SPÉCIAUX
   ============================ */

/* Bouton actif */
.toolbar-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.toolbar-btn.active i {
    color: white;
}

/* Bouton désactivé */
.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Bouton en chargement */
.toolbar-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================
   IMPRESSION
   ============================ */

@media print {
    .tree-toolbar {
        display: none;
    }
}

/* ============================
   ANIMATIONS
   ============================ */

.tree-toolbar {
    animation: fadeInDown 0.5s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Effet de pulsation pour le bouton Ajouter */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(24, 188, 156, 0.5);
    }
    100% {
        box-shadow: 0 4px 12px rgba(24, 188, 156, 0.3);
    }
}

.btn-add {
    animation: pulse 2s infinite;
}

.btn-add:hover {
    animation: none;
}

/* ============================
   ARBRE ASCENDANT
   ============================ */

.ancestor-tree-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
}

.ancestor-tree-root {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.ancestor-tree-root::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: var(--secondary-color);
}

.ancestor-tree-level {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    position: relative;
}

.ancestor-tree-level h4 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ancestor-tree-level h4::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--secondary-color);
    border-radius: 2px;
}

.ancestor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.ancestor-node {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.ancestor-node:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-left-color: var(--secondary-color);
}

.root-node {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    max-width: 300px;
    margin: 0 auto;
    border-left-color: white;
}

.root-node .ancestor-details {
    color: rgba(255,255,255,0.9);
}

.root-node:hover {
    border-left-color: var(--accent-color);
}

.ancestor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}

.ancestor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ancestor-info {
    flex: 1;
    min-width: 0;
}

.ancestor-name {
    font-size: 0.95rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ancestor-dates {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.ancestor-relation {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 10px;
    background: #e9ecef;
    border-radius: 12px;
    color: var(--dark-color);
}

.no-ancestor {
    padding: 20px;
    text-align: center;
    background: #f1f3f5;
    border-radius: 10px;
    color: var(--dark-gray);
    font-style: italic;
}

/* Version liste simple */
.simple-ancestors {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.ancestors-list {
    list-style: none;
    padding: 0;
}

.ancestors-list li {
    padding: 8px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
}

/* Thème sombre */
body.dark-theme .ancestor-tree-level {
    background: #2c3e50;
}

body.dark-theme .ancestor-node {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-theme .ancestor-relation {
    background: #4a5c6c;
    color: #ecf0f1;
}

body.dark-theme .no-ancestor {
    background: #34495e;
    color: #bdc3c7;
}

body.dark-theme .ancestors-list li {
    background: #34495e;
    color: #ecf0f1;
}

/* Responsive */
@media (max-width: 768px) {
    .ancestor-grid {
        grid-template-columns: 1fr;
    }
   
    .ancestor-node {
        padding: 12px;
    }
   
    .ancestor-tree-level {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .ancestor-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
   
    .ancestor-name {
        font-size: 0.9rem;
    }
}

/* ============================
   GESTION DU BOUTON FERMER PAR TAILLE D'ÉCRAN
   ============================ */

/* Tablettes (≤ 768px) - On commence à réduire */
@media (max-width: 768px) {
    .modal-actions .modal-close-btn {
        display: none; /* Disparaît complètement */
    }
   
    /* Optionnel : Agrandir la croix du header pour compenser */
    .mobile-close-btn {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.3rem !important;
    }
}

/* Très petits écrans (≤ 480px) - Vérification */
@media (max-width: 480px) {
    .modal-actions .modal-close-btn {
        display: none !important;
    }
   
    /* S'assurer que la croix est bien visible */
    .mobile-close-btn {
        opacity: 1 !important;
        background: rgba(0,0,0,0.1) !important;
    }
}

/* Mode paysage sur mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .modal-actions .modal-close-btn {
        display: none;
    }
}

