/* Chatbot Styles */
.chat-message {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #9CA3AF;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Custom scrollbar */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

/* Floating Chatbot Button */
.chatbot-float-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 3px solid #ffffff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-float-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.chatbot-float-button svg {
    width: 30px;
    height: 30px;
    color: white;
    display: none; /* Cacher le SVG par défaut */
}

/* Robot head container */
.robot-head {
    position: relative;
    width: 30px;
    height: 30px;
}

/* Robot face */
.robot-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Robot eyes container */
.robot-eyes {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

/* Robot eyes */
.robot-eye {
    width: 6px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

/* Eye animation - blinking */
.robot-eye::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: #ffffff;
    transform: translateY(-100%);
    animation: blink 4s infinite;
}

.robot-eye.left::before {
    animation-delay: 0s;
}

.robot-eye.right::before {
    animation-delay: 0.1s;
}

/* Blinking animation */
@keyframes blink {
    0%, 90%, 100% {
        transform: translateY(-100%);
    }
    95% {
        transform: translateY(0%);
    }
}

/* Robot mouth */
.robot-mouth {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 2px;
    background: #333;
    border-radius: 1px;
}

/* Robot antenna */
.robot-antenna {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: #ffffff;
    border-radius: 1px;
}

.robot-antenna::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    animation: glow 2s infinite;
}

/* Antenna glow animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 1);
    }
}

/* Chat Popup Window */
.chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chat-popup.active {
    display: flex;
}

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

/* Chat Popup Header */
.chat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.chat-popup-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-popup-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-popup-header-avatar svg {
    width: 24px;
    height: 24px;
    color: white;
}

.chat-popup-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-popup-header-text .status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-popup-header-actions {
    display: flex !important;
    gap: 8px !important;
}

.chat-popup-close,
.chat-popup-maximize {
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px !important;
    min-height: 36px !important;
}

.chat-popup-close:hover,
.chat-popup-maximize:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.05) !important;
}

.chat-popup-close svg,
.chat-popup-maximize svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

/* Fullscreen mode */
.chat-popup.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 9999;
}

.chat-popup.fullscreen .chat-popup-header {
    border-radius: 0;
}

.chat-popup.fullscreen .chat-popup-messages {
    height: calc(100vh - 140px);
}

.chat-popup.fullscreen .chat-popup-input {
    border-radius: 0;
}

.chat-popup.fullscreen .chat-popup-maximize svg {
    transform: rotate(180deg);
}

/* Chat Popup Messages */
.chat-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    font-size: 0.875rem;
}

.chat-popup-messages .chat-message {
    margin-bottom: 12px;
}

/* Message container layout */
.chat-popup-messages .message-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-popup-messages .message-container.user-container {
    justify-content: flex-end;
}

.chat-popup-messages .message-container.bot-container {
    justify-content: flex-start;
}

/* Message content */
.chat-popup-messages .message-content {
    max-width: 70%;
}

/* Message bubble styles for popup */
.chat-popup-messages .user-message .bg-indigo-600 {
    background: #4f46e5 !important;
    color: white !important;
    padding: 10px 14px !important;
    border-radius: 16px !important;
    border-bottom-right-radius: 4px !important;
    word-wrap: break-word !important;
    display: inline-block !important;
    font-size: 0.875rem;
}

.chat-popup-messages .bot-message .bg-gray-100 {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
    padding: 10px 14px !important;
    border-radius: 16px !important;
    border-bottom-left-radius: 4px !important;
    word-wrap: break-word !important;
    display: inline-block !important;
    font-size: 0.875rem;
}

/* Formatted content styles */
.chat-popup-messages .bg-gray-100 p {
    margin: 8px 0 !important;
    line-height: 1.4 !important;
}

.chat-popup-messages .bg-gray-100 strong {
    font-weight: 600 !important;
    color: #1f2937 !important;
}

.chat-popup-messages .bg-gray-100 em {
    font-style: italic !important;
    color: #4b5563 !important;
}

.chat-popup-messages .bg-gray-100 ul {
    margin: 8px 0 !important;
    padding-left: 20px !important;
    list-style-type: disc !important;
}

.chat-popup-messages .bg-gray-100 ol {
    margin: 8px 0 !important;
    padding-left: 20px !important;
    list-style-type: decimal !important;
}

.chat-popup-messages .bg-gray-100 li {
    margin: 4px 0 !important;
    line-height: 1.4 !important;
}

.chat-popup-messages .bg-gray-100 li strong {
    color: #4f46e5 !important;
}

.chat-popup-messages .bg-gray-100 a {
    color: #4f46e5 !important;
    text-decoration: underline !important;
    word-break: break-word !important;
}

.chat-popup-messages .bg-gray-100 a:hover {
    color: #3730a3 !important;
}

/* Avatar styles */
.chat-popup-messages .avatar {
    flex-shrink: 0;
    padding-top: 4px;
}

.chat-popup-messages .avatar-container {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-popup-messages .user-avatar .avatar-container {
    background: #4f46e5;
}

.chat-popup-messages .bot-avatar .avatar-container {
    background: #e0e7ff;
}

.chat-popup-messages .avatar svg {
    width: 20px;
    height: 20px;
}

.chat-popup-messages .user-avatar svg {
    color: white;
}

.chat-popup-messages .bot-avatar svg {
    color: #4f46e5;
}

/* Timestamp styles */
.chat-popup-messages .timestamp {
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

.chat-popup-messages .user-timestamp {
    color: #a5b4fc;
    text-align: right;
}

.chat-popup-messages .bot-timestamp {
    color: #6b7280;
}

/* Chat Popup Input */
.chat-popup-input {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-popup-form {
    display: flex;
    gap: 8px;
}

.chat-popup-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-popup-input input:focus {
    border-color: #4f46e5;
}

.chat-popup-input button {
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-popup-input button:hover {
    background: #4338ca;
}

.chat-popup-input button svg {
    width: 18px;
    height: 18px;
}

.chat-popup-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #6b7280;
    margin-top: 8px;
}

/* Welcome bubble */
.welcome-bubble {
    position: fixed;
    bottom: 90px;
    right: 90px;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 16px;
    z-index: 998;
    animation: slideInRight 0.5s ease-out;
    border: 2px solid #f3f4f6;
    max-width: 300px;
}

.welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: 20px;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.welcome-bubble h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 6px;
}

.welcome-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
}

.welcome-bubble .close-welcome {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s;
}

.welcome-bubble .close-welcome:hover {
    background: #e5e7eb;
    color: #374151;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .welcome-bubble {
        bottom: 80px;
        right: 70px;
        width: 240px;
        max-width: 260px;
    }
    
    .chat-popup {
        width: calc(100vw - 40px);
        height: 60vh;
        right: 20px;
        bottom: 90px;
    }
    
    .chatbot-float-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-float-button svg {
        width: 25px;
        height: 25px;
    }
}