/* 文档预览样式 - 豆包风格 */

/* 分屏布局 - 让聊天容器缩小宽度，为右侧文档面板预留空间 */
.chat-container.split-view {
    width: 45% !important;
    margin-right: 55%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 文档预览面板 */
.document-preview-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 55%;
    height: 100vh;
    background: #f5f7fa;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.document-preview-panel.visible {
    transform: translateX(0);
}

/* 文档头部 */
.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.document-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.doc-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.doc-action-btn:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.doc-action-btn:active:not(:disabled) {
    transform: translateY(0);
}

.doc-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.doc-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* 文档内容区域 */
.document-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: white;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 文档内容样式 */
.document-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.document-content h2 {
    font-size: 22px;
    font-weight: 600;
    color: #374151;
    margin: 24px 0 12px 0;
}

.document-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #4b5563;
    margin: 20px 0 10px 0;
}

.document-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin: 16px 0 8px 0;
}

.document-content p {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
    margin: 0 0 12px 0;
}

.document-content ul,
.document-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.document-content li {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
    margin: 6px 0;
}

.document-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #e11d48;
}

.document-content pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.document-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.document-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 16px;
    margin: 16px 0;
    color: #6b7280;
    font-style: italic;
}

.document-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.document-content th,
.document-content td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}

.document-content th {
    background: #f9fafb;
    font-weight: 600;
}

/* 加载动画 */
.document-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.document-loading p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 滚动条样式 */
.document-content::-webkit-scrollbar {
    width: 8px;
}

.document-content::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.document-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.document-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-container.split-view {
        grid-template-columns: 1fr;
        position: relative;
    }
    
    .document-preview-panel {
        width: 100%;
        right: -100%;
    }
    
    .document-preview-panel.visible {
        right: 0;
    }
    
    .document-header {
        padding: 16px 20px;
    }
    
    .document-title {
        font-size: 16px;
    }
    
    .doc-action-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .doc-action-btn span {
        display: none;
    }
    
    .doc-action-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .document-content {
        padding: 20px;
        margin: 12px;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-container.split-view {
        grid-template-columns: 40% 60%;
    }
    
    .document-preview-panel {
        width: 60%;
    }
}


/* 文档卡片样式（在聊天区域显示） */
.document-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.document-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.document-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-card-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.document-card-info {
    flex: 1;
    min-width: 0;
}

.document-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-card-meta {
    font-size: 13px;
    color: #6b7280;
}

.document-card-preview {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-card-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s;
}

.document-card:hover .document-card-actions {
    opacity: 1;
    transform: translateY(0);
}

.doc-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.doc-card-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.doc-card-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* 文档生成中断提示 */
.generation-interrupted-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid #f97316;
    border-radius: 8px;
    margin: 12px 0;
}

.generation-interrupted-notice svg {
    width: 24px;
    height: 24px;
    color: #f97316;
    flex-shrink: 0;
    margin-top: 2px;
}

.generation-interrupted-notice .notice-content {
    flex: 1;
}

.generation-interrupted-notice .notice-title {
    font-size: 15px;
    font-weight: 600;
    color: #9a3412;
    margin: 0 0 6px 0;
}

.generation-interrupted-notice .notice-text {
    font-size: 14px;
    line-height: 1.6;
    color: #7c2d12;
    margin: 0;
}

/* 思维导图提示样式 */
.mindmap-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    margin: 0 0 20px 0;
}

.mindmap-notice svg {
    width: 24px;
    height: 24px;
    color: #3b82f6;
    flex-shrink: 0;
    margin-top: 2px;
}

.mindmap-notice .notice-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #1e40af;
    margin: 0;
}

.mindmap-notice .notice-text strong {
    font-weight: 600;
    color: #1e3a8a;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .document-card {
        padding: 16px;
    }
    
    .document-card-icon {
        width: 36px;
        height: 36px;
    }
    
    .document-card-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .document-card-title {
        font-size: 15px;
    }
    
    .document-card-meta {
        font-size: 12px;
    }
    
    .document-card-preview {
        font-size: 13px;
        max-height: 60px;
    }
    
    .doc-card-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .doc-card-btn span {
        display: none;
    }
    
    .doc-card-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .generation-interrupted-notice {
        padding: 12px;
        gap: 10px;
    }
    
    .generation-interrupted-notice svg {
        width: 20px;
        height: 20px;
    }
    
    .generation-interrupted-notice .notice-title {
        font-size: 14px;
    }
    
    .generation-interrupted-notice .notice-text {
        font-size: 13px;
    }
    
    .mindmap-notice {
        padding: 12px;
        gap: 10px;
    }
    
    .mindmap-notice svg {
        width: 20px;
        height: 20px;
    }
    
    .mindmap-notice .notice-text {
        font-size: 13px;
    }
}
