/* ============================================================
   CHATBOT BEQLER
   ============================================================ */

#chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Segoe UI', sans-serif;
}

/* Bouton contact fallback */
.chat-contact-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 9px 18px;
    background: linear-gradient(135deg, #2f4b78, #0ea5e9);
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 3px 10px rgba(47,75,120,0.3);
}
.chat-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(47,75,120,0.4);
    text-decoration: none;
}

/* Bouton flottant */
#chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f4b78, #84d1f4);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(47,75,120,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: auto;
}

#chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(47,75,120,0.5);
}

#chatbot-toggle svg {
    width: 26px;
    height: 26px;
    fill: #fff;
    transition: opacity 0.2s;
}

@keyframes robot-float {
    0%   { transform: translateY(0px) rotate(0deg); }
    25%  { transform: translateY(-4px) rotate(-3deg); }
    50%  { transform: translateY(-6px) rotate(0deg); }
    75%  { transform: translateY(-4px) rotate(3deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes robot-eyes {
    0%, 90%, 100% { opacity: 1; }
    95%            { opacity: 0.1; }
}

#chatbot-toggle .icon-chat {
    animation: robot-float 2.5s ease-in-out infinite;
}

#chatbot-toggle .icon-chat:hover {
    animation: none;
}

#chatbot-toggle .icon-close {
    display: none;
}

#chatbot-widget.open #chatbot-toggle .icon-chat {
    display: none;
}

#chatbot-widget.open #chatbot-toggle .icon-close {
    display: block;
}

/* Fenêtre du chatbot */
#chatbot-box {
    width: 340px;
    max-height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(47,75,120,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 12px;
    animation: chatSlideUp 0.25s ease;
}

#chatbot-widget.open #chatbot-box {
    display: flex;
}

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

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #2f4b78, #84d1f4);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

#chatbot-header .chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

#chatbot-header .chatbot-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

#chatbot-header .chatbot-info span {
    font-size: 11px;
    opacity: 0.85;
}

/* Zone messages */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f9fc;
}

#chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
#chatbot-messages::-webkit-scrollbar-thumb {
    background: #c5d0e0;
    border-radius: 4px;
}

.chat-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    animation: msgFade 0.2s ease;
}

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

.chat-msg.bot {
    background: #fff;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    align-self: flex-start;
}

.chat-msg.user {
    background: linear-gradient(135deg, #2f4b78, #3d6199);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Suggestions */
#chatbot-suggestions {
    padding: 8px 16px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f7f9fc;
}

.chat-suggestion {
    background: #fff;
    border: 1px solid #c5d5ee;
    color: #2f4b78;
    border-radius: 20px;
    padding: 5px 11px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.chat-suggestion:hover {
    background: #2f4b78;
    color: #fff;
    border-color: #2f4b78;
}

/* Input */
#chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e8edf5;
    background: #fff;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #d0dae8;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
}

#chatbot-input:focus {
    border-color: #2f4b78;
}

#chatbot-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #2f4b78;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#chatbot-send:hover {
    background: #84d1f4;
}

#chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Notification badge */
#chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}

#chatbot-widget:not(.open) #chatbot-badge {
    display: block;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    align-self: flex-start;
    width: 50px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    background: #84d1f4;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 400px) {
    #chatbot-box { width: calc(100vw - 32px); }
    #chatbot-widget { right: 16px; bottom: 16px; }
}
