/* Ẩn thanh cuộn cho đẹp nhưng vẫn cho phép cuộn */
#chat-messages {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#chat-messages::-webkit-scrollbar {
    display: none;
}

/* Định dạng chung cho Bong bóng chat */
.message {
    padding: 1rem;
    max-width: 85%;
    border-radius: 1.25rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    width: fit-content;
    word-break: break-word;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .message {
        max-width: 70%;
    }
}

/* Tin nhắn của User (Màu xanh, vát nhọn góc trên bên phải) */
.message.user {
    background-color: #faa916;
    color: #1b1b1e;
    align-self: flex-end;
    margin-left: auto;
    border-top-right-radius: 0.25rem;
}

/* Tin nhắn của Bot (Màu xám nhạt, vát nhọn góc trên bên trái) */
.message.bot {
    background-color: #fbfffe;
    color: #1b1b1e;
    align-self: flex-start;
    margin-right: auto;
    border-top-left-radius: 0.25rem;
    border: 1px solid #6d676e;
}

/* --- ĐỊNH DẠNG CHO MARKDOWN (BOT TRẢ LỜI) --- */
.message.bot p {
    margin-bottom: 0.5rem;
}
.message.bot p:last-child {
    margin-bottom: 0;
}
.message.bot h1,
.message.bot h2,
.message.bot h3,
.message.bot h4,
.message.bot h5 {
    font-weight: bold;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}
.message.bot ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}
.message.bot ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}
.message.bot pre {
    background-color: #2d2d2d;
    color: #ccc;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}
.message.bot code {
    background-color: #e5e7eb;
    color: #ef4444;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    font-family: monospace;
}
.message.bot pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Hiệu ứng trượt lên khi có tin nhắn mới */
.new-message {
    animation: fadeInSlideUp 0.3s ease-out;
}
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
