/* =========================================================================
   assistant.css – Styles du chat IA + modal de qualification
   Tokens utilisés : --c-primary (#12354A), --c-gold (#CDA349),
                     --c-beige (#f6f2ea), --radius (12px), --shadow
   ========================================================================= */

/* =========================================================================
   1. MODAL DE QUALIFICATION (overlay bloquant)
   ========================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;                                   /* top/right/bottom/left = 0 */
    z-index: 8000;                              /* au-dessus du header (1000) et cookie (9999 est ok) */
    background: rgba(18, 53, 74, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* cachée par défaut ; JS ajoute .is-visible */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Carte centrale */
.modal-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(18, 53, 74, 0.22);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px 32px;
    /* animation d'entrée légère */
    transform: translateY(12px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.is-visible .modal-card {
    transform: translateY(0) scale(1);
}

/* En-tête modal */
.modal-header {
    text-align: center;
    margin-bottom: 28px;
}
.modal-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #0F2F41, #12354A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #D4A64E;
}
.modal-header h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
    color: #12354A;
    font-family: 'Garamond', serif;
}
.modal-subtitle {
    margin: 0;
    font-size: 0.92rem;
    color: #6b7280;
    line-height: 1.45;
}

/* Champs du formulaire */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.modal-field label {
    font-size: 0.88rem;
    font-weight: 650;
    color: #12354A;
    font-family: var(--ff-ui);
}
.modal-field input {
    padding: 12px 14px;
    border: 1px solid #d9dbe3;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: var(--ff-ui);
    color: #0f172a;
    background: #f9fafb;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.modal-field input::placeholder {
    color: #9ca3af;
}
.modal-field input:focus {
    outline: none;
    background: #fff;
    border-color: #D4A64E;
    box-shadow: 0 0 0 3px rgba(212, 166, 78, 0.18);
}

/* Message d'erreur dans la modal */
.modal-error {
    display: none;
    padding: 10px 12px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 4px;
}

/* Bouton submit modal */
.modal-submit-btn {
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
    background: #12354A;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 650;
    font-family: var(--ff-ui);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 22px rgba(18, 53, 74, 0.28);
    transition: background 0.22s ease, transform 0.15s ease, box-shadow 0.22s ease;
}
.modal-submit-btn:hover {
    background: #D4A64E;
    color: #12354A;
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(18, 53, 74, 0.32);
}

/* =========================================================================
   2. SECTION ASSISTANT (page principale)
   ========================================================================= */
.assistant-section {
    padding: 2.5rem 0 3rem;
    min-height: calc(100vh - 260px);          /* remplir la page après le hero */
    display: flex;
    flex-direction: column;
}
.assistant-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* =========================================================================
   3. CHAT WRAPPER (carte englobante)
   ========================================================================= */
.chat-wrapper {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #eef3f6;
    box-shadow: 0 12px 30px rgba(18, 53, 74, 0.08);
    display: flex;
    flex-direction: column;
    flex: 1;
    max-height: calc(100vh - 280px);          /* limiter pour que le scroll fonctionne */
    min-height: 480px;
    overflow: hidden;
}

/* =========================================================================
   4. EN-TÊTE DU CHAT
   ========================================================================= */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0F2F41 0%, #12354A 100%);
    border-radius: 18px 18px 0 0;             /* coins haut seulement */
    flex-shrink: 0;
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #D4A64E;
    flex-shrink: 0;
}
.chat-title {
    display: block;
    color: #fff;
    font-weight: 650;
    font-size: 0.95rem;
    font-family: var(--ff-ui);
}
.chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    font-family: var(--ff-ui);
    margin-top: 1px;
}
.status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;                      /* vert vif */
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Bouton "Terminer & Rapport" */
.chat-end-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 600;
    font-family: var(--ff-ui);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
    flex-shrink: 0;
}
.chat-end-btn:hover {
    background: rgba(212, 166, 78, 0.25);
    border-color: #D4A64E;
    transform: translateY(-1px);
}
.chat-end-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* =========================================================================
   5. ZONE DES MESSAGES (scrollable)
   ========================================================================= */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafbfc;
}
/* Scrollbar discret */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* =========================================================================
   6. BULLES DE MESSAGE
   ========================================================================= */
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.93rem;
    line-height: 1.5;
    font-family: var(--ff-ui);
    color: #1f2937;
    position: relative;
    animation: bubble-in 0.2s ease;
}

@keyframes bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Bulles utilisateur (droite, bleu/navy) */
.chat-bubble.user {
    align-self: flex-end;
    background: #12354A;
    color: #fff;
    border-bottom-right-radius: 4px;          /* coin bas-droite plus petit */
}

/* Bulles assistant (gauche, gris clair) */
.chat-bubble.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid #eef3f6;
    border-bottom-left-radius: 4px;           /* coin bas-gauche plus petit */
    box-shadow: 0 2px 6px rgba(18, 53, 74, 0.06);
}

.bubble-text {
    /* word-break pour les longs mots sans espace (emails, URLs) */
    word-break: break-word;
}

/* =========================================================================
   7. INDICATEUR "EN COURS DE SAISIE" (3 points)
   ========================================================================= */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%          { transform: translateY(-5px); }
}

/* =========================================================================
   8. ZONE DE SAISIE (bas du chat)
   ========================================================================= */
.chat-input-area {
    flex-shrink: 0;
    padding: 14px 18px 18px;
    background: #fff;
    border-top: 1px solid #eef3f6;
}
.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.chat-input {
    flex: 1;
    resize: none;                             /* redimensionnement géré par JS */
    padding: 11px 16px;
    border: 1px solid #d9dbe3;
    border-radius: 999px;
    font-size: 0.93rem;
    font-family: var(--ff-ui);
    color: #0f172a;
    background: #f9fafb;
    line-height: 1.5;
    max-height: 120px;                        /* limite avant scroll interne */
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.chat-input::placeholder {
    color: #9ca3af;
}
.chat-input:focus {
    outline: none;
    background: #fff;
    border-color: #D4A64E;
    box-shadow: 0 0 0 3px rgba(212, 166, 78, 0.15);
    border-radius: 24px;                      /* garder arrondi même multi-lignes */
}
.chat-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Bouton d'envoi */
.chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #12354A;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(18, 53, 74, 0.3);
    transition: background 0.2s ease, transform 0.14s ease, box-shadow 0.2s ease;
}
.chat-send-btn:hover {
    background: #D4A64E;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(18, 53, 74, 0.35);
}
.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Avertissement légal sous la barre */
.chat-disclaimer {
    margin: 10px 0 0;
    font-size: 0.76rem;
    color: #6b7280;
    text-align: center;
    font-family: var(--ff-ui);
}

/* =========================================================================
   8b. QUESTIONS SUGGÉRÉES (chips au-dessus de la barre d'entrée)
   ========================================================================= */
.suggestions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 10px;
}
.suggestion-chip {
    padding: 7px 13px;
    background: #f0f4f8;
    border: 1px solid #dde4ec;
    border-radius: 999px;
    font-size: 0.82rem;
    font-family: var(--ff-ui);
    color: #374151;
    cursor: pointer;
    text-align: left;
    line-height: 1.35;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.suggestion-chip:hover {
    background: rgba(212, 166, 78, 0.12);
    border-color: #D4A64E;
    color: #12354A;
}

/* =========================================================================
   9. RESPONSIVE – mobile (≤640 px)
   ========================================================================= */
@media (max-width: 640px) {
    .modal-card {
        padding: 28px 20px 24px;
    }
    .modal-avatar {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }
    .modal-header h2 {
        font-size: 1.25rem;
    }

    .assistant-section {
        padding: 1.5rem 0 2rem;
        min-height: calc(100vh - 220px);
    }
    .chat-wrapper {
        max-height: calc(100vh - 240px);
        min-height: 380px;
        border-radius: 14px;
    }
    .chat-header {
        padding: 12px 14px;
        border-radius: 14px 14px 0 0;
    }
    .chat-end-btn span {
        display: none;                        /* cacher le texte, garder l'icône */
    }
    .chat-end-btn {
        padding: 8px 10px;
    }
    .chat-messages {
        padding: 14px;
        gap: 8px;
    }
    .chat-bubble {
        max-width: 90%;
        font-size: 0.88rem;
    }
    .chat-input-area {
        padding: 10px 12px 14px;
    }
    .chat-input {
        font-size: 0.88rem;
        padding: 10px 14px;
    }
}

