/* 组件样式 */

/* 按钮基础样式 */
.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* 主按钮 */
.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* 次要按钮 */
.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

/* 新建对话按钮 */
.new-chat-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* 侧边栏收起时隐藏按钮文本 */
.sidebar.collapsed .new-chat-btn .btn-text,
.sidebar.collapsed .settings-btn .btn-text {
    display: none;
}

/* 设置按钮 */
.settings-btn {
    width: 100%;
    padding: 10px var(--spacing-lg);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 14px;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

/* 清空历史按钮 - 优化版（默认状态更清晰） */
.clear-history-btn {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    color: #374151;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.clear-history-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.clear-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
    color: white;
    border-color: transparent;
}

.clear-history-btn:hover::before {
    opacity: 1;
}

.clear-history-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

/* 角色切换按钮组 - 优化版（默认状态更清晰） */
.role-switcher {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: nowrap;
}

.role-btn {
    background: #ffffff;
    border: 2px solid #d1d5db;
    color: #1f2937;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.role-btn:hover:not(.active) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(51, 112, 255, 0.25);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.role-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(51, 112, 255, 0.35);
}

.role-btn:active {
    transform: translateY(0);
}

/* 会话列表项 */
.session-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: var(--spacing-xs);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    position: relative;
}

.session-item:hover {
    background: var(--bg-tertiary);
}

.session-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary-color);
}

.session-content {
    flex: 1;
    min-width: 0;
}

.session-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 删除会话按钮 */
.delete-session-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    flex-shrink: 0;
}

.session-item:hover .delete-session-btn {
    opacity: 1;
}

.delete-session-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.delete-session-btn:active {
    transform: scale(0.9);
}

/* 空会话状态 */
.empty-sessions {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-tertiary);
}

.empty-sessions p {
    margin: var(--spacing-sm) 0;
}

.empty-sessions .hint {
    font-size: 12px;
    color: var(--text-quaternary);
}

.session-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 徽章 */
.header-badge {
    display: inline-block;
    padding: var(--spacing-xs) 10px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 11px;
    margin-left: var(--spacing-sm);
    font-weight: 500;
}

/* 消息样式 */
.message {
    max-width: 85%;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-xl);
    position: relative;
    line-height: 1.5;
    word-break: break-word;
    margin-bottom: 20px;
}

.user-message {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-xl) var(--radius-xl) var(--spacing-xs) var(--radius-xl);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.ai-message {
    align-self: flex-start;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xl) var(--spacing-xs);
    box-shadow: var(--shadow-sm);
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: var(--spacing-xs);
}

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

/* 消息附件样式 */
.message-attachments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.user-message .message-attachments {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.ai-message .message-attachments {
    border-top-color: var(--border-color);
}

.attachments-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.9;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.user-message .attachment-item {
    background: rgba(255, 255, 255, 0.15);
}

.ai-message .attachment-item {
    background: var(--bg-secondary);
}

.attachment-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachments-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.attachment-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.attachment-image:hover {
    transform: scale(1.05);
}

/* Markdown样式 */
.ai-message h2 {
    font-size: 18px;
    margin: 15px 0 10px 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

.ai-message h3 {
    font-size: 16px;
    margin: 12px 0 8px 0;
    color: var(--text-primary);
    font-weight: 600;
}

.ai-message h4 {
    font-size: 15px;
    margin: 10px 0 6px 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.ai-message ul, .ai-message ol {
    margin: 10px 0;
    padding-left: 25px;
}

.ai-message li {
    margin: 5px 0;
    line-height: 1.6;
}

.ai-message strong {
    color: var(--primary-color);
    font-weight: 600;
}

.ai-message p {
    margin: 8px 0;
    line-height: 1.7;
}

.ai-message code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
    color: var(--error-color);
}

.ai-message pre {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 10px 0;
}

.ai-message pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

/* 表格样式 - 豆包风格 */
.ai-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ai-message thead {
    background: var(--primary-color);
    color: white;
}

.ai-message th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid var(--primary-dark);
}

.ai-message td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.ai-message tr:last-child td {
    border-bottom: none;
}

.ai-message tbody tr:hover {
    background: var(--bg-secondary);
    transition: background 0.2s;
}

/* 引用块样式 */
.ai-message blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
    margin: 10px 0;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 分隔线 */
.ai-message hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 20px 0;
}

.ai-message code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--spacing-xs);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--error-color);
}

.ai-message pre {
    background: #2d3748;
    color: #f7fafc;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 10px 0;
}

.ai-message pre code {
    background: transparent;
    color: #f7fafc;
    padding: 0;
}

.ai-message p {
    margin: var(--spacing-sm) 0;
}

.ai-message hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.ai-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

.ai-message table th {
    background: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
}

.ai-message table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.ai-message table tr:hover {
    background: var(--bg-secondary);
}

.ai-message blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: var(--spacing-md);
    margin: 10px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 消息操作按钮 - 简化版（直接改变背景色） */
.message-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--spacing-md);
    opacity: 1;
}

.action-btn {
    padding: 10px;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    min-width: 40px;
    height: 40px;
}

/* 默认隐藏文字 */
.action-btn span,
.action-btn .speak-text {
    display: none;
}

.action-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
    flex-shrink: 0;
}

/* 悬浮时显示文字 */
.action-btn:hover {
    padding: 10px 16px;
    gap: 6px;
    min-width: auto;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.2);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white !important;
}

.action-btn:hover span,
.action-btn:hover .speak-text {
    display: inline;
}

.action-btn:hover svg {
    transform: scale(1.05);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white !important;
}

.action-btn.active svg {
    stroke: white;
}

/* 语音播报按钮特殊样式 */
.action-btn.speak-btn.playing {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border-color: #3b82f6 !important;
    color: white !important;
    animation: pulse-speak 1.5s ease-in-out infinite;
}

.action-btn.speak-btn.playing svg {
    stroke: white !important;
    animation: speaker-wave 1s ease-in-out infinite;
}

.action-btn.speak-btn.playing .speak-text {
    color: white !important;
}

@keyframes pulse-speak {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
        transform: scale(1.02);
    }
}

@keyframes speaker-wave {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 语音设置按钮 */
.action-btn.tts-settings-btn {
    padding: 10px;
    min-width: 40px;
}

.action-btn.tts-settings-btn svg {
    width: 16px;
    height: 16px;
}

/* 移动端适配 - 更紧凑 */
@media (max-width: 768px) {
    .message-actions {
        gap: 8px;
    }
    
    .action-btn {
        padding: 8px;
        min-width: 36px;
        height: 36px;
        border-radius: 8px;
    }
    
    .action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* 移动端悬浮效果（触摸时） */
    .action-btn:active {
        padding: 8px 12px;
        gap: 4px;
        min-width: auto;
        background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
        color: white !important;
        border-color: var(--primary-color);
    }
    
    .action-btn:active span,
    .action-btn:active .speak-text {
        display: inline;
        font-size: 12px;
    }
}

/* 来源信息 */
.sources-info {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.sources-title {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-item {
    color: var(--text-tertiary);
    margin: var(--spacing-xs) 0;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    display: inline-block;
    margin-right: 6px;
}

/* 推荐问题卡片 - 豆包风格优化版（默认状态更清晰） */
.recommendation-cards {
    margin-top: var(--spacing-lg);
    padding: 0;
}

.rec-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rec-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rec-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    color: #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.rec-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(51, 112, 255, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.rec-card::after {
    content: '→';
    color: #6b7280;
    font-size: 20px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.rec-card:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 16px rgba(51, 112, 255, 0.2);
    border-color: var(--primary-color);
}

.rec-card:hover::before {
    opacity: 1;
}

.rec-card:hover::after {
    color: var(--primary-color);
    transform: translateX(6px) scale(1.2);
}

.rec-card:active {
    transform: translateX(4px);
}

.rec-question {
    color: #1f2937;
    line-height: 1.6;
    flex: 1;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* 输入组件 - 优化版 */
.text-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 0; /* 改为直角 */
    background: var(--bg-secondary);
    outline: none;
    font-size: 15px;
    transition: all 0.2s;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.5;
    color: var(--text-primary);
}

.text-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 4px 16px rgba(51, 112, 255, 0.15);
    transform: translateY(-1px);
}

.text-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

/* 语音按钮 - 放在输入框左侧 - 优化版（默认状态更清晰） */
.voice-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.voice-btn:hover:not(:disabled) {
    background: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.25);
}

.voice-btn:disabled {
    background: #f3f4f6;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.5;
}

.voice-btn.recording {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-color: #ff6b6b;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

/* 文件上传按钮 - 与语音按钮样式一致 */
.file-upload-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-upload-btn:hover:not(:disabled) {
    background: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.25);
}

.file-upload-btn:disabled {
    background: #f3f4f6;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.5;
}

.file-upload-btn .icon {
    width: 20px;
    height: 20px;
}

/* 文档上传卡片样式 */
.document-upload {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 8px 0;
    gap: 12px;
}

.document-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-summary {
    font-size: 12px;
    color: #666;
}

.upload-progress {
    margin-top: 8px;
}

.progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: #4CAF50;
    width: var(--progress, 0%);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* 文档上传错误状态 */
.document-upload.error {
    background: #ffebee;
    border: 1px solid #ef5350;
}

.document-upload.error .document-name {
    color: #c62828;
}

.error-message {
    color: #c62828;
    font-size: 12px;
    margin-top: 4px;
}

/* 文档上下文指示器 */
.document-context-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 4px;
    margin-bottom: 12px;
    gap: 8px;
}

.context-icon {
    font-size: 20px;
}

.context-info {
    flex: 1;
    min-width: 0;
}

.context-filename {
    font-weight: 500;
    color: #1976d2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clear-context-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-context-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* 发送按钮 - 优化版（默认状态更清晰） */
.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.35);
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(51, 112, 255, 0.45);
}

.send-btn:active:not(:disabled) {
    transform: scale(1);
}

.send-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.send-btn.loading svg {
    display: none;
}

.send-btn.loading::after {
    content: '';
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.icon {
    width: 20px;
    height: 20px;
}

/* Toast提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-md) 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.info {
    background: var(--info-color);
}

/* 智能补全 */
.suggestion-box {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
    display: none;
    z-index: 1000;
}

.suggestion-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.suggestion-item {
    padding: var(--spacing-md) var(--spacing-lg);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    font-size: 14px;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-category {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.suggestion-question {
    color: var(--text-primary);
}

/* 权限请求 */
.permission-request {
    display: none;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin: 10px var(--spacing-lg);
    color: #92400e;
    text-align: center;
}

.permission-request.show {
    display: block;
}

.permission-btn {
    background: var(--warning-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    margin-top: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.permission-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .message {
        max-width: 90%;
        padding: 10px 14px;
    }
    
    .text-input {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .voice-btn, .send-btn {
        width: 44px;
        height: 44px;
    }
    
    .rec-container {
        grid-template-columns: 1fr;
    }
    
    /* 角色按钮移动端优化 */
    .role-btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 清空历史按钮移动端优化 */
    .clear-history-btn {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 95%;
    }
    
    .text-input {
        min-height: 44px;
    }
    
    .rec-card {
        font-size: 0.8rem;
        padding: 10px;
    }
}


/* ==================== 语音设置面板样式 ==================== */

.tts-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tts-settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

.tts-settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tts-settings-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.tts-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.tts-settings-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.tts-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tts-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.tts-settings-body {
    padding: 20px;
}

.tts-setting-item {
    margin-bottom: 20px;
}

.tts-setting-item:last-child {
    margin-bottom: 0;
}

.tts-setting-item label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.tts-setting-item label span {
    color: var(--primary-color);
    font-weight: 600;
}

/* 音色选择下拉框 */
.tts-voice-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    /* 关键：限制宽度和文字溢出 */
    max-width: 100%;
    box-sizing: border-box;
}

.tts-voice-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.1);
}

/* 下拉选项样式 */
.tts-voice-select option {
    padding: 8px;
    font-size: 13px;
}

/* 语速按钮组 */
.tts-rate-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tts-rate-btn {
    flex: 1;
    min-width: 50px;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.tts-rate-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tts-rate-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* 滑块样式 */
.tts-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(51, 112, 255, 0.4);
    transition: transform 0.2s;
}

.tts-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.tts-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(51, 112, 255, 0.4);
}

/* 试听按钮 */
.tts-test-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.tts-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(51, 112, 255, 0.4);
}

.tts-test-btn:active {
    transform: translateY(0);
}

.tts-test-btn svg {
    width: 18px;
    height: 18px;
}

.tts-test-btn.playing {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.tts-test-btn.playing svg {
    animation: pulse 1s ease-in-out infinite;
}

/* 语音设置按钮（添加到消息操作栏） */
.tts-settings-trigger {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 100;
}

.tts-settings-trigger:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(51, 112, 255, 0.3);
}

.tts-settings-trigger svg {
    width: 24px;
    height: 24px;
    color: #6b7280;
}

.tts-settings-trigger:hover svg {
    color: var(--primary-color);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .tts-settings-panel {
        width: 92%;
        max-width: none;
        max-height: 85vh;
        border-radius: 12px;
    }
    
    .tts-settings-header {
        padding: 14px 16px;
    }
    
    .tts-settings-header h3 {
        font-size: 16px;
    }
    
    .tts-settings-body {
        padding: 16px;
    }
    
    .tts-setting-item {
        margin-bottom: 16px;
    }
    
    .tts-setting-item label {
        font-size: 13px;
    }
    
    .tts-voice-select {
        font-size: 13px;
        padding: 9px 10px;
    }
    
    .tts-voice-select option {
        font-size: 12px;
    }
    
    .tts-rate-buttons {
        gap: 6px;
    }
    
    .tts-rate-btn {
        min-width: 45px;
        padding: 7px 10px;
        font-size: 12px;
    }
    
    .tts-test-btn {
        padding: 11px 18px;
        font-size: 14px;
    }
}
    .tts-rate-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 45px;
    }
    
    .tts-settings-trigger {
        bottom: 80px;
        right: 12px;
        width: 44px;
        height: 44px;
    }
}


/* ==================== 通用设置面板样式 ==================== */

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: 90%;
    max-width: 450px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.settings-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    z-index: 1;
}

.settings-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.settings-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.settings-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

/* 主题选项 */
.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-option {
    padding: 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.theme-option svg {
    width: 24px;
    height: 24px;
    color: #6b7280;
}

.theme-option span {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.theme-option:hover {
    border-color: var(--primary-color);
}

.theme-option:hover svg,
.theme-option:hover span {
    color: var(--primary-color);
}

.theme-option.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(51, 112, 255, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
}

.theme-option.active svg,
.theme-option.active span {
    color: var(--primary-color);
}

/* 字体大小控制 */
.font-size-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
}

.font-size-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.font-size-btn svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.font-size-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.font-size-btn:hover svg {
    color: white;
}

.font-size-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.font-size-btn:disabled:hover {
    border-color: #e5e7eb;
    background: white;
}

.font-size-btn:disabled:hover svg {
    color: #6b7280;
}

.font-size-display {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    min-width: 60px;
    text-align: center;
}

/* 字体大小预览 */
.font-size-preview {
    margin-top: 12px;
    padding: 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    text-align: center;
}

.font-size-preview p {
    margin: 0;
    color: #374151;
    transition: font-size 0.2s;
}

/* 关于信息 */
.about-info {
    padding: 16px;
    background: #f9fafb;
    border-radius: 10px;
    text-align: center;
}

.about-info p {
    margin: 6px 0;
    font-size: 14px;
    color: #6b7280;
}

.about-info p:first-child {
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .settings-panel {
        width: 95%;
        max-width: none;
    }
    
    .theme-options {
        gap: 8px;
    }
    
    .theme-option {
        padding: 10px 8px;
    }
    
    .theme-option svg {
        width: 20px;
        height: 20px;
    }
    
    .theme-option span {
        font-size: 12px;
    }
    
    .font-size-control {
        gap: 12px;
    }
    
    .font-size-btn {
        width: 32px;
        height: 32px;
    }
    
    .font-size-display {
        font-size: 14px;
        min-width: 50px;
    }
}


/* ==================== 图片上传组件样式 ==================== */

/* 文件上传按钮（图片和文档） */
.file-upload-btn,
.image-upload-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 确保触摸目标大小 */
    min-width: 48px;
    min-height: 48px;
}

.file-upload-btn:hover,
.image-upload-btn:hover {
    background: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.25);
}

.file-upload-btn .icon,
.image-upload-btn .icon {
    width: 22px;
    height: 22px;
}

/* 上传按钮工具提示 */
.upload-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    margin-bottom: 8px;
    z-index: 1000;
    pointer-events: none;
}

.file-upload-btn:hover .upload-tooltip {
    opacity: 1;
    visibility: visible;
}

.upload-tooltip .tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-tooltip .tooltip-types {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.upload-tooltip .tooltip-limit {
    font-size: 11px;
    opacity: 0.8;
    color: #fbbf24;
}

/* 图片预览容器 - 在输入框上方，与输入框对齐 */
.input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: var(--content-max-width, 800px);
}

.image-preview-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
}

/* 图片预览项 */
.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.image-preview-item:hover {
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 移除图片按钮 */
.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-preview-item:hover .remove-image-btn {
    opacity: 1;
}

.remove-image-btn:hover {
    background: #ef4444;
}

/* 拖拽提示层 */
.drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(51, 112, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.drop-hint {
    text-align: center;
    color: white;
}

.drop-hint svg {
    margin-bottom: 12px;
    opacity: 0.9;
}

.drop-hint p {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* 消息中的图片显示 */
.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

/* 图片加载中状态 */
.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.image-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ==================== 文件上传组件样式（扩展支持文档） ==================== */

/* 文件上传按钮 */
.file-upload-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-upload-btn:hover {
    background: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.25);
}

.file-upload-btn .icon {
    width: 22px;
    height: 22px;
}

/* 文件预览容器 - 在输入框上方 */
.file-preview-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* 文件预览项（图片） */
.file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.file-preview-item:hover {
    transform: scale(1.05);
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片预览项可点击 */
.file-preview-item.image-item {
    cursor: pointer;
}

.file-preview-item.image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.file-preview-item.image-item img {
    cursor: pointer;
}

/* 文件预览项（文档） */
.file-preview-item.document-preview {
    width: auto;
    min-width: 120px;
    max-width: 200px;
    height: auto;
    padding: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.file-preview-item.document-preview:hover {
    border-color: var(--primary-color);
}

.document-icon {
    font-size: 32px;
    line-height: 1;
}

.document-name {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

/* 上传进度 */
.upload-progress {
    width: 100%;
    margin-top: 4px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2563eb);
    transition: width 0.3s;
}

.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 2px;
}

/* 文件状态 */
.file-preview-item.uploading {
    opacity: 0.7;
}

.file-preview-item.processing {
    opacity: 0.8;
}

.file-preview-item.success {
    border-color: var(--success-color);
}

.file-preview-item.error {
    border-color: var(--error-color);
}

/* 移除文件按钮 */
.remove-file-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    line-height: 1;
}

.file-preview-item:hover .remove-file-btn {
    opacity: 1;
}

.remove-file-btn:hover {
    background: #ef4444;
}

/* 文档预览项的移除按钮 */
.document-preview .remove-file-btn {
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    font-size: 14px;
}

/* 拖拽提示层 - 更新文字 */
.drop-hint-sub {
    font-size: 14px;
    font-weight: 400;
    margin-top: 4px;
    opacity: 0.9;
}


/* ==================== 文档消息卡片样式 ==================== */

/* 文档卡片容器 */
.document-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.document-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.15);
}

.document-card .document-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-filename {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-summary {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.document-status {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 文档状态指示器 */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.status-indicator.uploading {
    background: #dbeafe;
    color: #1e40af;
}

.status-indicator.processing {
    background: #fef3c7;
    color: #92400e;
}

.status-indicator.success {
    background: #d1fae5;
    color: #065f46;
}

.status-indicator.error {
    background: #fee2e2;
    color: #991b1b;
}

/* 处理中动画 */
.status-indicator.processing::before {
    content: '';
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ==================== 文档上下文指示器样式 ==================== */

/* 文档上下文容器 - 显示在聊天头部 */
.document-context-indicator {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
    animation: slideDown 0.3s ease-out;
}

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

.document-context-indicator .document-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.document-context-info {
    flex: 1;
    min-width: 0;
}

.document-context-title {
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 2px;
}

.document-context-filename {
    font-size: 12px;
    color: #0c4a6e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-context-summary {
    font-size: 11px;
    color: #075985;
    margin-top: 2px;
}

/* 清除文档按钮 */
.clear-document-btn {
    background: white;
    border: 1.5px solid #bae6fd;
    color: #0369a1;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.clear-document-btn:hover {
    background: #0369a1;
    color: white;
    border-color: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(3, 105, 161, 0.3);
}

.clear-document-btn svg {
    width: 14px;
    height: 14px;
}


/* ==================== 错误显示样式 ==================== */

/* 错误消息卡片 */
.error-message-card {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    max-width: 500px;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.error-icon {
    font-size: 20px;
}

.error-title {
    font-size: 14px;
    font-weight: 600;
    color: #991b1b;
}

.error-description {
    font-size: 13px;
    color: #7f1d1d;
    margin-bottom: 10px;
    line-height: 1.5;
}

.error-suggestion {
    background: white;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: #991b1b;
}

.error-suggestion-title {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-suggestion-text {
    color: #7f1d1d;
    line-height: 1.4;
}

/* 内联错误提示 */
.inline-error {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    color: #991b1b;
    margin-top: 8px;
}

.inline-error svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}


/* ==================== 上传按钮工具提示 ==================== */

/* 工具提示容器 */
.upload-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.upload-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.file-upload-btn:hover .upload-tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.tooltip-types {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.tooltip-limit {
    font-size: 11px;
    opacity: 0.8;
}


/* ==================== 移动端适配 ==================== */

@media (max-width: 768px) {
    .document-card {
        max-width: 100%;
    }
    
    .document-context-indicator {
        margin: 10px 12px;
        padding: 10px 12px;
    }
    
    .file-preview-item.document-preview {
        min-width: 100px;
        max-width: 150px;
        padding: 10px;
    }
    
    .document-icon {
        font-size: 28px;
    }
    
    .error-message-card {
        max-width: 100%;
    }
    
    .upload-tooltip {
        font-size: 11px;
        padding: 8px 12px;
        white-space: normal;
        max-width: 200px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .document-context-indicator {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .clear-document-btn {
        width: 100%;
        justify-content: center;
    }
}ing {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.image-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 多模态标识 */
.multimodal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    margin-left: 8px;
}

.multimodal-badge svg {
    width: 12px;
    height: 12px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .image-upload-btn {
        width: 44px;
        height: 44px;
    }
    
    .image-upload-btn .icon {
        width: 20px;
        height: 20px;
    }
    
    .image-preview-container {
        margin-bottom: 8px;
        padding: 10px 12px;
    }
    
    .image-preview-item {
        width: 60px;
        height: 60px;
    }
    
    .message-image {
        max-width: 200px;
        max-height: 200px;
    }
}


/* input-wrapper 内的 input-container */
.input-wrapper .input-container {
    width: 100%;
    max-width: none;
}


/* 图片预览弹窗 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.image-preview-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-preview-modal img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8);
    transition: transform 0.3s ease;
}

.image-preview-modal.show img {
    transform: translate(-50%, -50%) scale(1);
}

.image-preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10001;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-preview-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    z-index: 10001;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .image-preview-modal img {
        max-width: 95vw;
        max-height: 80vh;
        border-radius: 4px;
    }
    
    .image-preview-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .image-preview-hint {
        bottom: 15px;
        font-size: 12px;
    }
}

/* 消息中的图片添加点击效果 */
.message-image {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 预览容器中的图片也可点击 */
.image-preview-item img {
    cursor: pointer;
}


/* ==================== 文件上传组件样式（扩展支持文档） ==================== */

/* 文件上传按钮 */
.file-upload-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-upload-btn:hover {
    background: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.25);
}

.file-upload-btn .icon {
    width: 22px;
    height: 22px;
}

/* 文件预览容器 */
.file-preview-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
}

/* 文件预览项 */
.file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.file-preview-item:hover {
    transform: scale(1.05);
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文档预览样式 */
.file-preview-item.document-preview {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    width: 100px;
    height: 100px;
}

.document-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.document-name {
    font-size: 10px;
    color: #374151;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
    max-height: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 移除文件按钮 */
.remove-file-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.file-preview-item:hover .remove-file-btn {
    opacity: 1;
}

.remove-file-btn:hover {
    background: #ef4444;
}

/* 拖拽提示层（更新文字） */
.drop-hint-sub {
    font-size: 14px;
    font-weight: 400;
    margin-top: 8px;
    opacity: 0.9;
}

/* 上传进度指示器 */
.upload-progress {
    margin-top: 8px;
    width: 100%;
}

.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2563eb);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 处理中动画 */
.file-preview-item.processing .progress-bar {
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    background-size: 200% 100%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-text {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* 文档上传成功状态 */
.file-preview-item.success {
    border: 2px solid #10b981;
}

.file-preview-item.success .document-icon::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 文档上传错误状态 */
.file-preview-item.error {
    border: 2px solid #ef4444;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.file-preview-item.error .document-icon {
    opacity: 0.5;
}

/* 多模态标识（文档） */
.multimodal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(51, 112, 255, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    border: 1px solid rgba(51, 112, 255, 0.3);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.multimodal-badge svg {
    width: 14px;
    height: 14px;
}

/* 文档消息样式 */
.document-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 移动端适配 - 文件上传 ==================== */
@media (max-width: 768px) {
    /* 确保最小触摸目标尺寸 44x44px (Requirement 10.1) */
    .file-upload-btn,
    .image-upload-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        /* 优化按钮间距，确保易于点击 */
        margin: 0 4px;
    }
    
    .file-upload-btn .icon,
    .image-upload-btn .icon {
        width: 20px;
        height: 20px;
    }
    
    /* 移动端隐藏悬浮提示，改用触摸反馈 */
    .upload-tooltip {
        display: none;
    }
    
    /* 触摸反馈 - 点击时显示缩放效果 */
    .file-upload-btn:active,
    .image-upload-btn:active {
        transform: scale(0.95);
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }
    
    /* 文件预览项优化 */
    .file-preview-item {
        width: 70px;
        height: 70px;
    }
    
    .file-preview-item.document-preview {
        width: 90px;
        height: 90px;
    }
    
    .document-icon {
        font-size: 28px;
    }
    
    .document-name {
        font-size: 9px;
    }
    
    /* 移除按钮在移动端始终可见 */
    .remove-file-btn {
        opacity: 1;
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    /* 输入容器在移动端的优化 */
    .input-container {
        padding: 8px 12px;
        gap: 8px;
    }
    
    /* 确保语音、上传、发送按钮都符合触摸标准 */
    .voice-btn,
    .send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* ===== 文档卡片移动端优化 (Requirement 10.3) ===== */
    
    /* 文档卡片适配小屏幕 */
    .document-card {
        max-width: 100%;
        padding: 12px 14px;
        gap: 10px;
        margin-bottom: 8px;
    }
    
    .document-card .document-icon {
        font-size: 32px;
    }
    
    .document-filename {
        font-size: 13px;
    }
    
    .document-summary {
        font-size: 11px;
    }
    
    .document-status {
        font-size: 10px;
    }
    
    /* 文档上下文指示器移动端优化 */
    .document-context-indicator {
        margin: 8px 12px;
        padding: 10px 12px;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .document-context-info {
        flex: 1;
        min-width: 0;
    }
    
    .document-context-filename {
        font-size: 13px;
    }
    
    .document-context-summary {
        font-size: 11px;
    }
    
    /* ===== 进度指示器移动端优化 (Requirement 10.3) ===== */
    
    /* 上传进度条在移动端更明显 */
    .upload-progress {
        margin-top: 6px;
    }
    
    .progress-bar {
        height: 6px;
        border-radius: 3px;
    }
    
    .progress-text {
        font-size: 11px;
        margin-top: 4px;
        text-align: center;
        color: var(--text-secondary);
        font-weight: 600;
    }
    
    /* 状态指示器移动端优化 */
    .status-indicator {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* 处理中状态更明显 */
    .status-indicator.processing {
        animation: pulse 1.5s ease-in-out infinite;
    }
    
    @keyframes pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: 0.7;
        }
    }
    
    /* ===== 拖拽提示移动端优化 ===== */
    
    /* 移动端拖拽提示更简洁 */
    .drop-overlay {
        background: rgba(51, 112, 255, 0.95);
    }
    
    .drop-hint {
        padding: 20px;
    }
    
    .drop-hint svg {
        width: 40px;
        height: 40px;
    }
    
    .drop-hint p {
        font-size: 16px;
    }
    
    .drop-hint-sub {
        font-size: 12px;
        margin-top: 8px;
        opacity: 0.9;
    }
    
    /* ===== 文件预览容器移动端优化 ===== */
    
    .file-preview-container {
        padding: 10px 12px;
        gap: 8px;
        margin-bottom: 8px;
        border-radius: 12px;
        /* 确保在移动端不破坏布局 */
        flex-shrink: 0;
        min-height: auto;
    }
    
    /* 移动端输入容器确保正确显示 */
    .input-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .input-outer-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    /* 错误消息移动端优化 */
    .error-card {
        margin: 8px 12px;
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .error-title {
        font-size: 14px;
    }
    
    .error-description {
        font-size: 12px;
    }
    
    .error-suggestion {
        font-size: 11px;
    }

}

/* ===== 超小屏幕优化 (< 480px) ===== */
@media (max-width: 480px) {
    .file-preview-container {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .file-preview-item {
        width: 60px;
        height: 60px;
    }
    
    .file-preview-item.document-preview {
        width: 80px;
        height: 80px;
    }
    
    .document-icon {
        font-size: 24px;
    }
    
    .document-name {
        font-size: 8px;
    }
    
    /* 文档卡片进一步压缩 */
    .document-card {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .document-card .document-icon {
        font-size: 28px;
    }
    
    .document-filename {
        font-size: 12px;
    }
    
    .document-summary {
        font-size: 10px;
    }
    
    /* 进度条更粗，更易见 */
    .progress-bar {
        height: 8px;
    }
    
    /* 按钮间距更紧凑 */
    .input-container {
        padding: 6px 10px;
        gap: 6px;
    }
}

/* ===== 横屏模式优化 ===== */
@media (max-width: 768px) and (orientation: landscape) {
    /* 横屏时文档卡片更紧凑 */
    .document-card {
        padding: 8px 12px;
    }
    
    .document-context-indicator {
        margin: 6px 12px;
        padding: 8px 12px;
    }
    
    /* 横屏时预览项更小 */
    .file-preview-item {
        width: 60px;
        height: 60px;
    }
    
    .file-preview-item.document-preview {
        width: 75px;
        height: 75px;
    }
}


/* 拖拽上传样式 */
.chat-container.drag-over {
    position: relative;
}

.chat-container.drag-over::after {
    content: '📎 拖放文件到这里上传';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(51, 112, 255, 0.1);
    border: 3px dashed var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 500;
    color: var(--primary-color);
    z-index: 1000;
    pointer-events: none;
}


/* 文档预览容器 */
.document-preview-container {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    max-width: 100%;
}

.document-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    position: relative;
    max-width: 100%;
    min-height: 48px;
}

.document-preview-item .document-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.document-preview-item .document-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.document-preview-item .document-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.document-preview-item .document-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.remove-document-btn {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    padding: 0;
    margin-left: 8px;
}

.remove-document-btn:hover {
    background: var(--bg-tertiary);
    color: var(--error-color);
}

.remove-document-btn svg {
    width: 16px;
    height: 16px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .document-preview-container {
        padding: 6px 8px;
    }
    
    .document-preview-item {
        padding: 6px 10px;
        min-height: 44px;
    }
    
    .document-preview-item .document-icon {
        font-size: 20px;
        width: 28px;
        height: 28px;
    }
    
    .document-preview-item .document-name {
        font-size: 13px;
    }
    
    .document-preview-item .document-size {
        font-size: 11px;
    }
}

/* 思考步骤样式 */
.thinking-step {
    color: #999;
    font-style: italic;
    margin: 4px 0;
    font-size: 0.9em;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
    border-left: 3px solid #e0e0e0;
    animation: fadeInThinking 0.3s ease-in;
}

@keyframes fadeInThinking {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 暗色模式下的思考步骤 */
@media (prefers-color-scheme: dark) {
    .thinking-step {
        color: #888;
        background: rgba(255, 255, 255, 0.03);
        border-left-color: #444;
    }
}


/* ========================================
   移动端输入区域优化 - 豆包风格
   ======================================== */

/* 响应式显示控制 - 统一使用加号按钮 */
.mobile-only {
    display: flex; /* 所有设备都显示加号按钮 */
}

.desktop-only {
    display: none !important; /* 所有设备都隐藏独立按钮 */
}

/* 加号按钮 - 移动端 */
.add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.add-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.add-btn:active {
    transform: scale(0.95);
}

.add-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    transform: rotate(45deg);
}

.add-btn .icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

/* 功能按钮菜单 */
.input-actions-menu {
    position: absolute;
    bottom: 100%;
    left: 12px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    margin-bottom: 8px;
    min-width: 160px;
    z-index: 1000;
    animation: slideUp 0.2s ease;
}

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

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.action-menu-item:hover {
    background: #f3f4f6;
}

.action-menu-item:active {
    background: #e5e7eb;
}

.action-menu-item .icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
    flex-shrink: 0;
}

.action-menu-item span {
    flex: 1;
}

/* 移动端输入容器优化 */
@media (max-width: 768px) {
    .input-container {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .text-input {
        flex: 1;
        min-height: 40px;
        max-height: 120px;
        padding: 10px 12px;
        font-size: 15px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
    }
}

/* 小屏幕优化 */
@media (max-width: 375px) {
    .input-container {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .add-btn {
        width: 36px;
        height: 36px;
    }
    
    .add-btn .icon {
        width: 18px;
        height: 18px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
    
    .text-input {
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .action-menu-item {
        padding: 10px 14px;
        font-size: 14px;
    }
}


/* ==================== 生成图片卡片 ==================== */
.generated-image-card {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.generated-image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.image-container {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generated-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-caption {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    background: white;
}

.image-caption .icon {
    width: 20px;
    height: 20px;
    color: #3498db;
    flex-shrink: 0;
}

.image-caption .text {
    flex: 1;
    line-height: 1.4;
}

/* 图片预览遮罩 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-preview-overlay.show {
    opacity: 1;
}

.image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-preview-caption {
    margin-top: 16px;
    color: white;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
}

/* 暗色模式 */
.dark-mode .generated-image-card {
    background: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dark-mode .image-container {
    background: #1a1a1a;
}

.dark-mode .image-caption {
    background: #2d2d2d;
    color: #ccc;
}

.dark-mode .image-loading {
    color: #999;
}

/* 响应式 */
@media (max-width: 768px) {
    .generated-image-card {
        margin: 12px 0;
        border-radius: 8px;
    }
    
    .image-caption {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .image-preview-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .image-preview-close {
        top: -50px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}


/* 图片生成进度动画 */
.image-progress-container {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.image-loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

/* 加载旋转器 */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 加载文本 */
.loading-text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* 倒计时 */
.loading-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.timer-icon {
    font-size: 20px;
}

.timer-text {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.countdown {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    font-weight: 700;
    color: #ffd700;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* 图片生成错误 */
.image-generation-error {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: #fee;
    border: 1px solid #fcc;
    border-radius: var(--radius-md);
    margin: var(--spacing-lg) 0;
}

.error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.error-message {
    color: #c33;
    font-size: 14px;
    line-height: 1.5;
}

/* 暗色模式适配 */
.dark-theme .image-generation-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.dark-theme .error-message {
    color: #fca5a5;
}


/* 意图分析提示 */
.intent-analyzing-indicator {
    display: flex;
    justify-content: center;
    padding: 12px;
    margin: 8px 0;
}

.analyzing-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
}

.analyzing-content .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
