/* AI对话页面样式 */

/* 错误消息样式 */
.error-message {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.error-message h4 {
    color: #d32f2f;
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.error-message p {
    color: #c62828;
    margin: 5px 0;
    line-height: 1.4;
}

.error-hint {
    color: #757575 !important;
    font-size: 12px;
    font-style: italic;
}

/* 思考模型样式 */
.ai-reasoning {
    background: #f8f9fa;
    border-left: 4px solid #6c757d;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.ai-reasoning h4 {
    color: #6c757d;
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.reasoning-content {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #495057;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.ai-answer {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    border-radius: 8px;
}

.ai-answer h4 {
    color: #1976d2;
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.answer-content {
    color: #333;
    line-height: 1.6;
}

/* 对话容器布局 */
.chat-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    height: calc(100vh - 120px);
}

/* 对话面板 */
.chat-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部工具栏 */
.chat-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.8);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-selector label {
    font-weight: 500;
    color: #4a5568;
}

.model-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 200px;
}

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

/* 对话消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.3);
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #4a5568;
}

.welcome-message h3 {
    color: #2d3748;
    margin-bottom: 15px;
}

.welcome-message ul {
    text-align: left;
    max-width: 400px;
    margin: 15px auto;
    padding-left: 20px;
}

.welcome-message li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* 消息样式 */
.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.message-user .message-content {
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-assistant .message-content {
    background: rgba(255, 255, 255, 0.9);
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 8px;
    text-align: center;
}

.message-images {
    margin: 10px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.message-image {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

/* 思考过程样式 */
.thinking-content {
    background: rgba(49, 130, 206, 0.1);
    border-left: 4px solid #3182ce;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #4a5568;
    font-style: italic;
}

.thinking-label {
    font-size: 12px;
    color: #3182ce;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

/* 流式响应样式 */
.streaming-message {
    position: relative;
}

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 20px;
    background: #3182ce;
    animation: blink 1s infinite;
    margin-left: 2px;
}

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

/* 输入区域 */
.chat-input-area {
    border-top: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 25px;
}

.input-attachments {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.attachment-item {
    position: relative;
    display: inline-block;
}

.attachment-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.attachment-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.attach-btn {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.attach-btn:hover {
    background: #f7fafc;
    border-color: #3182ce;
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    background: white;
    transition: border-color 0.3s ease;
}

#message-input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.send-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    min-width: 48px;
}

.send-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46a2);
    transform: translateY(-2px);
}

.send-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

/* 侧边栏面板 */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
}

/* 对话会话列表 */
.chat-sessions {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.session-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    background: rgba(248, 250, 252, 0.8);
}

.session-item:hover {
    background: rgba(49, 130, 206, 0.1);
    border-color: #3182ce;
}

.session-item.active {
    background: rgba(49, 130, 206, 0.15);
    border-color: #3182ce;
}

.session-title {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.session-time {
    font-size: 12px;
    color: #718096;
}

.btn-full {
    width: 100%;
}

/* 快捷提示 */
.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #4a5568;
}

.prompt-btn:hover {
    background: rgba(49, 130, 206, 0.1);
    border-color: #3182ce;
    color: #3182ce;
}

/* 对话统计 */
.chat-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.stat-label {
    font-size: 14px;
    color: #4a5568;
}

.stat-value {
    font-weight: bold;
    color: #3182ce;
}

/* 总结模态框样式 */
.summarize-content {
    max-height: 60vh;
    overflow-y: auto;
}

.extracted-info,
.missing-fields {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #3182ce;
}

.extracted-info h4,
.missing-fields h4 {
    color: #2d3748;
    margin-bottom: 10px;
}

.info-item {
    margin-bottom: 10px;
}

.info-label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 5px;
}

.info-value {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
}

.missing-item {
    background: rgba(229, 62, 62, 0.1);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #e53e3e;
}

.summarize-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .chat-container {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 968px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar-panel {
        order: -1;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .sidebar-panel .panel-card {
        min-width: 300px;
        margin-bottom: 0;
    }
    
    .chat-panel {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .chat-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .model-selector {
        justify-content: center;
    }
    
    .input-controls {
        flex-wrap: wrap;
    }
    
    #message-input {
        min-height: 60px;
    }
    
    .message-content {
        max-width: 95%;
    }
    
    .sidebar-panel {
        flex-direction: column;
    }
    
    .sidebar-panel .panel-card {
        min-width: auto;
    }
}

/* 消息特殊样式 */
.message-code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    overflow-x: auto;
}

.message-formula {
    background: rgba(49, 130, 206, 0.05);
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
}

/* 加载状态 */
.message-loading {
    opacity: 0.7;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3182ce;
    animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 错误消息样式 */
.message-error .message-content {
    background: rgba(229, 62, 62, 0.1);
    border-color: #e53e3e;
    color: #c53030;
}

/* 图片查看器 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 3000;
    cursor: zoom-out;
}

.image-viewer img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

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

/* 总结表单样式 */
.final-form .form-group {
    margin-bottom: 15px;
}

.final-form .form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #4a5568;
}

.final-form .form-input,
.final-form .form-select,
.final-form .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.chat-sessions::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-sessions::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-sessions::-webkit-scrollbar-thumb {
    background: rgba(49, 130, 206, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-sessions::-webkit-scrollbar-thumb:hover {
    background: rgba(49, 130, 206, 0.5);
} 

/* ===============================
   卡通浅蓝主题覆盖（Chat）
   =============================== */
.chat-panel {
    border: var(--ctn-outline);
    border-radius: 20px;
    box-shadow: var(--ctn-shadow-md);
}
.chat-toolbar {
    background: rgba(255,255,255,0.85);
    border-bottom: 2px dashed rgba(44,123,229,0.25);
}
.model-select {
    border: 2px solid rgba(44,123,229,0.2);
    border-radius: 12px;
}
.chat-messages {
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.25));
}
.message-content {
    border: 2px solid rgba(44,123,229,0.15);
    box-shadow: 0 4px 0 rgba(30,79,161,0.06);
}
.message-user .message-content {
    background: linear-gradient(135deg, var(--ctn-primary), var(--ctn-primary-dark));
}
.message-assistant .message-content {
    background: #ffffff;
}
.attach-btn {
    border: 2px solid rgba(44,123,229,0.25);
}
.send-btn {
    background: linear-gradient(135deg, var(--ctn-primary), var(--ctn-primary-dark));
    box-shadow: 0 4px 0 rgba(30,79,161,0.08);
    border: 2px solid rgba(44,123,229,0.35);
}
.session-item {
    border: 2px solid rgba(44,123,229,0.12);
    border-radius: 14px;
}
.prompt-btn {
    border: 2px solid rgba(44,123,229,0.1);
    border-radius: 14px;
}
.prompt-btn:hover {
    border-color: rgba(44,123,229,0.35);
}
.final-form .form-input,
.final-form .form-select,
.final-form .form-textarea {
    border: 2px solid rgba(44,123,229,0.2);
    border-radius: 12px;
}
