/*
 * ============================================================
 * CSS — Widget Chatbot IA (Style iOS / Bulles modernes)
 * ============================================================
 */

/* --- Le bouton flottant (Pop) --- */
.chatbot-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #2C2C34;
    color: #F5F0E8;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(44, 44, 52, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease;
    z-index: 9999;
    user-select: none;
}

.chatbot-trigger:hover {
    transform: scale(1.1);
    background: #1a1a22;
}

/* --- La fenêtre principale --- */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0,0,0,0.05);
}

.chatbot-window.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* --- En-tête --- */
.chatbot-header {
    background: #F5F0E8;
    color: #2C2C34;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.chatbot-header-info {
    display: flex;
    flex-direction: column;
}

.chatbot-header-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-status {
    font-size: 0.8rem;
    color: #6b6b76;
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 8px;
    height: 8px;
    background: #27AE60;
    border-radius: 50%;
    display: inline-block;
}

.chatbot-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b6b76;
    cursor: pointer;
    transition: color 0.2s ease;
}
.chatbot-close:hover {
    color: #2C2C34;
}

/* --- Zone des messages --- */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Scrollbar invisible pour un look "natif" */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* Bulles */
.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeInBubble 0.3s ease;
    word-wrap: break-word;
}

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

.bubble-bot {
    align-self: flex-start;
    background: #e9e9eb;
    color: #000;
    border-radius: 20px 20px 20px 4px;
}

.bubble-user {
    align-self: flex-end;
    background: #2C2C34;
    color: #ffffff;
    border-radius: 20px 20px 4px 20px;
}

/* --- Indicateur de réflexion (Typing) --- */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 5px 2px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background: #8e8e93;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- Input Area --- */
.chatbot-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    background: #f1f1f2;
    border: none;
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 0.95rem;
    resize: none; /* empecher redimensionnement manuel */
    font-family: inherit;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
}

.chatbot-input:focus {
    background: #eef;
}

.chatbot-send {
    background: #2C2C34;
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #1a1a22;
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* --- Responsive pleine page mobile --- */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        transform: translateY(100%);
    }
    
    .chatbot-trigger {
        bottom: 20px;
        right: 20px;
    }
}
