/* 技术方案编写工具 - 主样式表 */

/* ===== 基础重置与变量 ===== */
:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --border-color: #d9d9d9;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
    --sidebar-width: 250px;
    --topbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* ===== 屏幕切换 ===== */
.screen {
    display: none;
}

#app-screen {
    display: none;
}

#app-screen.active {
    display: block;
}

#login-screen {
    display: none;
}

#login-screen.active {
    display: flex;
}

/* ===== 登录界面 ===== */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #0a1628 0%, #0d2455 40%, #0a3d7a 70%, #1565c0 100%);
    z-index: 1000;
}

/* 粒子动画画布 */
#login-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* 装饰形状 */
.login-bg-shapes {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.07;
}

.shape-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #40a9ff, transparent);
    top: -200px; left: -150px;
    animation: shapeFloat 8s ease-in-out infinite;
}

.shape-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #1890ff, transparent);
    bottom: -100px; right: 30%;
    animation: shapeFloat 10s ease-in-out infinite reverse;
}

.shape-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #69c0ff, transparent);
    top: 40%; right: -80px;
    animation: shapeFloat 6s ease-in-out infinite;
}

@keyframes shapeFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

/* ===== 左侧品牌区 ===== */
.login-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 80px;
    position: relative;
    z-index: 1;
    color: white;
}

.brand-logo-wrap {
    margin-bottom: 32px;
}

.brand-logo {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(64, 169, 255, 0.8));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(64, 169, 255, 0.8)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 35px rgba(64, 169, 255, 1)); transform: scale(1.05); }
}

.brand-text h2 {
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.brand-text p {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 48px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255,255,255,0.13);
    transform: translateX(6px);
    border-color: rgba(64,169,255,0.4);
}

.feature-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
}

/* ===== 右侧登录面板 ===== */
.login-panel {
    width: 460px;
    min-width: 460px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 48px;
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.04);
    border-left: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
}

.login-card {
    width: 100%;
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
}

.login-card-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-card-logo img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(24,144,255,0.3);
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin-bottom: 6px;
}

.form-subtitle {
    font-size: 13px;
    color: #8c8c8c;
    text-align: center;
    margin-bottom: 28px;
}

.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    text-align: center;
}

/* ===== 表单 ===== */
.form-content {
    display: none;
}

.form-content.active {
    display: block;
}

.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #4a4a6a;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #eaeaf0;
    border-radius: 10px;
    font-size: 14px;
    color: #1a1a2e;
    background: #f8f9ff;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #1890ff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(24,144,255,0.1);
}

.form-group.focused input {
    border-color: #1890ff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(24,144,255,0.1);
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1890ff, #0050b3);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    letter-spacing: 2px;
    box-shadow: 0 4px 16px rgba(24,144,255,0.4);
}

.btn-login:hover {
    background: linear-gradient(135deg, #40a9ff, #1890ff);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(24,144,255,0.5);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login-arrow {
    font-size: 18px;
    transition: transform 0.3s;
}

.btn-login:hover .btn-login-arrow {
    transform: translateX(4px);
}

/* 修改密码链接 */
.form-toggle {
    text-align: center;
    margin-top: 16px;
}

.form-toggle a {
    color: #1890ff;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.form-toggle a:hover {
    color: #40a9ff;
    text-decoration: underline;
}

/* ===== 主应用界面 ===== */
#app-screen {
    display: flex;
    min-height: 100vh;
    background: #fff;  /* 覆盖body灰色背景，防止透明露出登录背景 */
}

/* 响应式：移动端隐藏品牌区 */
@media (max-width: 900px) {
    .login-brand { display: none; }
    .login-panel {
        width: 100%;
        min-width: 0;
        border-left: none;
        padding: 40px 24px;
    }
}

/* 通用表单 select 样式（用于主应用界面） */
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* ===== 顶部导航栏 ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #d9d9d9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.logo h2 {
    font-size: 20px;
    color: #1890ff;
    font-weight: 600;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    color: #8c8c8c;
}

/* ===== 主容器 ===== */
.main-container {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--topbar-height));
    width: calc(100% - var(--sidebar-width));
}

/* 窄屏收起左侧边栏时：主容器边距归零 */
@media (max-width: 1200px) {
    html body .main-container {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ===== 主内容区 ===== */
.content {
    overflow-y: auto;
    padding: 15px;
    background: #f5f5f5;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - var(--topbar-height));
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ===== 文档编辑器视图 ===== */
.document-toolbar {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--white);
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.document-container {
    display: flex;
    gap: 15px;
    height: auto;
    padding-left: var(--sidebar-width) !important;
    padding-top: 60px;
    padding-right: 15px;
    min-height: calc(100vh - var(--topbar-height));
    width: 100%;
    box-sizing: border-box;
}

/* ===== 文档结构树 ===== */
.document-outline {
    position: fixed;
    top: calc(var(--topbar-height) + 55px);
    left: var(--sidebar-width);
    width: 220px;
    max-height: calc(100vh - var(--topbar-height) - 70px);
    background: var(--white);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 998;
}

.document-outline h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.outline-tree {
    font-size: 13px;
}

.outline-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
    margin-bottom: 4px;
}

.outline-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.outline-item.active {
    background: var(--primary-color);
    color: var(--white);
}

.expand-icon {
    margin-right: 8px;
    font-size: 10px;
}

/* ===== 文档编辑器区域 ===== */
.document-editor-area {
    flex: 1;
    display: flex;
    gap: 20px;
    overflow: hidden;
    min-width: 0; /* 防止flex子项溢出 */
}

.editor-container {
    flex: 1;
    background: var(--white);
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
    overflow: visible;
    max-width: none;
    height: auto;
    min-width: 0; /* 允许收缩 */
}

/* ===== 文档标题区域 ===== */
.doc-title-section {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.doc-main-title {
    width: 100%;
    max-width: 600px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    padding: 10px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
}

.doc-subtitle-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.doc-title-input {
    width: 100%;
    max-width: 600px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.doc-title-input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

.doc-subtitle-input {
    width: 100%;
    max-width: 500px;
    font-size: 18px;
    text-align: center;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.doc-subtitle-input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

/* ===== 编辑器区块 ===== */
.editor-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.section-content {
    padding-left: 20px;
}

.subsection {
    margin-bottom: 24px;
}

.subsection h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* 小节标题行（带按钮） */
.subsection-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}
.subsection-header-row h3,
.subsection-header-row h4 {
    margin: 0;
    flex-shrink: 0;
}

/* 小小节（4.3.1 / 4.3.2） */
.subsection-sub {
    margin-bottom: 16px;
}
.subsection-sub h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* 物料参数表 - 参数值单元格 */
.material-params-table td input[type="text"],
.material-params-table td select {
    width: 100%;
    min-width: 80px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 13px;
}
.material-param-select {
    width: 100%;
    min-width: 80px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 3px 4px;
    font-size: 13px;
}

/* 备品备件表 */
.spare-parts-table {
    table-layout: fixed;
}

.spare-parts-table input[type="text"] {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 13px;
}

/* btn-outline */
.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ===== 封面信息 ===== */
.cover-form {
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
}

.cover-form-two-col {
    display: flex;
    gap: 30px;
}

.cover-col {
    flex: 1;
}

.cover-field-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #e8e8e8;
}

.cover-field-group .input-normal {
    flex: 1;
    min-width: 0;
}

.field-label {
    min-width: 90px;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 8px;
    white-space: nowrap;
}

.field-hint {
    margin-left: 12px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* 标签颜色样式 */
.label-red {
    color: #ff4d4f;
    background: rgba(255, 77, 79, 0.1);
    border-left: 3px solid #ff4d4f;
}

.label-yellow {
    color: #faad14;
    background: rgba(250, 173, 20, 0.1);
    border-left: 3px solid #faad14;
}

.label-green {
    color: #52c41a;
    background: rgba(82, 196, 26, 0.1);
    border-left: 3px solid #52c41a;
}

.label-blue {
    color: #1890ff;
    background: rgba(24, 144, 255, 0.1);
    border-left: 3px solid #1890ff;
}

/* 字段提示样式 */
.field-hint.label-red {
    background: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
}

.field-hint.label-yellow {
    background: rgba(250, 173, 20, 0.1);
    color: #faad14;
}

.field-hint.label-green {
    background: rgba(82, 196, 26, 0.1);
    color: #52c41a;
}

.field-hint.label-blue {
    background: rgba(24, 144, 255, 0.1);
    color: #1890ff;
}

/* 封面图例说明 */
.cover-legend {
    margin-top: 30px;
    padding: 20px;
    background: #f0f5ff;
    border-radius: 8px;
    border: 1px solid #91caff;
}

.cover-legend h4 {
    margin-bottom: 16px;
    color: #1890ff;
    font-size: 16px;
}

.cover-legend ul {
    list-style: none;
    padding: 0;
}

.cover-legend li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.legend-box.label-red {
    background: rgba(255, 77, 79, 0.2);
    border: 2px solid #ff4d4f;
}

.legend-box.label-yellow {
    background: rgba(250, 173, 20, 0.2);
    border: 2px solid #faad14;
}

.legend-box.label-green {
    background: rgba(82, 196, 26, 0.2);
    border: 2px solid #52c41a;
}

.legend-box.label-blue {
    background: rgba(24, 144, 255, 0.2);
    border: 2px solid #1890ff;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-row label {
    min-width: 100px;
    font-weight: 500;
}

/* ===== 表格容器 ===== */
.table-container {
    margin-top: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    text-align: left;
}

.data-table th {
    background: var(--bg-color);
    font-weight: 600;
}

.data-table td input,
.data-table td select {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px;
}

.data-table td input:focus,
.data-table td select:focus {
    outline: none;
    background: var(--white);
    border: 1px solid var(--primary-color);
    border-radius: 2px;
}

/* 设备参数表格 - 两列等宽 */
.equip-param-table th,
.equip-param-table td {
    width: 50% !important;
}

/* ===== 列表只读文本 ===== */
.display-text {
    display: inline-block;
    padding: 4px 8px;
    min-height: 24px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ===== 目录预览 ===== */
.toc-preview {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 4px;
    min-height: 100px;
}

.hint-text {
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* ===== 快速引用面板 ===== */
.property-panel {
    width: 180px;
    background: var(--white);
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow);
    overflow-y: auto;
    flex-shrink: 0;
    height: fit-content;
}

.property-panel h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.quick-insert {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.insert-section h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-swatch:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* ===== 视图头部 ===== */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.view-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ===== 文档网格 ===== */
.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.doc-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.doc-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.doc-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.doc-card-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.doc-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===== 库管理视图 ===== */
.library-content {
    background: var(--white);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
}

/* ===== 设置视图 ===== */
.settings-content {
    background: var(--white);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.settings-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.setting-item label {
    min-width: 150px;
    font-weight: 500;
}

/* ===== 预览模态框 - 网页全屏 ===== */
#preview-modal.modal {
    background: #e5e5e5;
}

#preview-modal .modal-content {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
    padding: 0;
    background: #e5e5e5;
    display: flex;
    flex-direction: column;
}

.preview-modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-modal-content .modal-header {
    flex-shrink: 0;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-container {
    flex: 1;
    overflow-y: auto;
    background: #e5e5e5;
    padding: 30px 20px 50px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.preview-document {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

/* A4预览页面 - 标准A4尺寸 210mm × 297mm */
.preview-page {
    width: 210mm;
    height: 297mm;
    padding: 20mm 25mm;
    background: #fff;
    position: relative;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    overflow: hidden;
}

/* 页眉样式 - 按照模板格式 */
.preview-header {
    position: absolute;
    top: 15mm;
    left: 25mm;
    right: 25mm;
    font-family: 'SimSun', serif;
    font-size: 10pt;
    color: #333;
    border-bottom: 1px solid #333;
    padding-bottom: 2mm;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    min-height: 18px;
}

.header-row-1 {
    margin-bottom: 2px;
}

.header-row-2 {
    margin-bottom: 2px;
}

.header-row-3 {
    margin-bottom: 0;
}

.header-left {
    text-align: left;
    flex: 1;
    line-height: 1.2;
}

.header-right {
    text-align: right;
    position: relative;
}

/* 页眉logo图片样式 - 使用绝对定位不影响行高 */
.header-logo-img {
    height: 50px;
    width: auto;
    position: absolute;
    right: 0;
    top: -15px;
}

/* 页眉内容样式 */
.header-doc-type {
    font-weight: bold;
    font-size: 11pt;
    color: #000;
}

.header-doc-number {
    font-size: 10pt;
    color: #333;
}

.header-project {
    font-size: 10pt;
    color: #333;
}

.header-seller {
    font-size: 10pt;
    color: #333;
}

/* 未填写占位符样式 */
.unfilled {
    color: #bbb;
    font-style: italic;
}

.unfilled-text {
    color: #bbb;
    font-style: italic;
}

/* 页脚样式 */
.preview-footer {
    position: absolute;
    bottom: 15mm;
    left: 25mm;
    right: 25mm;
    height: 12mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'SimSun', serif;
    font-size: 10pt;
    color: #333;
    border-top: 1px solid #ccc;
    padding-top: 3mm;
}

.preview-footer-left {
    text-align: left;
    flex: 1;
}

.preview-footer-center {
    text-align: center;
    flex: 1;
}

.preview-footer-right {
    text-align: right;
    flex: 1;
}

.preview-footer-parties {
    font-size: 10pt;
}

.preview-footer-page-num {
    font-size: 10pt;
    color: #333;
}

/* 预览封面样式 - 按照模板格式 */
.preview-cover-template {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: calc(297mm - 45mm - 30mm);
    box-sizing: border-box;
    position: relative;
}

/* 封面上半部分：内容居中 */
.cover-main {
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cover-doc-type {
    font-size: 36px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin-bottom: 50px;
}

.cover-doc-number {
    font-size: 32px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin-bottom: 70px;
}

.cover-buyer {
    display: none; /* 删除买方名称单独行 */
}

.cover-project-system {
    font-size: 28px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin-bottom: 30px;
    white-space: nowrap;
}

.cover-date {
    font-size: 18px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin: 40px 0;
}

/* 封面底部：买方卖方在75%位置左对齐 */
.cover-parties {
    position: absolute;
    top: 82%;
    left: 25mm;
    right: 15mm;
    text-align: left;
    padding-left: 0.5em;
}

.party-item {
    font-size: 22px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.party-label {
    display: inline-block;
    min-width: 60px;
    flex-shrink: 0;
}

.party-name {
    display: inline-block;
    min-width: 200px;
    border-bottom: 1px solid #333;
    padding-bottom: 2px;
    margin-left: 10px;
}

/* 预览目录样式 - 适配页眉页脚 */
.preview-toc {
    padding-top: 20mm;
    min-height: calc(297mm - 45mm - 20mm);
}

.toc-title {
    text-align: center;
    font-size: 26px;
    font-weight: bold;
    font-family: 'SimSun', serif;
    margin-bottom: 50px;
    letter-spacing: 0.2em;
}

.toc-list {
    padding-left: 15mm;
    padding-right: 15mm;
}

.toc-item {
    display: flex;
    align-items: baseline;
    font-family: 'SimSun', serif;
    margin-bottom: 18px;
    font-size: 14pt;
}

.toc-item-title {
    color: #333;
    white-space: nowrap;
}

.toc-item-dots {
    flex: 1;
    border-bottom: 1px dotted #666;
    margin: 0 8px 4px 8px;
    min-width: 20px;
}

.toc-item-page {
    color: #333;
    font-size: 14pt;
    min-width: 30px;
    text-align: right;
}

/* 预览章节样式 - 适配页眉页脚 */
.preview-section {
    padding-top: 25mm;
    min-height: calc(297mm - 45mm - 25mm);
}

.preview-section .section-title {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    font-family: 'SimSun', serif;
}

.preview-section .subsection-title {
    font-size: 16px;
    font-weight: bold;
    color: #444;
    margin-top: 20px;
    margin-bottom: 12px;
    font-family: 'SimSun', serif;
}

.preview-section .section-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    text-align: justify;
    margin-bottom: 15px;
    font-family: 'SimSun', serif;
    text-indent: 2em;
}

.preview-section .empty-hint {
    font-size: 14px;
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

/* 打印样式 */
@media print {
    .preview-page {
        box-shadow: none;
        margin: 0;
        page-break-after: always;
    }
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-hover);
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-actions .btn-primary,
.modal-actions .btn-normal {
    padding: 8px 16px;
    font-size: 14px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.search-box {
    margin-bottom: 16px;
}

.library-items {
    max-height: 400px;
    overflow-y: auto;
}

.library-item {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.library-item:hover {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.05);
}

.library-item.selected {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.1);
}

/* ===== 提示消息 ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    background: var(--text-primary);
    color: var(--white);
    border-radius: 4px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* ===== 图片上传区域 ===== */
.image-upload-area {
    margin-top: 12px;
    padding: 30px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.05);
}

.image-upload-area p {
    color: var(--text-secondary);
}

/* ===== 参考资料插入区域 ===== */
.reference-insert {
    margin-bottom: 12px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .property-panel {
        width: 240px;
    }
    
    .document-outline {
        width: 200px;
    }
}

/* ===== 窄屏隐藏侧边栏 ===== */
@media (max-width: 1200px) {
    .sidebar {
        display: none !important;
    }
}

/* 侧边栏收起时的基本样式 */
.sidebar.collapsed {
    display: none !important;
}

/* 文档结构栏样式 */
html body .document-outline.collapsed {
    display: none !important;
}

/* 文档结构栏样式 */

/* 左侧栏展开时，文档结构栏弹出位置需要偏移 */
html body .sidebar:not(.collapsed) ~ .main-container 

/* 左侧栏展开时，覆盖层位置也需要调整 */
html body .sidebar:not(.collapsed) ~ .main-container 

/* 文档结构栏展开时，主内容区域留出空间 */

/* 侧边栏收起且文档结构栏也收起时，内容区域填满宽度 */

/* 侧边栏展开但文档结构栏收起时，内容区域只留侧边栏空间 */

/* 文档结构弹出时的覆盖层 */

/* ===== 标准表格 ===== */
.standard-toolbar {
    margin-bottom: 15px;
}

#standards-table {
    width: 100%;
}

#standards-table th,
#standards-table td {
    text-align: left;
    padding: 10px 12px;
}

/* ===== 标准选择器 ===== */
.standard-picker-layout {
    display: flex;
    gap: 20px;
    height: 400px;
}

.standard-picker-left {
    flex: 1;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.standard-picker-right {
    flex: 1;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.picker-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.picker-actions {
    display: flex;
    gap: 8px;
}

.standard-picker-left input {
    margin-bottom: 10px;
}

.picker-items {
    flex: 1;
    overflow-y: auto;
}

.picker-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.picker-item:hover {
    background: #f5f5f5;
}

.picker-item.selected {
    background: #e6f7ff;
}

.picker-item .item-name {
    flex: 1;
    font-size: 13px;
}

.picker-item .item-code {
    color: #888;
    font-size: 12px;
}

.selected-standards-list {
    flex: 1;
    overflow-y: auto;
}

.selected-standard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.selected-standard-item .std-info {
    flex: 1;
}

.selected-standard-item .std-code {
    color: #888;
    font-size: 12px;
    margin-left: 10px;
}

.selected-standard-item .btn-remove {
    color: #ff4d4f;
    cursor: pointer;
    padding: 4px 8px;
    border: none;
    background: none;
    font-size: 12px;
}

.selected-standard-item .btn-remove:hover {
    text-decoration: underline;
}

/* ===== 模板列表 ===== */
.template-list {
    max-height: 400px;
    overflow-y: auto;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.template-item:hover {
    background: #f5f5f5;
}

.template-item .template-info {
    flex: 1;
}

.template-item .template-name {
    font-weight: 500;
}

.template-item .template-count {
    font-size: 12px;
    color: #888;
}

.template-item .template-actions {
    display: flex;
    gap: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}
