/* ======================================= */
/* 1. MISE EN PAGE GÉNÉRALE DE contact.php */
/* ======================================= */

.main-container { 
    padding-top: 80px; /* Espace pour la navbar fixe */
}
@media (min-width: 960px) {
    .main-container { 
        padding-top: 100px;
    }
}

.page-header { 
    text-align: center; 
    padding: 3rem 1rem; 
}
.page-header h1 { 
    font-size: 2.8rem; 
    font-weight: 800; 
}

.chat-main-section { 
    padding: 0 5% 4rem; 
    max-width: 1300px; /* On élargit un peu pour plus de confort */
    margin: 0 auto; 
}

.chat-grid { 
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 pour la colonne de gauche, 1/3 pour la FAQ */
    gap: 3rem; 
    align-items: flex-start; 
}

/* ======================================= */
/* 2. COLONNE DE GAUCHE (CHAT & CONTACTS)  */
/* ======================================= */

.chat-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Espace entre le chat et le bloc contact en dessous */
}

/* --- Fenêtre de Chat --- */
/* --- Fenêtre de Chat --- */
.chat-window { 
    display: flex; 
    flex-direction: column; 
    border: 1px solid #e0e0e0; 
    border-radius: 16px; 
    overflow: hidden; /* Très important pour que les coins arrondis s'appliquent aux enfants */
    background-color: #fff; 
    
    /* On définit une hauteur fixe et des limites */
    height: 70vh; /* La fenêtre prendra 70% de la hauteur de l'écran */
    min-height: 500px;
    max-height: 700px; /* On empêche qu'elle soit trop grande sur les écrans très hauts */
}

.chat-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid #e0e0e0; background-color: #f9f9f9; flex-shrink: 0; }
.chat-header .avatar { width: 40px; height: 40px; border-radius: 50%; }
.chat-header .chat-info { font-weight: 600; }
.chat-header .chat-info span { display: block; font-size: 0.85rem; color: #6e6e73; font-weight: 400; }

/* Historique de conversation */
.chat-history { 
    flex-grow: 1; /* Fait en sorte que cette zone prenne TOUT l'espace vertical disponible */
    overflow-y: auto; /* LA RÈGLE MAGIQUE : Ajoute une barre de défilement si les messages dépassent */
    padding: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
}

.message-bubble { display: flex; gap: 0.75rem; max-width: 80%; line-height: 1.5; }
.message-bubble.received { align-self: flex-start; }
.message-bubble.sent { align-self: flex-end; }
.message-bubble .avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; align-self: flex-end; }
.message-group { display: flex; flex-direction: column; }
.message-bubble.sent .message-group { align-items: flex-end; }
.message-content {
    padding: 0.8rem 1rem;
    border-radius: 20px;
    
    /* LA CORRECTION EST ICI */
    overflow-wrap: break-word;
    word-wrap: break-word; /* Ancien nom pour la compatibilité */
    word-break: break-word; /* Sécurité supplémentaire */
}
.message-content p { margin: 0; }
.message-bubble.received .message-content { background-color: #e9e9eb; border-bottom-left-radius: 4px; }
.message-bubble.sent .message-content { background-color: #3e2372; color: white; border-bottom-right-radius: 4px; }
.message-time { font-size: 0.75rem; opacity: 0.7; display: block; margin-top: 4px; }
.message-bubble.sent .message-time { text-align: right; }
.message-content.standalone-time { background-color: transparent !important; color: inherit !important; padding: 0; }

/* Images dans le chat */
.message-attachments { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; max-width: 250px; }
.message-bubble.sent .message-attachments { justify-content: flex-end; }
.chat-image-attachment { width: 80px; height: 80px; object-fit: cover; border-radius: 12px; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: transform 0.2s; }
.chat-image-attachment:hover { transform: scale(1.05); }

/* Zone pour écrire le message */
.message-composer { border-top: 1px solid #e0e0e0; padding: 1rem; background-color: #f9f9f9; flex-shrink: 0; }
.message-composer textarea { width: 100%; border: 1px solid #ccc; border-radius: 8px; padding: 0.8rem; font-size: 1rem; resize: none; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.composer-actions .btn-submit { width: auto; padding: 0.6rem; line-height: 1; }
.attachment-btn { cursor: pointer; color: #6e6e73; padding: 0.5rem; }
.attachment-btn:hover { color: #3e2372; }
#image-preview-container { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 10px; border-top: 1px solid #e0e0e0; margin-top: 10px; max-height: 120px; overflow-y: auto; }
.preview-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ddd; padding: 5px; border-radius: 8px; }
.preview-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.preview-item span { font-size: 0.8rem; color: #555; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-delete-btn { background: #e53e3e; color: white; border: none; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-weight: bold; }

/* Visionneuse (Lightbox) */
#lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 1000; align-items: center; justify-content: center; }
#lightbox.visible { display: flex; }
.lightbox-content { max-width: 90%; max-height: 90%; box-shadow: 0 0 50px rgba(0,0,0,0.5); }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; }

/* Bloc contact sous le chat */
.chat-sub-contact { padding: 1.5rem; background-color: #f5f5f7; border-radius: 16px; }
.chat-sub-contact h4 { margin: 0 0 0.5rem 0; font-size: 1.2rem; text-align: center; }
.chat-sub-contact p { margin: 0 0 1.5rem 0; color: #6e6e73; text-align: center; }
.contact-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact-card { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #fff; border: 1px solid #e0e0e0; border-radius: 12px; padding: 1rem; text-decoration: none; color: #1d1d1f; font-weight: 600; gap: 0.5rem; transition: transform 0.2s, box-shadow 0.2s; }
.contact-card:hover { transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0,0,0,0.07); }
.contact-card svg { stroke: #3e2372; fill: none; stroke-width: 2; width: 28px; height: 28px; }

/* ======================================= */
/* 3. COLONNE DE DROITE (INFOS & FAQ)      */
/* ======================================= */
.contact-info-wrapper { background-color: #f5f5f7; padding: 2rem; border-radius: 16px; align-self: flex-start; }
.contact-info-wrapper h3 { margin-top: 0; margin-bottom: 1rem; }
.contact-title-separator { margin-top: 2rem; }
.social-links { display: flex; gap: 1rem; }
.social-links a { color: #6e6e73; }
.social-links a:hover { color: #3e2372; }
.social-links svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Accordéon FAQ amélioré */
.faq-accordion details { background-color: #fff; border: 1px solid #e0e0e0; border-radius: 12px; margin-bottom: 0.5rem; transition: background-color 0.2s; }
.faq-accordion details:hover { background-color: #f9f9f9; }
.faq-accordion summary { display: flex; justify-content: space-between; align-items: center; font-size: 1rem; font-weight: 600; cursor: pointer; list-style: none; padding: 1rem 1.5rem; }
.faq-accordion summary::-webkit-details-marker { display: none; }
.faq-accordion summary .icon { font-size: 1.5rem; font-weight: 400; color: #3e2372; transition: transform 0.3s ease; }
.faq-accordion details[open] summary .icon { transform: rotate(45deg); }
.faq-accordion details p { padding: 0 1.5rem 1rem; margin-top: 0; line-height: 1.7; color: #6e6e73; border-top: 1px solid #e0e0e0; padding-top: 1rem; }


/* ======================================= */
/* 4. RESPONSIVE                           */
/* ======================================= */
@media (max-width: 1024px) {
    /* Sur tablette, on passe en une seule colonne */
    .chat-grid { 
        grid-template-columns: 1fr; 
    }
    .contact-info-wrapper { 
        margin-top: 3rem; 
    }
}

@media (max-width: 768px) {
    .page-header h1 { font-size: 2.2rem; }
    .chat-window { min-height: 450px; }
    .contact-methods { grid-template-columns: 1fr; }
}