/* === DÉBUT DU WIDGET CHAT FLOTTANT === */

/* Bouton flottant d'activation */
.kodee-chat-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    font-size: 24px;
}

.kodee-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.kodee-chat-trigger.active {
    background: #666;
}

/* Notification badge */
.kodee-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Bannière "Nouveau produit" */
.kodee-new-product-banner {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9997;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.kodee-new-product-banner.show {
    opacity: 1;
    transform: translateY(0);
}

.kodee-banner-close {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.kodee-banner-close:hover {
    opacity: 1;
}

/* Container principal du chat */
.kodee-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kodee-chat-container.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* En-tête du chat */
.kodee-chat-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kodee-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kodee-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.kodee-beta-badge {
    background: #e5e5e5;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.kodee-header-icons {
    display: flex;
    gap: 8px;
}

.kodee-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.2s;
}

.kodee-icon-btn:hover {
    background: #f0f0f0;
}

/* Zone des messages */
.kodee-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.kodee-message {
    margin-bottom: 16px;
}

.kodee-bot-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.kodee-bot-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.kodee-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    max-width: 85%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    line-height: 1.4;
    color: #333;
    font-size: 14px;
}

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

.kodee-user-message-content {
    background: #f0f0f0;
    padding: 12px 16px;
    border-radius: 12px;
    border-top-right-radius: 4px;
    max-width: 70%;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.kodee-user-avatar {
    width: 20px;
    height: 20px;
    background: #ccc;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Zone de saisie */
.kodee-chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
}

.kodee-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    padding: 8px 16px;
}

.kodee-chat-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 8px 0;
    font-size: 14px;
    color: #333;
}

.kodee-chat-input::placeholder {
    color: #999;
}

.kodee-send-btn {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    transition: transform 0.2s;
}

.kodee-send-btn:hover {
    transform: scale(1.1);
}

.kodee-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .kodee-chat-container {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        max-width: none;
        max-height: none;
    }

    .kodee-chat-container.open {
        transform: translateY(0);
    }

    .kodee-chat-trigger {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .kodee-chat-messages {
        padding: 15px;
    }

    .kodee-chat-input-container {
        padding: 15px;
    }

    .kodee-chat-header {
        padding: 15px 20px;
    }

    .kodee-new-product-banner {
        bottom: 90px;
        right: 15px;
        left: 15px;
        max-width: none;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .kodee-chat-container {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        max-width: none;
        max-height: none;
    }

    .kodee-chat-container.open {
        transform: translateY(0);
    }

    .kodee-chat-trigger {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .kodee-chat-messages {
        padding: 12px;
    }

    .kodee-chat-input-container {
        padding: 12px;
    }

    .kodee-chat-header {
        padding: 12px 15px;
    }

    .kodee-message-content {
        max-width: 90%;
        font-size: 13px;
    }

    .kodee-user-message-content {
        max-width: 85%;
        font-size: 13px;
    }

    .kodee-new-product-banner {
        bottom: 80px;
        right: 10px;
        left: 10px;
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* Formatage du texte pour les réponses Gemini */
.formatted-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.formatted-text strong {
    font-weight: bold;
}

.formatted-text u {
    text-decoration: underline;
}

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

/* Indicateur de chargement */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour les avatars personnalisés */
.kodee-title-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 2px solid #667eea;
}

.kodee-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #667eea;
}

/* === FIN DU WIDGET CHAT FLOTTANT === */
