/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

/* 容器样式 */
.container {
    padding: 20px;
}

/* 面板样式 */
.panel {
    border: none;
    box-shadow: 0 2px 8px rgba(155, 110, 35, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: #faf6f0;
    transition: box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 4px 12px rgba(155, 110, 35, 0.15);
}

.panel-heading {
    background-color: #9b6e23;
    color: white;
    padding: 15px 20px;
    border: none;
    position: relative;
}

.panel-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
}

/* 聊天容器样式 */
.chat-container {
    height: 350px;
    overflow-y: auto;
    padding: 20px;
    background-color: #faf6f0;
    border-radius: 4px;
    margin: 15px;
    scroll-behavior: smooth;
}

/* 消息样式 */
.message {
    margin-bottom: 20px;
    max-width: 80%;
    clear: both;
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.3s ease forwards;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    float: right;
    background-color: #9b6e23;
    color: white;
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    margin-left: 20%;
}

.ai-message {
    float: left;
    background-color: #292929;
    color: #333;
    padding: 12px 18px;
    border-radius: 18px 18px 18px 4px;
    margin-right: 20%;
    border: 1px solid #e0d6c2;
}

.error-message {
    float: none;
    background-color: #d4a373;
    color: white;
    padding: 12px 18px;
    border-radius: 18px;
    margin: 0 auto;
    text-align: center;
    clear: both;
}

/* 输入区域样式 */
.input-group {
    margin: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0d6c2;
    transition: border-color 0.3s ease;
}

.input-group:focus-within {
    border-color: #9b6e23;
}

#user-input {
    border: none;
    padding: 12px 15px;
    font-size: 14px;
    background-color: #fff;
    height: 45px;
}

#user-input:focus {
    outline: none;
}

#send-button {
    border: none;
    background-color: #9b6e23;
    color: white;
    padding: 12px 20px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

#send-button:hover {
    background-color: #8a621f;
}

/* 清除按钮样式 */
#clear-chat {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #9c7025;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#clear-chat:hover {
    background: rgb(42 42 42);
}

#clear-chat .glyphicon {
    font-size: 14px;
}

/* Markdown 样式 */
.markdown-body {
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    background-color: #ffffff00;
    color: #ffffff;
}

.markdown-body pre {
    background-color: #f5f0e6;
    border-radius: 4px;
    padding: 16px;
    overflow: auto;
    border: 1px solid #e0d6c2;
}

.markdown-body code {
    background-color: #f5f0e6;
    border-radius: 4px;
    padding: 0.2em 0.4em;
    font-size: 85%;
    color: #9b6e23;
}

.markdown-body blockquote {
    border-left: 4px solid #9b6e23;
    background-color: #f5f0e6;
    color: #333;
    padding: 12px 20px;
    margin: 0 0 16px 0;
    border-radius: 0 4px 4px 0;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    border: 1px solid #e0d6c2;
}

.markdown-body table th,
.markdown-body table td {
    padding: 8px 16px;
    border: 1px solid #e0d6c2;
}

.markdown-body table th {
    background-color: #f5f0e6;
    color: #9b6e23;
    font-weight: 500;
}

.markdown-body table tr {
    background-color: #fff;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f5f0e6;
}

/* 打字机效果 */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #9b6e23;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

/* 禁用状态样式 */
input:disabled, button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f5f0e6;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background-color: #9b6e23;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #8a621f;
}

.panel-default>.panel-heading {
    color: #faf6f0;
    background-color: #faf6f0;
    border-color: #ddd;
    height: 50px;
}

.message-content .markdown-body {
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    margin: 0;
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}