:root {
    --color-brand-purple: #872D84;
    --color-brand-green: #04C360;

    --ia-bg: #faf5f1;
    --ia-panel-bg: #f7f9fb;
    --ia-text: #2c3e50;
    --ia-muted: #6b7280;
    --ia-danger: #b00020;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-soft: 0 4px 15px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }

/* --- CORRECTION : Suppression de 'html, body' ici pour rétablir le scroll sur les autres pages --- */
.chatbot-layout {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-color: var(--ia-panel-bg);
}

/* Le reste du fichier reste identique ... */

#chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--ia-panel-bg);
    border-radius: 50%;
    color: var(--ia-text);
    border: 2px solid var(--color-brand-purple);
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(150, 150, 150, 0.4);
    z-index: 20000;
    transition: transform 0.3s ease;
}

#chatbot-toggler span {
    color: var(--color-brand-purple);
}

#chatbot-toggler:hover { transform: scale(1.1); }
#chatbot-toggler.active { transform: rotate(90deg); background: #e74c3c; color: #fff; }

#chatbot-widget-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 70vh;
    max-height: 800px;
    background: var(--ia-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    z-index: 19999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

#chatbot-widget-container.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

#chatbot-widget-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background-color: var(--ia-panel-bg);
    overflow: hidden;
}

.chat-header {
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--color-brand-green), var(--color-brand-purple));
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #faf5f1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
}

.header-info h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.messages-area {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background-color: #f7f9fb;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.utilisateur { align-self: flex-end; align-items: flex-end; }
.message.robot { align-self: flex-start; align-items: flex-start; }

.bubble {
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 0.9rem;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.message.utilisateur .bubble { background: var(--color-brand-green); color: #faf5f1; border-bottom-right-radius: 2px; }
.message.robot .bubble { background: #fff; color: var(--ia-text); border-bottom-left-radius: 2px; border: 1px solid #eee; }

.time { font-size: 0.65rem; color: var(--ia-muted); margin-top: 4px; }

.input-area {
    flex: 0 0 auto;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatForm {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.mic-btn {
    flex: 0 0 auto;
    font-size: 1.1rem;
    color: #9ca3af;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}
.mic-btn.recording { color: #e74c3c; animation: pulse 1.5s infinite; }

.input-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 0 15px;
    height: 40px;
}

#userMessage {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: #333;
}

#sendBtn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand-green), #039e50);
    color: #faf5f1;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(4, 195, 96, 0.2);
    transition: transform 0.2s;
}
#sendBtn:hover { transform: scale(1.05); }

.close-chat-btn {
    background: transparent;
    border: none;
    color: #faf5f1;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 768px) {
    #chatbot-widget-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    #chatbot-toggler { bottom: 20px; right: 20px; width: 50px; height: 50px; }
}