/* 聊天界面样式 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    min-height: 0;
    height: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-status {
    font-size: 11px;
    color: var(--success-color);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 80%;
    animation: messageIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.message.user .message-sender {
    text-align: right;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.message:not(.user) .message-bubble {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
}

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

/* 消息回复引用 */
.message-reply {
    background: rgba(255, 255, 255, 0.2);
    border-left: 3px solid rgba(255, 255, 255, 0.5);
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.message.user .message-reply {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.reply-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.reply-sender {
    font-weight: 600;
    flex-shrink: 0;
}

.reply-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.btn-reply {
    position: absolute;
    top: -8px;
    right: -8px;
    padding: 2px 8px;
    background: #e5e7eb;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.message-bubble:hover .btn-reply {
    opacity: 1;
}

.btn-reply:hover {
    background: var(--primary-color);
    color: white;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message.user .message-time {
    text-align: right;
}

/* 消息中的卡片 */
.message-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

/* 系统消息 */
.system-message {
    text-align: center;
    padding: 8px 16px;
    background: #f3f4f6;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    align-self: center;
}

/* 预设问题 */
.quick-questions {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.quick-question-btn {
    padding: 6px 14px;
    background: #f3f4f6;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-question-btn:hover {
    background: #eef2ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 消息表单 */
.message-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-options {
    display: flex;
    gap: 16px;
}

.form-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-option label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.form-option select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    min-width: 140px;
}

.form-option select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 输入容器 */
.input-container {
    position: relative;
}

/* 回复预览 */
.reply-preview {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 10px;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reply-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.reply-icon {
    font-size: 14px;
}

.reply-to {
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
}

.reply-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.reply-close:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

.input-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f9fafb;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
}

.suggestion-item:hover {
    background: #eef2ff;
    color: var(--primary-color);
}

.suggestion-item .icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* 输入区域 */
.chat-input-area {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 38px;
    max-height: 100px;
    transition: all 0.2s;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}

.btn-send {
    padding: 10px 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-send:hover {
    background: var(--primary-hover);
}

.btn-send:active {
    transform: scale(0.98);
}

/* 正在输入指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: fit-content;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

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

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

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

.typing-text {
    font-size: 13px;
    color: var(--text-secondary);
}

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

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 群聊消息样式 */
.message.group-message {
    max-width: 70%;
}

.message.group-message .message-sender {
    display: flex;
    align-items: center;
    gap: 6px;
}

.message.group-message .sender-role {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e5e7eb;
    color: var(--text-secondary);
}
