/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --bg: #f0f4f9;
    --card: #ffffff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ========== 导航 ========== */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    z-index: 100;
    position: relative;
}

.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo { font-size: 24px; }
.nav-title { font-size: 18px; font-weight: 600; color: var(--primary); }
.nav-status { display: flex; align-items: center; gap: 12px; }

/* ========== 布局 ========== */
.app-container {
    display: flex;
    height: calc(100vh - 56px);
}

.sidebar {
    width: 280px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* ========== 侧边栏 ========== */
.sidebar-section { padding: 16px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--border); }
.sidebar-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.project-list { max-height: 300px; overflow-y: auto; }
.project-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.project-item:hover { background: #e8f0fe; }
.project-item.active { background: #e8f0fe; border-left: 3px solid var(--primary); }
.project-item-name { font-size: 14px; font-weight: 500; }
.project-item-status { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.project-item-date { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.agent-list { display: flex; flex-direction: column; gap: 8px; }
.agent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: #f8f9fa;
    font-size: 13px;
}
.agent-icon { font-size: 20px; }
.agent-info { flex: 1; }
.agent-name { font-weight: 500; }
.agent-role { font-size: 11px; color: var(--text-secondary); }
.agent-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #dadce0;
}
.agent-status-dot.active { background: var(--success); }
.agent-status-dot.busy { background: var(--warning); }

/* ========== 视图 ========== */
.view { display: none; }
.view.active { display: block; }

/* ========== 欢迎页 ========== */
.welcome {
    text-align: center;
    padding: 60px 20px;
    max-width: 800px;
    margin: 0 auto;
}
.welcome-icon { font-size: 64px; margin-bottom: 20px; }
.welcome h1 { font-size: 32px; color: var(--primary); margin-bottom: 8px; }
.welcome-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 16px; }
.welcome p { font-size: 15px; color: var(--text-secondary); margin-bottom: 40px; }

.workflow-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--card);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.step-icon { font-size: 28px; }
.step span:not(.step-icon) { font-size: 14px; font-weight: 500; }
.step small { font-size: 11px; color: var(--text-secondary); }
.step-arrow { font-size: 20px; color: var(--text-secondary); }

/* ========== 项目头部 ========== */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.project-header h2 { font-size: 24px; margin-bottom: 8px; }
.project-actions { display: flex; gap: 8px; }

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ========== 卡片 ========== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ========== 状态徽章 ========== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-draft { background: #f1f3f4; color: var(--text-secondary); }
.status-analyzing { background: #e8f0fe; color: var(--primary); }
.status-writing { background: #fef7e0; color: #e37400; }
.status-completed { background: #e6f4ea; color: var(--success); }
.status-failed { background: #fce8e6; color: var(--danger); }
.status-offline { background: #f1f3f4; color: var(--text-secondary); }
.status-online { background: #e6f4ea; color: var(--success); }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:hover { background: #f1f3f4; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #2d8f47; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #d33426; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,115,232,0.2); }
textarea.form-control { resize: vertical; min-height: 60px; font-family: inherit; }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-lg { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: #f1f3f4; }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ========== 分析结果 ========== */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.analysis-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: var(--radius);
}
.analysis-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 4px; }
.analysis-value { font-size: 14px; font-weight: 500; }

.criteria-bar {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.criteria-bar-label { width: 100px; font-size: 13px; }
.criteria-bar-track {
    flex: 1; height: 8px; background: #f1f3f4; border-radius: 4px; overflow: hidden;
}
.criteria-bar-fill {
    height: 100%; border-radius: 4px; transition: width 0.5s;
}
.criteria-bar-value { font-size: 12px; color: var(--text-secondary); width: 40px; text-align: right; }

/* ========== 大纲 ========== */
.outline-chapter {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
}
.outline-chapter-header {
    padding: 12px 16px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.outline-chapter-body { padding: 8px 16px 12px 36px; }
.outline-section {
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== 章节内容 ========== */
.section-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.section-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.section-header:hover { background: #f8f9fa; }
.section-title { font-size: 14px; font-weight: 600; }
.section-writer { font-size: 11px; color: var(--text-secondary); }
.section-body { padding: 16px; display: none; }
.section-body.expanded { display: block; }
.section-content { white-space: pre-wrap; font-size: 13px; line-height: 1.8; color: #3c4043; }

/* ========== 审核 ========== */
.review-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.review-rating {
    font-size: 36px;
    font-weight: 700;
}
.review-rating.excellent { color: var(--success); }
.review-rating.good { color: var(--primary); }
.review-rating.fair { color: var(--warning); }
.review-rating.poor { color: var(--danger); }

.issue-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-left: 3px solid;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.issue-item.high { border-color: var(--danger); }
.issue-item.medium { border-color: var(--warning); }
.issue-item.low { border-color: var(--success); }
.issue-severity {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    height: fit-content;
}
.issue-item.high .issue-severity { background: #fce8e6; color: var(--danger); }
.issue-item.medium .issue-severity { background: #fef7e0; color: #e37400; }
.issue-item.low .issue-severity { background: #e6f4ea; color: var(--success); }

/* ========== 工作流 ========== */
.workflow-timeline { position: relative; padding-left: 30px; }
.workflow-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.workflow-stage {
    position: relative;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.workflow-stage::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--card);
}
.workflow-stage.completed { border-color: var(--success); }
.workflow-stage.completed::before { background: var(--success); }
.workflow-stage.running { border-color: var(--primary); background: #e8f0fe; }
.workflow-stage.running::before { background: var(--primary); animation: pulse 1.5s infinite; }
.workflow-stage.pending { opacity: 0.7; }

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

/* ========== 其他 ========== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); font-size: 14px; }
.text-muted { color: var(--text-secondary); font-size: 13px; }
.content-preview { white-space: pre-wrap; font-size: 14px; line-height: 1.8; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.6;
}
.alert-info { background: #e8f0fe; color: var(--primary); }

/* ========== 进度条 ========== */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #f1f3f4;
    border-radius: 10px;
    overflow: hidden;
    margin: 12px 0;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #4285f4);
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    font-weight: 500;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }
