* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.chat-container {
    width: 100%;
    max-width: 600px;
    height: 80vh;
    background: white;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: #007bff;
    color: white;
    padding: 15px;
    text-align: center;
}

header h1 {
    font-size: 1.2rem;
}

.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

.bubble {
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Markdown 容器特定样式 */
.markdown-body {
    background: transparent !important;
    font-size: 0.95rem !important;
    color: inherit !important;
}

.message.user .bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .bubble {
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
    max-width: 100%; /* 让 Markdown 内容有更多空间 */
}

.input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
}

#user-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 0.95rem;
}

#user-input:focus {
    border-color: #007bff;
}

#send-btn {
    margin-left: 10px;
    padding: 0 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

#send-btn:hover {
    background: #0056b3;
}

#send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading dots animation */
.loading::after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
