/**
 * Styles CSS pour le module de chat
 * Intégration avec le design existant du projet
 */

/* Container principal du chat */
.chat-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 51, 102, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 51, 102, 0.1);
}

/* Header du chat */
.chat-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 50%, var(--accent-orange) 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.chat-graph-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Zone de mode de requête */
.chat-mode-selector {
    background: #f8f9fa;
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-mode-buttons {
    display: flex;
    gap: 0.25rem;
}

.chat-mode-button {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #e0e0e0;
    color: #666;
}

.chat-mode-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-mode-button.active-auto {
    background: #ffc107;
    color: white;
}

.chat-mode-button.active-local {
    background: #2196f3;
    color: white;
}

.chat-mode-button.active-global {
    background: #ff5722;
    color: white;
}

.chat-mode-button.active-hybrid {
    background: #4caf50;
    color: white;
}

/* Zone des messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
}

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

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

/* Messages individuels */
.chat-message {
    display: flex;
    gap: 0.5rem;
    animation: fadeInUp 0.3s ease;
}

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

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

.chat-message.assistant {
    justify-content: flex-start;
}

.chat-message.system {
    justify-content: center;
}

.chat-message-content {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
}

.chat-message.user .chat-message-content {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message.system .chat-message-content {
    background: #fff3cd;
    color: #856404;
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem 0.75rem;
}

.chat-message.error .chat-message-content {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Références dans les messages */
.chat-references {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.chat-reference {
    background: rgba(0,0,0,0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.chat-reference-source {
    font-weight: 600;
    color: var(--primary-blue);
}

/* Timestamp et actions */
.chat-message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: #999;
}

.chat-message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-message-content:hover .chat-message-actions {
    opacity: 1;
}

/* Indicateur de frappe */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    color: #666;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Zone de saisie */
.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 163, 0.1);
}

.chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.chat-send-button {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.chat-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-clear-button {
    padding: 0.75rem;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-clear-button:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* Bouton flottant */
.chat-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
}

.chat-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 51, 102, 0.4);
}

.chat-floating-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-orange);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

/* État minimisé */
.chat-container.minimized {
    height: 60px;
}

.chat-container.minimized .chat-messages,
.chat-container.minimized .chat-mode-selector,
.chat-container.minimized .chat-input-container {
    display: none;
}

/* Responsive */
@media (max-width: 640px) {
    .chat-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 70px;
        height: 70vh;
    }
    
    .chat-floating-button {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
    }
}

/* Animations supplémentaires */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

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

/* Styles additionnels pour le chat si nécessaire */
.chat-container {
    transition: all 0.3s ease;
}