html, body {
    height: 100%;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    overflow: hidden;
}

.chat-box {
    flex: 1;
    height: 0;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 10px;
}

.chat-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.chat-item.ai {
    align-self: flex-start;
}

.chat-item.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    box-sizing: border-box;
    word-break: break-all;
    white-space: pre-line;
}

.ai .bubble {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    white-space: normal;
    max-width: 85%;
}

.user .bubble {
    background: #8769ff;
    color: #fff;
}

.input-area {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #f6f8fc;
    gap: 10px;
    box-sizing: border-box;
    border-top: 1px solid var(--border-color);
}

.question-input {
    flex: 1;
    height: 40px;
    border-radius: 20px;
    padding: 0 16px;
    background: #fff;
    font-size: 14px;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.question-input:focus {
    border-color: var(--primary);
}

.question-input::placeholder {
    color: #999;
}

.send-btn {
    width: 60px;
    height: 40px;
    background: #8769ff;
    color: #fff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.send-btn:hover { opacity: 0.9; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 表格样式 */
.ai .bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}
.ai .bubble table th,
.ai .bubble table td {
    border: 1px solid #d1d5db;
    padding: 6px 8px;
    text-align: left;
}
.ai .bubble table th {
    background: #f0f4f8;
    font-weight: 600;
    color: var(--text-primary);
}
.ai .bubble table tr:nth-child(even) {
    background: #f9fafb;
}
.ai .bubble table tr:hover {
    background: #eff6ff;
}
.ai .bubble code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}
.ai .bubble blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 10px;
    margin: 4px 0;
    color: #666;
}
.ai .bubble hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}
.ai .bubble strong {
    font-weight: 600;
}
/* 打字动画 */
.typing-dots {
    animation: dotPulse 1s infinite;
    color: #999;
}
@keyframes dotPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
