/* Chat flottant - Styles cohérents avec globale.css */

.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 3;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Bouton flottant */
.btn-chat {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease-in-out;
}

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

.picto-chat {
    background-color: white;
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease-in-out;
    position: relative;
}

#icon-open {
    width:50px;height:50px
}


.picto-chat:hover {
    background-color: var(--color-primary-very-light);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.question-chat {
    font-size: 0.875rem;
    font-weight: 500;
    background-color: white;
    color: #374151;
    padding: 8px 12px;
    border-radius: 20px;
    margin-top: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out;
}

/* Badge de notification */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc2626;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.2s ease-in-out;
}

.chat-badge.show {
    transform: scale(1);
}

/* Container du chat */
.chat-container {
    position: absolute;
    bottom: 105px;
    right: 0;
    width: 350px;
    height: 450px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 450px) {

    .picto-chat {
        width: 50px;
        height: 50px;
        opacity: 0.9;
    }


    #icon-open {
        width:40px;height:40px
    }

}


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

/* Header du chat */
.chat-header {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease-in-out;
}

.chat-close:hover {
    opacity: 1;
}

/* Zone des messages */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--color-primary-very-light);
}

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

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

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

/* Messages */
.message {
    display: flex;
    /*margin-bottom: 8px;*/
    animation: fadeInUp 0.3s ease-out;
}

.message.visitor {
    justify-content: flex-end;
}

.message.seller {
    justify-content: flex-start;
    background-color: var(--color-primary-very-light);
}

.message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.875rem;
    line-height: 1.4;
    position: relative;
}

.message.visitor .message-bubble {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    border-bottom-right-radius: 4px;
}

.message.seller .message-bubble {
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.message.seller .message-time {
    text-align: left;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 75%;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
}

.typing-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

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

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.5s infinite ease-in-out;
}

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

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

/* Zone de saisie */
.chat-input-container {
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: relative;
}


.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    transition: border-color 0.2s ease-in-out;
    resize: none;
    overflow: hidden;
}

.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.chat-send {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    flex-shrink: 0;
}

.chat-send:hover {
    background-color: var(--color-primary);
    transform: scale(1.05);
}

.chat-send:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Message de bienvenue */
.welcome-message {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

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

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

.email-notification-notice {
    background-color: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: #0c5460;
    font-size: 13px;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
    position: absolute;
    width: 99%;
    top: 10px;
    left: 0.5%;
}

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

/* Styles pour les traductions */
.message-content {
    /* Style pour le message principal */
}

.message-translation {
    font-style: italic;
    opacity: 0.8;
    font-size: 0.8em;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    color: #6b7280;
}

.message-translation span {
    font-style: normal;
}

.message.seller .message-translation {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.message.visitor .message-translation {
    border-top-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}


.system-message {
    font-size: 13px;
    color: var(--color-secondary);
}

/* Responsive */
@media (max-width: 480px) {
    .chat-container {
        position: fixed;
        width: calc(100vw - 40px);
        height: 78vh;
        right: 20px;
        top: 11vh;
    }

    .question-chat {
        display: none;
    }
    
    .message-translation {
        font-size: 0.75em;
        margin-top: 4px;
        padding-top: 4px;
    }
}