/* Chatbot IA FAQ - Styles CSS */

/* Conteneur principal du chatbot */
#faq-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* Bouton flottant du chatbot */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.6);
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    transform: scale(0.95);
}

.chatbot-icon {
    color: white;
    font-size: 24px;
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-icon img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Animation de pulsation */
.chatbot-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    animation: chatbotPulse 2s ease-in-out infinite;
}

@keyframes chatbotPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Popup du chatbot */
.chatbot-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-popup.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.chatbot-popup.hidden {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
}

/* Mode sombre */
.dark .chatbot-popup {
    background: #1f2937;
    color: #f9fafb;
}

/* En-tête du chatbot */
.chatbot-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chatbot-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.dark .chatbot-messages {
    background: #111827;
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 16px;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message.user .message-content {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.bot .message-content {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
}

.dark .message.bot .message-content {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

.message-text {
    line-height: 1.5;
    word-wrap: break-word;
}

.message-text p {
    margin: 0 0 8px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    font-weight: 600;
    color: inherit;
}

.message-text em {
    font-style: italic;
}

.message-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* Indicateur de frappe */
.message.typing .message-content {
    background: white;
    border: 1px solid #e5e7eb;
}

.dark .message.typing .message-content {
    background: #374151;
    border-color: #4b5563;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Questions rapides */
.chatbot-quick-questions {
    padding: 16px 20px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.quick-question {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .quick-question {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.quick-question:hover {
    background: #e5e7eb;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.dark .quick-question:hover {
    background: #4b5563;
    border-color: #6366f1;
}

/* Zone de saisie */
.chatbot-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.dark .chatbot-input-container {
    background: #1f2937;
    border-top-color: #374151;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f9fafb;
}

.dark #chatbot-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

#chatbot-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#chatbot-input::placeholder {
    color: #9ca3af;
}

.dark #chatbot-input::placeholder {
    color: #6b7280;
}

#chatbot-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#chatbot-send:active {
    transform: scale(0.95);
}

/* Scrollbar personnalisée */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dark .chatbot-messages::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark .chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-popup {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .chatbot-quick-questions {
        grid-template-columns: 1fr;
    }
    
    .quick-question {
        font-size: 14px;
        padding: 12px;
    }
}

/* Animation d'apparition */
@keyframes chatbotSlideIn {
    from {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.chatbot-popup.show {
    animation: chatbotSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* États de chargement */
.chatbot-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Accessibilité */
.chatbot-toggle:focus,
.chatbot-close:focus,
.quick-question:focus,
#chatbot-input:focus,
#chatbot-send:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Animations de micro-interactions */
.message.user .message-content {
    animation: messageSlideInRight 0.3s ease-out;
}

.message.bot .message-content {
    animation: messageSlideInLeft 0.3s ease-out;
}

@keyframes messageSlideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes messageSlideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
