/* DD 尽调报告工作台 — 页面专属样式 */

/* ===== 三栏布局 ===== */
.dd-workbench {
    display: flex;
    overflow: hidden;
}

.dd-sidebar {
    width: 300px;
    min-width: 300px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dd-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f9fafb;
}

.dd-right-panel {
    width: 30%;
    min-width: 260px;
    max-width: 400px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* ===== 消息流区域 ===== */
.dd-message-stream {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.dd-message-stream .dd-msg {
    margin-bottom: 16px;
    animation: dd-fade-in 0.3s ease-in-out;
}

@keyframes dd-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 步骤标题行（时间线风格） */
.dd-msg-step-start {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    padding: 10px 0;
    position: relative;
}

.dd-msg-step-start .dd-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: #eff6ff;
    color: #2563eb;
    border: 2px solid #dbeafe;
}

/* 事实条目 */
.dd-msg-fact {
    font-size: 13px;
    color: #6b7280;
    padding: 3px 0 3px 42px;
    display: flex;
    gap: 8px;
}

.dd-msg-fact .dd-fact-key {
    color: #9ca3af;
    flex-shrink: 0;
    min-width: 80px;
}

.dd-msg-fact .dd-fact-value {
    color: #4b5563;
}

/* 章节内容块 */
.dd-chapter-block {
    margin: 8px 0 8px 42px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.dd-chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    transition: background 0.2s;
}

.dd-chapter-header:hover {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.dd-chapter-header .dd-chapter-toggle {
    transition: transform 0.2s;
    color: #9ca3af;
    font-size: 12px;
}

.dd-chapter-content {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.75;
    color: #374151;
    max-height: 500px;
    overflow-y: auto;
}

.dd-chapter-content.collapsed {
    display: none;
}

/* 章节流式追加时的"打字机"光标 */
.dd-chapter-content .dd-cursor::after {
    content: '▌';
    color: #3b82f6;
    animation: dd-blink 1s step-end infinite;
}

@keyframes dd-blink {
    50% { opacity: 0; }
}

/* 步骤完成 */
.dd-msg-step-complete {
    font-size: 13px;
    color: #10b981;
    padding: 4px 0 4px 42px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== 对话气泡 ===== */
.dd-chat-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: dd-fade-in 0.3s ease-in-out;
}

.dd-chat-row.user {
    flex-direction: row-reverse;
}

.dd-chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}

.dd-chat-avatar.user {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: #fff;
}

.dd-chat-avatar.assistant {
    background: linear-gradient(135deg, #f0f7ff 0%, #dbeafe 100%);
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.dd-chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dd-chat-bubble.user {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dd-chat-bubble.assistant {
    margin-right: auto;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* 气泡内 Markdown 渲染 */
.dd-chat-bubble.assistant p { margin: 0 0 8px; }
.dd-chat-bubble.assistant p:last-child { margin-bottom: 0; }
.dd-chat-bubble.assistant ul, .dd-chat-bubble.assistant ol { margin: 4px 0; padding-left: 20px; }
.dd-chat-bubble.assistant code {
    background: #f1f5f9; padding: 1px 5px; border-radius: 4px;
    font-size: 13px; color: #d97706;
}
.dd-chat-bubble.assistant pre {
    background: #f8fafc; padding: 10px 12px; border-radius: 6px;
    overflow-x: auto; margin: 8px 0; font-size: 13px;
    border: 1px solid #e5e7eb;
}
.dd-chat-bubble.assistant pre code {
    background: none; padding: 0; color: #374151;
}
.dd-chat-bubble.assistant table {
    width: 100%; border-collapse: collapse; margin: 8px 0;
}
.dd-chat-bubble.assistant th, .dd-chat-bubble.assistant td {
    border: 1px solid #e5e7eb; padding: 6px 10px; font-size: 13px;
}
.dd-chat-bubble.assistant th { background: #f9fafb; font-weight: 600; }

/* 错误消息 */
.dd-msg-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 完成分隔线 */
.dd-done-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #10b981;
    font-size: 14px;
    font-weight: 600;
}

.dd-done-divider::before,
.dd-done-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d1d5db, transparent);
}

/* ===== 输入框区域 ===== */
.dd-input-area {
    border-top: 1px solid #e5e7eb;
    background: #fff;
    padding: 12px 16px;
    flex-shrink: 0;
}

.dd-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f9fafb;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 10px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dd-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dd-input-wrapper.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.dd-input-text {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    color: #1f2937;
}

.dd-input-text::placeholder {
    color: #9ca3af;
}

.dd-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.2);
}

.dd-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 102, 255, 0.3);
}

.dd-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.dd-attach-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.dd-attach-btn:hover {
    color: #3b82f6;
}

/* 文件拖拽高亮 */
.dd-input-wrapper.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* 已选文件列表 */
.dd-file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.dd-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    font-size: 12px;
    color: #1e40af;
}

.dd-file-chip .dd-file-remove {
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
    line-height: 1;
}

.dd-file-chip .dd-file-remove:hover {
    color: #dc2626;
}

/* 启动确认卡片 */
.dd-confirm-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dd-confirm-card .dd-confirm-row {
    font-size: 13px;
    color: #6b7280;
    padding: 2px 0;
}

.dd-confirm-card .dd-confirm-btn {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.dd-confirm-card .dd-confirm-btn:hover {
    background: #2563eb;
}

/* ===== 左栏任务卡片 ===== */
.dd-task-card {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    background: #fff;
}

.dd-task-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
}

.dd-task-card.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.dd-task-card .dd-task-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-task-card .dd-task-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dd-task-card .dd-task-status-badge {
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 10px;
}

.dd-task-status-badge.completed {
    background: #d1fae5;
    color: #059669;
}

.dd-task-status-badge.generating {
    background: #fef3c7;
    color: #d97706;
}

.dd-task-status-badge.failed {
    background: #fee2e2;
    color: #dc2626;
}

.dd-task-status-badge.pending {
    background: #f3f4f6;
    color: #6b7280;
}

/* ===== 右栏子任务 ===== */
.dd-subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #4b5563;
}

.dd-subtask-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.dd-subtask-icon.completed {
    background: #d1fae5;
    color: #059669;
}

.dd-subtask-icon.in_progress {
    background: #fef3c7;
    color: #d97706;
    animation: dd-spin 1s linear infinite;
}

.dd-subtask-icon.pending {
    background: #f3f4f6;
    color: #9ca3af;
}

@keyframes dd-spin {
    to { transform: rotate(360deg); }
}

/* 右栏报告输出物 */
.dd-report-output {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 8px;
}

.dd-report-output .dd-report-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 8px;
}

.dd-report-output .dd-report-actions {
    display: flex;
    gap: 8px;
}

.dd-report-output .dd-report-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
    color: #374151;
}

.dd-report-output .dd-report-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.dd-report-output .dd-report-btn.primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.dd-report-output .dd-report-btn.primary:hover {
    background: #2563eb;
}

/* ===== 企业搜索结果卡片 ===== */
.dd-search-result-card {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.dd-search-result-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
}

.dd-search-result-card .dd-org-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.dd-search-result-card .dd-org-info {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.dd-search-result-card .dd-org-select-btn {
    margin-top: 8px;
    padding: 6px 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* ===== 滚动条 ===== */
.dd-workbench ::-webkit-scrollbar {
    width: 6px;
}

.dd-workbench ::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dd-workbench ::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== 隐藏文件输入 ===== */
.dd-file-input-hidden {
    display: none;
}

/* ===== 欢迎页 ===== */
.dd-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px 24px;
    animation: dd-fade-in 0.5s ease-in-out;
}

/* Hero 区域 */
.dd-welcome-hero {
    text-align: center;
    margin-bottom: 36px;
}

.dd-welcome-logo {
    height: 64px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 16px;
    display: block;
}

.dd-welcome-title {
    font-size: 26px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px;
    letter-spacing: 1px;
}

.dd-welcome-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* 功能卡片 */
.dd-welcome-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 720px;
    width: 100%;
    margin-bottom: 36px;
}

.dd-feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 14px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dd-feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: #bfdbfe;
}

.dd-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
}

.dd-feature-name {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
}

.dd-feature-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

/* 输入要求 */
.dd-welcome-requirements {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 24px;
    max-width: 560px;
    width: 100%;
    margin-bottom: 28px;
}

.dd-req-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dd-req-title i {
    color: #3b82f6;
}

.dd-req-items {
    display: flex;
    gap: 24px;
}

.dd-req-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.dd-req-item > i {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    background: #f0fdf4;
    color: #16a34a;
}

.dd-req-item:nth-child(2) > i {
    background: #fffbeb;
    color: #d97706;
}

.dd-req-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 2px;
}

.dd-req-hint {
    font-size: 12px;
    color: #94a3b8;
}

/* 底部提示 */
.dd-welcome-hint {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: dd-bounce 2s ease-in-out infinite;
}

@keyframes dd-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* 响应式：窄屏功能卡片 2x2 */
@media (max-width: 640px) {
    .dd-welcome-features {
        grid-template-columns: repeat(2, 1fr);
    }
    .dd-req-items {
        flex-direction: column;
        gap: 12px;
    }
}
