/* 标书编制系统 - 全局样式 (参照云境标书AI设计) */

:root {
    --primary: #4f6ef7;
    --primary-dark: #3b5bdb;
    --primary-light: #e8ecff;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success: #00b884;
    --success-light: #e6f9f3;
    --warning: #f59f00;
    --warning-light: #fff9e6;
    --danger: #fa5252;
    --danger-light: #fff0f0;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --toolbar-width: 300px;
    --nav-height: 56px;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--gray-50);
    font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--gray-800);
    margin: 0;
    padding: 0;
}

/* ===== 导航栏 ===== */
.main-nav {
    background: linear-gradient(135deg, #4f6ef7 0%, #7c5cbf 100%);
    box-shadow: 0 2px 12px rgba(79, 110, 247, 0.2);
    height: var(--nav-height);
    padding: 0;
}

.main-nav .navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none;
}

.main-nav .navbar-brand .brand-logo {
    flex-shrink: 0;
    height: 34px;
    width: auto;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    background: #fff;
    padding: 2px;
}

.hero-section .brand-logo {
    height: 42px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #fff;
    padding: 3px;
}

.nav-link-custom {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-link-custom:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15);
}

/* ===== 通用卡片 ===== */
.card {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s, transform 0.15s;
    background: #fff;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.875rem 1.25rem;
    border-radius: 10px 10px 0 0 !important;
}

/* ===== 首页 - 三步引导 ===== */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    color: #fff;
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
}

.hero-section p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
    position: relative;
}

.hero-section .btn-hero {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    padding: 0.625rem 2rem;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    position: relative;
}

.hero-section .btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 三步流程 */
.steps-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-card {
    flex: 1;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.step-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 110, 247, 0.12);
    transform: translateY(-2px);
}

.step-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.step-card .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.step-card .step-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.step-card h6 {
    font-weight: 700;
    margin-bottom: 0.375rem;
    color: var(--gray-800);
}

.step-card p {
    font-size: 0.825rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.6;
}

.step-card .step-arrow {
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-300);
    font-size: 1.5rem;
    z-index: 1;
}

/* 统计卡片 */
.stat-card {
    border-left: 4px solid var(--primary);
    padding: 1.25rem;
    background: #fff;
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.825rem;
    margin-top: 0.25rem;
}

/* 项目卡片 */
.project-card {
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-200);
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.project-card .card-body {
    padding: 1.25rem;
}

/* 状态徽章 */
.badge-draft { background-color: var(--gray-200); color: var(--gray-600); padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; }
.badge-writing { background-color: var(--primary-light); color: var(--primary-dark); padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; }
.badge-reviewing { background-color: var(--warning-light); color: var(--warning); padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; }
.badge-completed { background-color: var(--success-light); color: var(--success); padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; }

/* 按钮 */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 500;
}

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

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

.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    font-weight: 500;
}

.btn-gradient:hover {
    opacity: 0.9;
    color: #fff;
}

/* 进度条 */
.progress {
    height: 6px;
    border-radius: 3px;
    background-color: var(--gray-200);
}

.progress-bar {
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ===== 三栏编辑器布局 ===== */
.editor-layout {
    display: flex;
    height: calc(100vh - var(--nav-height) - 32px);
    gap: 0;
    background: var(--gray-100);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

/* 左栏 - 目录树 */
.sidebar-left {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
}

.sidebar-header h6 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-700);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* 目录树样式 */
.chapter-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-tree .chapter-group {
    margin-bottom: 0.25rem;
}

.chapter-tree .group-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.625rem 0.5rem 0.375rem;
}

.chapter-tree .chapter-node {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.625rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.chapter-tree .chapter-node:hover {
    background: var(--gray-100);
}

.chapter-tree .chapter-node.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
    font-weight: 600;
}

.chapter-tree .chapter-node.completed .chapter-icon {
    color: var(--success);
}

.chapter-tree .chapter-node.pending .chapter-icon {
    color: var(--gray-300);
}

.chapter-tree .chapter-node .chapter-icon {
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.chapter-tree .chapter-node .chapter-checkbox {
    margin-right: 0.5rem;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.chapter-tree .chapter-node.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.chapter-tree .chapter-node .chapter-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.chapter-tree .chapter-node .chapter-text:hover {
    text-decoration: underline;
}

.sidebar-header .form-check-inline .form-check-label {
    font-size: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.chapter-tree .chapter-node .word-count {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-left: 0.375rem;
}

/* 中栏 - 编辑区 */
.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.editor-main-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    min-height: 52px;
}

.editor-main-header .chapter-title-display {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.editor-main-header .chapter-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* 编辑器工具栏 */
.editor-toolbar {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.375rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.editor-toolbar button {
    border: none;
    background: transparent;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.editor-toolbar button:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.editor-toolbar .toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--gray-300);
    margin: 0 0.25rem;
}

/* 编辑器内容区 */
.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    font-size: 0.95rem;
    line-height: 1.9;
    outline: none;
    color: var(--gray-800);
}

.editor-content:focus {
    outline: none;
}

.editor-content h1 { font-size: 1.5rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.editor-content h2 { font-size: 1.25rem; font-weight: 700; margin: 0.875rem 0 0.5rem; }
.editor-content h3 { font-size: 1.1rem; font-weight: 600; margin: 0.75rem 0 0.5rem; }
.editor-content p { margin: 0.5rem 0; }
.editor-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; }
.editor-content th, .editor-content td { border: 1px solid var(--gray-300); padding: 0.5rem 0.75rem; }
.editor-content th { background: var(--gray-100); font-weight: 600; }
.editor-content ul, .editor-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }

/* 编辑器空状态 */
.editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-400);
    text-align: center;
    padding: 2rem;
}

.editor-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.editor-empty h5 {
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* 右栏 - 工具面板 */
.sidebar-right {
    width: var(--toolbar-width);
    min-width: var(--toolbar-width);
    background: #fff;
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tool-panel {
    border-bottom: 1px solid var(--gray-200);
}

.tool-panel-header {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.tool-panel-header:hover {
    background: var(--gray-100);
}

.tool-panel-body {
    padding: 0.75rem 1rem;
    font-size: 0.825rem;
}

.tool-panel-body .info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--gray-600);
}

.tool-panel-body .info-row .label {
    color: var(--gray-500);
}

.tool-panel-body .info-row .value {
    font-weight: 500;
    color: var(--gray-700);
}

/* AI生成进度 */
.ai-generate-progress {
    background: var(--primary-light);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.ai-generate-progress .progress-text {
    font-size: 0.75rem;
    color: var(--primary-dark);
    margin-bottom: 0.375rem;
}

/* ===== 招标文件解析报告 ===== */
.parse-report {
    padding: 0.5rem 0;
}

.parse-report .report-section {
    margin-bottom: 1rem;
}

.parse-report .report-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.parse-report .report-section-content {
    font-size: 0.825rem;
    color: var(--gray-600);
    line-height: 1.7;
    padding-left: 1.25rem;
}

.parse-report .risk-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.375rem 0;
    font-size: 0.825rem;
}

.parse-report .risk-item .risk-icon {
    color: var(--danger);
    font-size: 1rem;
    flex-shrink: 0;
}

.parse-report .risk-item.warn .risk-icon {
    color: var(--warning);
}

/* ===== 评审结果 ===== */
.review-card {
    border-radius: 8px;
    padding: 0.875rem;
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
}

.review-card.good { background: var(--success-light); border: 1px solid #80f0c0; }
.review-card.warn { background: var(--warning-light); border: 1px solid #ffd966; }
.review-card.bad { background: var(--danger-light); border: 1px solid #ff9999; }

.score-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto;
}

.score-circle.high { background: var(--success-light); color: var(--success); }
.score-circle.mid { background: var(--warning-light); color: var(--warning); }
.score-circle.low { background: var(--danger-light); color: var(--danger); }

/* ===== AI加载动画 ===== */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-size: 0.825rem;
}

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

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

/* 流式生成动画 */
.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    color: var(--primary);
}

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

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

/* ===== 文件上传区域 ===== */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: var(--gray-50);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone i {
    font-size: 2rem;
    color: var(--gray-400);
}

.upload-zone:hover i {
    color: var(--primary);
}

/* ===== Toast通知 ===== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .steps-container {
        flex-direction: column;
    }
    .step-card .step-arrow {
        display: none;
    }
    .sidebar-left {
        display: none;
    }
    .editor-content {
        padding: 1rem;
    }
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
}

/* ===== 模板库卡片 ===== */
.template-card, .knowledge-card, .feedback-card {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    transition: all 0.15s;
}

.template-card:hover, .knowledge-card:hover, .feedback-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 110, 247, 0.1);
    transform: translateY(-1px);
}

/* ===== 知识库分类卡片 ===== */
.category-card {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: all 0.15s;
}

.category-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.category-card .category-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

/* ===== 工具类 ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}
