/* COMMTENUE Chatbot Styles */

:root {
    --chatbot-primary: #6366f1;
    --chatbot-accent: #8b5cf6;
    --chatbot-bg: #ffffff;
    --chatbot-border: #e5e7eb;
    --chatbot-text: #1f2937;
    --chatbot-text-light: #6b7280;
    --chatbot-message-bg: #f3f4f6;
    --chatbot-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --chatbot-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
}

/* Bouton d'ouverture du chat */
.commtenue-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-accent));
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: glow 2s ease-in-out infinite;
}

.commtenue-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.4);
}

.commtenue-chat-toggle svg {
    width: 28px;
    height: 28px;
    stroke: white;
    fill: none;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 15px 35px rgba(99, 102, 241, 0.5);
    }
}

/* Fenêtre de chat */
.commtenue-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 384px;
    max-width: calc(100vw - 48px);
    height: 500px;
    animation: slideIn 0.3s ease-out;
}

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

.commtenue-chat-card {
    height: 100%;
    background: var(--chatbot-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chatbot-border);
}

/* En-tête */
.commtenue-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--chatbot-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
}

.commtenue-chat-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.commtenue-chat-header-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.commtenue-bot-icon {
    color: var(--chatbot-primary);
}

.commtenue-chat-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--chatbot-text);
}

.commtenue-chat-clear,
.commtenue-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    color: var(--chatbot-text);
}

.commtenue-chat-clear svg,
.commtenue-chat-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.commtenue-chat-clear:hover,
.commtenue-chat-close:hover {
    background-color: var(--chatbot-message-bg);
}

.commtenue-chat-clear:hover {
    color: #dc2626;
}

/* Corps du chat */
.commtenue-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Zone des messages */
.commtenue-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.commtenue-chat-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-border);
    border-radius: 3px;
}

.commtenue-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-text-light);
}

/* Messages */
.commtenue-message {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

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

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

.commtenue-message-content {
    max-width: 80%;
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    transition: all 0.3s ease;
}

.commtenue-message.bot .commtenue-message-content {
    background-color: var(--chatbot-message-bg);
    color: var(--chatbot-text-light);
}

.commtenue-message.user .commtenue-message-content {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-accent));
    color: white;
}

.commtenue-message-content.highlight {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.3);
    }
}

.commtenue-message-inner {
    display: flex;
    align-items: start;
    gap: 8px;
}

.commtenue-message-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.commtenue-message-text {
    font-size: 14px;
    line-height: 1.5;
}

.commtenue-message-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--chatbot-primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.commtenue-message-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.commtenue-message-link svg {
    width: 12px;
    height: 12px;
}

/* Actions rapides */
.commtenue-quick-actions {
    padding: 16px;
    border-top: 1px solid var(--chatbot-border);
}

.commtenue-quick-actions-label {
    font-size: 12px;
    color: var(--chatbot-text-light);
    margin-bottom: 8px;
}

.commtenue-quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.commtenue-quick-action {
    padding: 8px 12px;
    font-size: 12px;
    border: 1px solid var(--chatbot-border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--chatbot-text);
}

.commtenue-quick-action:hover {
    background: var(--chatbot-message-bg);
    border-color: var(--chatbot-primary);
    color: var(--chatbot-primary);
}

/* Zone de saisie */
.commtenue-chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--chatbot-border);
    display: flex;
    gap: 8px;
}

.commtenue-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: white;
    color: var(--chatbot-text);
}

.commtenue-chat-input::placeholder {
    color: var(--chatbot-text-light);
}

.commtenue-chat-input:focus {
    border-color: var(--chatbot-primary);
}

.commtenue-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-accent));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.commtenue-chat-send svg {
    width: 20px;
    height: 20px;
}

.commtenue-chat-send:hover {
    transform: scale(1.05);
}

.commtenue-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 640px) {
    .commtenue-chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
    }
    
    .commtenue-chat-toggle {
        right: 16px;
        bottom: 16px;
    }
}
