/* static/css/chatbot_widget.css - VERSION FINALE ANTI-CONFLIT */

/* ==================== BOUTON FLOTTANT (PC) ==================== */
#chatbot-open-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    /* Laisse passer les clics à travers le vide sur PC */
    pointer-events: none;
}

#chatbot-open-btn:hover {
    transform: scale(1.05);
}

#chatbot-open-btn img {
    width: 300px;
    height: 300px;
    object-fit: contain;
    border-radius: 0;
    /* L'image seule capte le clic sur PC */
    pointer-events: auto;
}

/* ==================== FENÊTRE DU CHATBOT ==================== */
#chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #1a1a2e;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    transform-origin: bottom right;
    animation: chatbotOpen 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#chatbot-window.hidden {
    display: none;
    /* CORRECTION : quand le chatbot est caché, il ne doit plus intercepter les taps */
    pointer-events: none;
}

@keyframes chatbotOpen {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==================== EN-TÊTE ==================== */
.chatbot-header {
    background: linear-gradient(135deg, #FF8811 0%, #FF6B35 100%);
    color: white;
    padding: 20px;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
}

.chatbot-header::before {
    content: "🤖";
    font-size: 24px;
    margin-right: 10px;
}

#chatbot-clear-btn, #chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#chatbot-close-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
}

/* ==================== ZONE DE MESSAGES ==================== */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #0f0f1e;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#chatbot-messages::-webkit-scrollbar { width: 6px; }
#chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 136, 17, 0.5);
    border-radius: 10px;
}

/* ==================== MESSAGES ==================== */
.message { display: flex; gap: 12px; align-items: flex-start; }

.message-text {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 16px;
    color: #e0e6f7;
    max-width: 280px;
    word-wrap: break-word;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
}

.ai-message .message-text {
    background: rgba(255, 136, 17, 0.15);
    border: 1px solid rgba(255, 136, 17, 0.3);
}

/* ==================== SUGGESTIONS ==================== */
.suggestions-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.suggestion-btn {
    background: rgba(255, 136, 17, 0.1);
    border: 1px solid rgba(255, 136, 17, 0.3);
    color: #FF8811;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-btn:hover {
    background: rgba(255, 136, 17, 0.2);
    border-color: rgba(255, 136, 17, 0.5);
    transform: translateX(3px);
}

.suggestion-btn::before { content: "💡"; }

/* ==================== FORMULAIRE ==================== */
#chatbot-form {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: #1a1a2e;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 16px;
}

#chatbot-form button[type="submit"] {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #FF8811 0%, #FF6B35 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
}

/* ==================== RESPONSIVE MOBILE ==================== */
@media (max-width: 768px) {
    #chatbot-open-btn {
        /* Taille réduite pour ne plus couvrir les planètes */
        width: 60px !important;
        height: 60px !important;
        bottom: 15px;
        right: 15px;
        background: linear-gradient(135deg, #FF8811, #FF6B35);
        border-radius: 50%;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        pointer-events: auto !important;
        /* CORRECTION : supprime le délai de 300ms sur les taps mobiles */
        touch-action: manipulation;
    }

    #chatbot-open-btn img {
        display: none !important; /* L'astronaute disparaît sur mobile */
    }

    #chatbot-open-btn::after {
        content: "🤖";
        font-size: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 10px;
        right: 10px;
    }

    .message-text { max-width: 80%; }
}