/* ==========================================
   CHAT EN LIGNE - EPROGCONSULTING
   Système de chat automatisé intelligent
   ========================================== */

/* Widget principal */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

/* Bulle de chat */
.chat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
}

.chat-bubble i {
    color: white;
    font-size: 24px;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(59, 130, 246, 0.5); }
    100% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3); }
}

/* Fenêtre de chat */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Mode sombre pour la fenêtre */
[data-theme="dark"] .chat-window {
    background: #1e293b;
    border-color: #334155;
}

/* En-tête du chat */
.chat-header {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    flex: 1;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Bouton fermeture */
.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Zone des messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

[data-theme="dark"] .chat-messages {
    background: #1e293b;
}

/* Messages individuels */
.chat-message {
    display: flex;
    gap: 8px;
}

.chat-message.user {
    flex-direction: row-reverse;
}

/* Avatars */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Bulles de message */
.chat-bubble-msg {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-message:not(.user) .chat-bubble-msg {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 6px;
}

.chat-message.user .chat-bubble-msg {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
    border-bottom-right-radius: 6px;
}

[data-theme="dark"] .chat-message:not(.user) .chat-bubble-msg {
    background: #334155;
    color: #f1f5f9;
}

/* Zone de saisie */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

[data-theme="dark"] .chat-input-area {
    border-top-color: #334155;
    background: #1e293b;
}

/* Champ de saisie */
.chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #3b82f6;
}

[data-theme="dark"] .chat-input {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .chat-input:focus {
    border-color: #3b82f6;
}

/* Bouton d'envoi */
.chat-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send:hover {
    transform: scale(1.05);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 70%;
}

[data-theme="dark"] .typing-indicator {
    background: #334155;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.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); opacity: 0.5; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Actions rapides */
.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px 0;
}

.quick-action-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
}

.quick-action-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

[data-theme="dark"] .quick-action-btn {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .quick-action-btn:hover {
    background: #475569;
    border-color: #64748b;
}

/* Badge de notification */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Responsive mobile */
@media (max-width: 640px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 20px;
    }
}
