/**
 * Histoire Familiale - Styles CSS
 * 
 * Styles pour l'interface de l'outil Histoire Familiale
 * Design moderne et cohérent avec Gedcom Studio
 */

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */

.histoire-familiale-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   EN-TÊTE
   ======================================== */

.hf-header {
    text-align: center;
    margin-bottom: 30px;
}

.hf-header h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.hf-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   INDICATEUR D'ÉTAPES
   ======================================== */

.hf-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
}

.hf-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 2px;
    background: #e1e8ed;
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 50px;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: #a76107;
    color: white;
    transform: scale(1.1);
}

.step.active .step-label {
    color: #a76107;
    font-weight: 600;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e1e8ed;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    transition: all 0.3s ease;
}

/* ========================================
   CONTENU PRINCIPAL
   ======================================== */

.hf-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.hf-content h4 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.hf-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ========================================
   RECHERCHE
   ======================================== */

.hf-search {
    margin-bottom: 25px;
}

.hf-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.hf-search-input:focus {
    outline: none;
    border-color: #a76107;
    box-shadow: 0 0 0 3px rgba(167, 97, 7, 0.1);
}

.hf-search-help {
    margin-top: 8px;
}

.hf-search-help small {
    color: #999;
    font-size: 0.85rem;
}

/* ========================================
   LISTE DES PERSONNES
   ======================================== */

.hf-person-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    background: #fafbfc;
}

.hf-person-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e1e8ed;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.hf-person-item:last-child {
    border-bottom: none;
}

.hf-person-item:hover {
    background: #f8f9fa;
    transform: translateX(3px);
}

.hf-person-item:active {
    background: #e3f2fd;
}

.hf-person-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 4px;
}

.hf-person-details {
    color: #666;
    font-size: 0.9rem;
}

.hf-no-results {
    padding: 30px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ========================================
   SECTIONS DE PARENTÉ
   ======================================== */

.hf-relatives-sections {
    margin-top: 20px;
}

.hf-relatives-section {
    margin-bottom: 30px;
}

.hf-relatives-section h5 {
    color: #a76107;
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.hf-no-relatives {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.hf-no-relatives p {
    color: #666;
    font-size: 1rem;
    margin-bottom: 20px;
}

/* ========================================
   BOUTONS
   ======================================== */

.hf-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.hf-btn-primary {
    background: #a76107;
    color: white;
}

.hf-btn-primary:hover {
    background: #8b5006;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(167, 97, 7, 0.3);
}

.hf-btn-secondary {
    background: #e1e8ed;
    color: #666;
}

.hf-btn-secondary:hover {
    background: #d1d8dd;
}

/* ========================================
   ACTIONS DES ÉTAPES
   ======================================== */

.hf-step-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ========================================
   GÉNÉRATION ET PRÉVISUALISATION
   ======================================== */

.hf-generation-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #a76107;
}

.hf-generation-preview p {
    margin: 10px 0;
    color: #666;
}

/* ========================================
   DEBUG (temporaire)
   ======================================== */

.hf-debug {
    background: #f8f9fa !important;
    border: 1px solid #e1e8ed !important;
    border-radius: 8px !important;
    padding: 15px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 12px !important;
    color: #666 !important;
    margin-top: 20px !important;
}

/* ========================================
   RESPONSIVITÉ
   ======================================== */

@media (max-width: 768px) {
    .histoire-familiale-container {
        padding: 15px;
    }
    
    .hf-steps {
        flex-direction: column;
        gap: 20px;
    }
    
    .hf-steps::before {
        display: none;
    }
    
    .step {
        margin: 0;
        flex-direction: row;
        gap: 15px;
    }
    
    .step-number {
        margin-bottom: 0;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .hf-content {
        padding: 20px;
    }
    
    .hf-step-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hf-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hf-content {
    animation: fadeIn 0.5s ease-out;
}

/* ========================================
   SCROLLBAR PERSONNALISÉE
   ======================================== */

.hf-person-list::-webkit-scrollbar {
    width: 8px;
}

.hf-person-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.hf-person-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.hf-person-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   ÉTAPE 3 - AFFICHAGE DE LA LIGNÉE
   ======================================== */

.hf-lineage-summary {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
}

.hf-lineage-summary h5 {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #a76107;
    padding-bottom: 10px;
}

.hf-lineage-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.hf-info-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #a76107;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.hf-info-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hf-lineage-path h6 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 15px 0;
}

.hf-path-list {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.hf-path-person {
    display: flex;
    align-items: center;
    padding: 12px 0;
    position: relative;
}

.hf-path-person:not(:last-child) {
    border-bottom: 1px solid #f1f3f4;
}

.hf-path-number {
    background: #a76107;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.hf-path-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    margin-right: 15px;
}

.hf-path-period {
    color: #666;
    font-size: 0.9rem;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.hf-path-arrow {
    position: absolute;
    left: 14px;
    bottom: -8px;
    color: #a76107;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 2;
    background: white;
    width: 24px;
    height: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 0 0 3px white;
}

.hf-generation-preview {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
}

.hf-generation-preview h5 {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #28a745;
    padding-bottom: 10px;
}

.hf-story-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #666;
}

.hf-export-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.hf-export-section h6 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.hf-export-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hf-export-note {
    color: #28a745;
    font-style: italic;
    font-weight: 500;
}

.hf-generation-actions {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #a76107;
}

.hf-generation-note {
    color: #666;
    font-style: italic;
    display: block;
    margin-top: 10px;
}

.hf-story-content {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 25px;
    max-height: 400px;
    overflow-y: auto;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.6;
    color: #333;
}

/* ========================================
   CONFIGURATION DU RÉCIT
   ======================================== */

.hf-story-config {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
}

.hf-story-config h5 {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    border-bottom: 2px solid #6c757d;
    padding-bottom: 10px;
}

.hf-config-description {
    color: #666;
    margin: 0 0 25px 0;
    font-style: italic;
}

.hf-config-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.hf-config-group {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.hf-config-group-title {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e8ed;
}

.hf-config-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hf-config-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
    transition: all 0.2s ease;
}

.hf-config-option:hover {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px 8px;
    margin: 0 -8px;
}

.hf-config-option input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

.hf-config-label {
    color: #333;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.hf-config-suboptions {
    margin-left: 30px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #a76107;
}

.hf-config-suboption {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    cursor: pointer;
}

.hf-config-suboption input[type="radio"] {
    margin: 0;
}

.hf-config-sublabel {
    color: #666;
    font-size: 0.9rem;
}

.hf-config-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.hf-config-select .hf-config-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.hf-config-dropdown {
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
}

.hf-config-dropdown:focus {
    outline: none;
    border-color: #a76107;
    box-shadow: 0 0 0 2px rgba(167, 97, 7, 0.2);
}

.hf-config-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
    gap: 15px;
    flex-wrap: wrap;
}

.hf-config-subsection-title {
    color: #2c3e50;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 15px 0 8px 0;
    padding: 5px 0;
    border-bottom: 1px solid #e1e8ed;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Styles spéciaux pour les sous-options toujours visibles */
.hf-config-suboptions:not([style*="display: none"]) {
    margin-left: 25px;
    margin-top: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #a76107;
}

/* Animation pour l'affichage des sous-options */
.hf-config-suboptions {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Styles pour les sections principales */
.hf-config-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* Améliorer l'espacement des groupes */
.hf-config-group {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    border: 1px solid #e1e8ed;
}

/* Styles pour les dropdowns multiples */
.hf-config-group .hf-config-select {
    margin-bottom: 15px;
}

.hf-config-group .hf-config-select:last-child {
    margin-bottom: 0;
}

.hf-lineage-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    text-align: center;
}

.hf-lineage-error h5 {
    color: #c53030;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.hf-lineage-error p {
    color: #666;
    margin: 10px 0;
}

.hf-error-help {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.hf-error-help h6 {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.hf-error-help ul {
    color: #666;
    margin: 0;
    padding-left: 20px;
}

.hf-error-help li {
    margin: 8px 0;
    line-height: 1.5;
}

/* ========================================
   RESPONSIVITÉ ÉTAPE 3
   ======================================== */

@media (max-width: 768px) {
    .hf-lineage-info {
        grid-template-columns: 1fr;
    }
    
    .hf-path-person {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .hf-path-number {
        margin-bottom: 8px;
    }
    
    .hf-path-name {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .hf-export-buttons {
        flex-direction: column;
    }
}

/* ========================================
   PRÉVISUALISATION DE L'HISTOIRE
======================================== */

.hf-story-preview {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.hf-preview-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.hf-preview-header h5 {
    margin: 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

.hf-preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hf-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hf-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.hf-story-preview .hf-story-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

#story-markdown-content {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: #374151;
}

#story-markdown-content h1 {
    color: #1f2937;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

#story-markdown-content h2 {
    color: #374151;
    font-size: 22px;
    font-weight: 600;
    margin: 30px 0 15px 0;
    border-left: 4px solid #3b82f6;
    padding-left: 15px;
}

#story-markdown-content h3 {
    color: #4b5563;
    font-size: 18px;
    font-weight: 600;
    margin: 25px 0 12px 0;
}

#story-markdown-content p {
    margin: 0 0 15px 0;
    text-align: justify;
    text-indent: 20px;
}

#story-markdown-content strong {
    color: #1f2937;
    font-weight: 600;
}

#story-markdown-content em {
    font-style: italic;
    color: #6b7280;
}

#story-markdown-content hr {
    border: none;
    border-top: 1px solid #d1d5db;
    margin: 30px 0;
}

/* Boutons d'action de génération */
.hf-story-actions {
    margin-top: 30px;
    text-align: center;
}

.hf-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    margin: 0 5px;
}

.hf-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Scrollbar pour la prévisualisation */
.hf-story-preview .hf-story-content::-webkit-scrollbar {
    width: 6px;
}

.hf-story-preview .hf-story-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.hf-story-preview .hf-story-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.hf-story-preview .hf-story-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsivité pour la prévisualisation */
@media (max-width: 768px) {
    .hf-preview-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .hf-preview-actions {
        justify-content: center;
    }
    
    .hf-btn-secondary,
    .hf-btn-primary {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* ========================================
   OPTIONS NARRATIVES CONDITIONNELLES
======================================== */

#narrative-options {
    margin-top: 15px;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

#narrative-options .hf-config-select {
    margin-bottom: 15px;
}

#narrative-options .hf-config-select:last-child {
    margin-bottom: 0;
}

/* Animation pour l'affichage/masquage des options narratives */
#narrative-options {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Style pour les descriptions des formats */
.hf-config-select option {
    padding: 5px;
}