/* CSS aggiuntivo per migliorare l'estetica dei messaggi del chatbot */

/* Contenitore messaggi migliorato */
.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message.ai-message {
    justify-content: flex-start;
}

/* Bolle dei messaggi con design moderno */
.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

/* Bolla dell'utente - stile moderno blu */
.user-bubble {
    background: linear-gradient(135deg, #0000bb, #2c5cd8);
    color: white;
    border-bottom-right-radius: 6px;
    margin-left: 40px;
    box-shadow: none !important; /* Rimuove l'ombra grigia per i messaggi utente */
}

.user-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: #2c5cd8;
    border-bottom: none;
    border-right: none;
}

/* Bolla dell'AI - stile elegante grigio */
.ai-bubble {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #333;
    border: 1px solid #e1e5f2;
    border-bottom-left-radius: 6px;
    margin-right: 40px;
}

.ai-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: #f8f9fa;
    border-bottom: none;
    border-left: none;
}

/* Contenuto del messaggio */
.message-content {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    font-weight: 400;
}

.user-bubble .message-content {
    font-weight: 500;
}

/* Ora del messaggio - design elegante */
.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.ai-bubble .message-time {
    text-align: left;
    color: #6c757d;
}

.user-bubble .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Animazione di entrata dei messaggi */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Indicatore di digitazione migliorato */
.typing-message .message-bubble {
    background: linear-gradient(135deg, #f1f3f8, #e9ecef);
    border: 1px solid #e1e5f2;
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingDots 1.4s infinite;
}

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

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

@keyframes typingDots {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Effetti hover per le bolle */
.message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

/* Responsive design per mobile */
@media (max-width: 480px) {
    .message-bubble {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .user-bubble {
        margin-left: 20px;
    }
    
    .ai-bubble {
        margin-right: 20px;
    }
    
    .message-time {
        font-size: 10px;
    }
}

/* Miglioramenti per l'accessibilità */
.message-bubble:focus {
    outline: 2px solid #0000bb;
    outline-offset: 2px;
}

/* Stili per i link nei messaggi */
.message-content a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.user-bubble .message-content a {
    color: rgba(255, 255, 255, 0.9);
}

.ai-bubble .message-content a {
    color: #0000bb;
}
