/* CHATBOT BUBBLE - SOLAN */

/* Conteneur principal de la bulle */
.chatbot-bubble-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Bulle fermée (bouton) */
.chatbot-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #910af3 0%, #7404c6 100%);
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: bubble-entrance 0.5s ease;
}

.chatbot-bubble:hover {
    transform: translateY(-4px);
}

.chatbot-bubble-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.chatbot-bubble-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

/* Fenêtre de chat ouverte */
.chatbot-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 480px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: #1f2937;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: window-entrance 0.3s ease;
    z-index: 9999;
}

.chatbot-window.active {
    display: flex;
}

/* En-tête du chat */
.chatbot-header {
    background: linear-gradient(135deg, #910af3 0%, #7404c6 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-header-text h3 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chatbot-header-text p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 2px 0 0 0;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Zone de messages */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #111827;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(109, 40, 217, 0.4);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 40, 217, 0.6);
}

/* Message individuel */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: message-entrance 0.3s ease;
}

.chatbot-message.user {
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message.bot .chatbot-message-content {
    background: #1f2937;
    color: #f8fafc;
    border: 1px #4b5563;
}

.chatbot-message.user .chatbot-message-content {
    background: linear-gradient(135deg, #910af3 0%, #7404c6 100%);
    color: white;
}

/* Message de bienvenue */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
}

.chatbot-welcome h4 {
    color: #f8fafc;
    font-size: 18px;
    margin-bottom: 8px;
}

.chatbot-welcome p {
    font-size: 14px;
    margin: 0;
}

/* Indicateur de frappe */
.chatbot-typing {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-typing-indicator {
    background: #1f2937;
    border: 1px solid rgba(109, 40, 217, 0.3);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6d28d9;
    animation: typing-bounce 1.4s infinite;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Zone de saisie */
.chatbot-input-container {
    padding: 16px 20px;
    background: #1f2937;
    border-top: 1px solid #4b5563;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 24px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus,
.chatbot-input:focus-visible {
    outline: none;
    outline-offset: 0;
}

.chatbot-input::placeholder {
    color: #6b7280;
}

.chatbot-send {
    background: linear-gradient(135deg, #910af3 0%, #7404c6 100%);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #08c803 0%, #077c04 100%);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes bubble-entrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes window-entrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes message-entrance {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Markdown Styling */
.chatbot-message.bot .chatbot-message-content h1,
.chatbot-message.bot .chatbot-message-content h2,
.chatbot-message.bot .chatbot-message-content h3,
.chatbot-message.bot .chatbot-message-content h4,
.chatbot-message.bot .chatbot-message-content h5,
.chatbot-message.bot .chatbot-message-content h6 {
    margin: 12px 0 8px 0;
    color: #6d28d9;
    font-weight: 600;
}

.chatbot-message.bot .chatbot-message-content h1 {
    font-size: 18px;
}

.chatbot-message.bot .chatbot-message-content h2 {
    font-size: 16px;
}

.chatbot-message.bot .chatbot-message-content h3 {
    font-size: 15px;
}

.chatbot-message.bot .chatbot-message-content h4,
.chatbot-message.bot .chatbot-message-content h5,
.chatbot-message.bot .chatbot-message-content h6 {
    font-size: 14px;
}

.chatbot-message.bot .chatbot-message-content p {
    margin: 8px 0;
}

.chatbot-message.bot .chatbot-message-content ul,
.chatbot-message.bot .chatbot-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message.bot .chatbot-message-content li {
    margin: 4px 0;
}

.chatbot-message.bot .chatbot-message-content code {
    background: rgba(109, 40, 217, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #a8d8f2;
}

.chatbot-message.bot .chatbot-message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid rgba(109, 40, 217, 0.2);
}

.chatbot-message.bot .chatbot-message-content pre code {
    background: none;
    padding: 0;
    color: #e8f4f8;
    font-size: 12px;
}

.chatbot-message.bot .chatbot-message-content a {
    color: #6d28d9;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.chatbot-message.bot .chatbot-message-content a:hover {
    color: #a78bfa;
}

.chatbot-message.bot .chatbot-message-content strong {
    color: #f3e8ff;
    font-weight: 700;
}

.chatbot-message.bot .chatbot-message-content em {
    color: #c4b5fd;
    font-style: italic;
}

.chatbot-message.bot .chatbot-message-content blockquote {
    border-left: 3px solid #6d28d9;
    padding-left: 12px;
    margin: 8px 0;
    color: #d1d5db;
    font-style: italic;
}

.chatbot-message.bot .chatbot-message-content hr {
    border: none;
    border-top: 1px solid rgba(109, 40, 217, 0.3);
    margin: 12px 0;
}

/* Responsive */
/* Écrans petits à moyens (moins de 520px de largeur disponible) */
@media (max-width: 550px) {
    .chatbot-bubble-container {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-window {
        bottom: 16px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
    }

    .chatbot-bubble-text {
        display: none;
    }

    .chatbot-bubble {
        padding: 12px;
        border-radius: 50%;
    }
}

/* Écrans moyens (550px à 768px) */
@media (min-width: 551px) and (max-width: 768px) {
    .chatbot-bubble-container {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-window {
        bottom: 16px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
    }

    .chatbot-bubble-text {
        display: none;
    }

    .chatbot-bubble {
        padding: 12px;
        border-radius: 50%;
    }
}
