.chat-demo {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: left;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    padding: 30px;
    min-height: 400px;
}

.message {
    margin-bottom: 20px;
    opacity: 0;
    animation: slideInMessage 0.8s ease forwards;
}

.message:nth-child(1) {
    animation-delay: 0.5s;
}

.message:nth-child(2) {
    animation-delay: 1.5s;
}

.message:nth-child(3) {
    animation-delay: 4.5s;
}

.message:nth-child(4) {
    animation-delay: 7s;
}

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

.message.user {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    padding: 15px 20px;
    border-radius: 12px;
    max-width: 80%;
    animation: bubblePop 0.4s ease forwards;
    transform-origin: bottom;
}

.message.user .message-bubble {
    background: #667eea;
    color: white;
    animation-delay: 0.1s;
}

.message.agent .message-bubble {
    background: #f3f4f6;
    color: #1a1a1a;
    animation-delay: 0.1s;
}

@keyframes bubblePop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.message-label {
    font-size: 12px;
    margin-bottom: 5px;
    color: #6b7280;
    font-weight: 600;
    opacity: 0;
    animation: fadeInLabel 0.4s ease forwards;
}

.message:nth-child(1) .message-label {
    animation-delay: 0.6s;
}

.message:nth-child(2) .message-label {
    animation-delay: 1.6s;
}

.message:nth-child(3) .message-label {
    animation-delay: 4.6s;
}

.message:nth-child(4) .message-label {
    animation-delay: 7.1s;
}

@keyframes fadeInLabel {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typing indicator animation (optional - can be added to HTML) */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Thinking message styles */
.message.thinking .message-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}

.message.thinking {
    opacity: 0;
    animation: slideInMessage 0.8s 3s ease forwards, fadeOutThinking 0.5s ease forwards 6.5s;
    overflow: hidden;
}

.thinking-text {
    color: #6b7280;
    font-style: italic;
    font-size: 14px;
}

@keyframes fadeOutThinking {
    0% {
        opacity: 1;
        max-height: 100px;
        margin-bottom: 20px;
    }
    100% {
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        transform: translateY(-10px);
        overflow: hidden;
    }
}

