/* Icône du chatbot fixe */
.chatbot-icon {
    position: fixed;
    right : 0px;
    top: 265px;
    width: 170px;
    height: 55px;
    background: linear-gradient(135deg, #3295b4, #24819e);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
    color: white;
    font-size: 15px;
    line-height: 18px;
    border-radius: 8px 0 0 8px;
    padding: 0 8px;

}

.chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

.chatbot-icon svg {
    width: 50px;
    height: 50px;
    fill: white;
    display: flex;
}

/* Overlay du modal */
#chatbotModal.modal-overlay {
    font-family: "Montserrat", system-ui;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#chatbotModal.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Contenu du modal */
#chatbotModal .modal-content {
    background: white;
    border-radius: 20px;
    width: 400px;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

#chatbotModal.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Header du chatbot */
#chatbotModal .chatbot-header {
    background: #f5f2ed;
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}

#chatbotModal .close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#chatbotModal .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#chatbotModal .greeting {
    margin-bottom: 15px;
}

#chatbotModal .greeting h2 {
    font-size: 24px;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: 600;
}

#chatbotModal .greeting p {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
    margin : 0;
}

#chatbotModal .wave-emoji {
    font-size: 24px;
    display: inline-block;
    animation: wave 2s infinite;
}

@keyframes wave {
    0%, 20%, 60%, 100% {
        transform: rotate(0deg);
    }
    10%, 30% {
        transform: rotate(-10deg);
    }
    40%, 50% {
        transform: rotate(10deg);
    }
}

/* Zone de chat */
#chatbotModal .chat-area {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

/* Zone d'input */
#chatbotModal .input-area {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    background: white;
}

#chatbotModal .input-container {
    position: relative;
}

#chatbotModal .chat-input {
    width: 295px;
    padding: 15px 50px 15px 15px;
    border: 2px solid #ff6b35;
    border-radius: 25px;
    display: block;
    font-size: 14px;
    line-height: 24px;
    height: auto;
    outline: none;
    resize: none;
    font-family: inherit;
    background: white;
    color: #333;
    max-width: 360px !important;
    vertical-align: baseline;
    overflow-y: auto;
}

#chatbotModal .chat-input::placeholder {
    color: #999;
}

#chatbotModal .send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#chatbotModal .send-btn:hover {
    transform: translateY(-50%) scale(1.1);
}

#chatbotModal .send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Messages */
#chatbotModal .message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    animation: messageAppear 0.3s ease-out;
}

#chatbotModal .message p {
   margin : 3px 0;
}

#chatbotModal .message.bot {
    background: #f5f2ed;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#chatbotModal .message.user {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
#chatbotModal #loader {

    animation: spin 2s infinite linear;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

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

/* Responsive */
@media (max-width: 480px) {
    #chatbotModal .modal-content {
        width: 95%;
        margin: 10px;
    }

    #chatbotModal .chatbot-header {
        padding: 15px;
    }

    #chatbotModal.greeting h2 {
        font-size: 20px;
    }
}