/* ==================== 聊天样式 ==================== */

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.message.expert { align-self: flex-start; }
.message.patient { align-self: flex-end; flex-direction: row-reverse; }
.message.system { align-self: center; max-width: 90%; }

.expert-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.6;
    font-size: 14px;
    word-break: break-word;
}

.message.expert .message-bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--expert-surgery);
}

.message.patient .message-bubble {
    background: var(--primary);
    color: white;
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.message.system .message-bubble {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 13px;
    text-align: center;
    padding: 8px 16px;
}

.expert-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

/* 专家配色 */
.expert-oral_surgery .message-bubble { border-left-color: var(--expert-surgery); }
.expert-orthodontics .message-bubble { border-left-color: var(--expert-ortho); }
.expert-rehabilitation .message-bubble { border-left-color: var(--expert-rehab); }
.expert-psychology .message-bubble { border-left-color: var(--expert-psych); }

/* Markdown in bubbles */
.message-bubble h3 { font-size: 15px; margin: 8px 0 4px; }
.message-bubble strong { font-weight: 600; }
.message-bubble ul, .message-bubble ol { padding-left: 20px; margin: 4px 0; }
.message-bubble li { margin: 2px 0; }
.message-bubble hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.message-bubble code { background: #f1f5f9; padding: 2px 4px; border-radius: 3px; font-size: 13px; }

/* Streaming cursor */
.streaming-cursor::after {
    content: '|';
    animation: blink 0.8s infinite;
    color: var(--primary);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input area */
.input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    line-height: 1.5;
}

.chat-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.chat-input:disabled {
    background: var(--bg);
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

.voice-input-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.voice-input-btn:hover { border-color: var(--primary); }
.voice-input-btn.recording { border-color: var(--danger); color: var(--danger); }
