/* 标书智能平台 - 全局基础样式 V5.0「文档沉浸风」
   理念：整个系统 = 一本打开的标书
   纸张底色 · 目录页侧边栏(第X章/X.X节) · 红头双线 · 正本印章 · 衬线公文标题
   兼容：保留 V3.1/V4.0 全部 CSS 变量名与类名 */

/* ===== Design Tokens（设计令牌） ===== */
:root {
    /* 主色：朱砂印泥红 */
    --primary: #b03a2e;
    --primary-dark: #8c2b21;
    --primary-light: #faf0ec;
    --primary-gradient: linear-gradient(135deg, #c0392b 0%, #8e2f23 100%);

    /* 语义色 */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-dark: #047857;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-dark: #b45309;
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-bg: #fef2f2;
    --danger-dark: #b91c1c;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-dark: #1d4ed8;

    /* 中性色：墨 + 金 */
    --navy: #1c2433;
    --accent: #b8860b;
    --purple: #6d5ba8;

    /* 文字：墨色 */
    --text-primary: #26221c;
    --text-secondary: #57503f;
    --text-muted: #a29782;
    --text-white: #fff;

    /* 背景：宣纸 */
    --bg-page: #f6f1e6;
    --bg-card: #fffdf8;
    --bg-muted: #f1ebdd;
    --bg-hover: #faf5ea;
    --border-color: #e6dcc6;

    /* 侧边栏：深蓝布面封面 */
    --sidebar-bg: #232c3e;
    --sidebar-bg-soft: rgba(255, 255, 255, 0.05);
    --sidebar-text: #a8b2c3;
    --sidebar-text-hover: #e9e2d0;
    --sidebar-width: 272px;

    /* 圆角：文档感取小圆角 */
    --radius-xs: 2px;
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-pill: 999px;
    --radius-tag: 3px;

    /* 阴影：暖调纸影 */
    --shadow-xs: 0 1px 2px rgba(96, 74, 36, 0.06);
    --shadow-sm: 0 1px 3px rgba(96, 74, 36, 0.08), 0 1px 2px rgba(96, 74, 36, 0.05);
    --shadow-md: 0 4px 14px rgba(96, 74, 36, 0.10), 0 2px 4px rgba(96, 74, 36, 0.05);
    --shadow-lg: 0 14px 36px rgba(96, 74, 36, 0.14), 0 4px 8px rgba(96, 74, 36, 0.06);
    --shadow-card: var(--shadow-sm);

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* 字体：正文黑体保可读，标题宋体衬线出公文感 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    --font-serif: 'Songti SC', 'STSong', 'SimSun', 'NSimSun', 'STZhongsong', serif;
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 14px;
    --font-md: 15px;
    --font-lg: 16px;
    --font-xl: 18px;
    --font-2xl: 22px;
    --font-3xl: 28px;

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* 正文标题统一用公文衬线 */
h1, h2, h3, .header h1, .card h2, .brand-text strong {
    font-family: var(--font-serif);
    letter-spacing: 0.5px;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-family);
    background: var(--bg-page);
    /* 宣纸细纹（极淡噪点） */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    min-height: 100vh;
    color: var(--text-primary);
    font-size: var(--font-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(176, 58, 46, 0.16); }

/* 细滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6cbb2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b3a685; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 应用壳布局 ===== */
.app {
    display: flex;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

/* ---- 侧边栏：标书封面 + 目录 ---- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, #232c3e 0%, #1b2331 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    /* 装订线 */
    box-shadow: inset -1px 0 0 rgba(201, 162, 75, 0.28), 6px 0 18px rgba(26, 20, 8, 0.22);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 12px;
    border-bottom: 1px solid rgba(201, 162, 75, 0.25);
}
.brand-logo {
    width: 42px; height: 42px;
    border-radius: 5px;
    background: var(--primary-gradient);
    color: #fff;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(140, 43, 33, 0.55);
    flex-shrink: 0;
}
.brand-text { line-height: 1.35; min-width: 0; }
.brand-text strong {
    display: block;
    color: #f0e9d6;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    white-space: nowrap;
}
.brand-text span {
    font-size: 10px;
    color: #8a94a6;
    letter-spacing: 1.6px;
}

/* 导航：标书目录 */
.nav {
    flex: 1;
    padding: 6px 14px 14px;
    display: block;
}
.nav-group { margin-bottom: 4px; }
.nav-group-title {
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 700;
    color: #dcc286;
    letter-spacing: 2.5px;
    padding: 10px 10px 4px;
    user-select: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.nav-group-title::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(201, 162, 75, 0.22);
    transform: translateY(-4px);
}
.nav a {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 4.5px 10px 4.5px 14px;
    margin: 1px 0;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
    white-space: nowrap;
}
.nav a .sec-no {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 12px;
    color: #7d8798;
    min-width: 26px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.nav a:hover {
    background: var(--sidebar-bg-soft);
    color: var(--sidebar-text-hover);
}
.nav a:hover .sec-no { color: #c9a24b; }
.nav a.active {
    background: rgba(176, 58, 46, 0.16);
    color: #f4eddc;
    font-weight: 600;
}
.nav a.active .sec-no { color: #e3c06a; }
.nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: linear-gradient(180deg, #d4af37, #b03a2e);
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(201, 162, 75, 0.22);
    font-size: 11px;
    color: #77808f;
    letter-spacing: 1px;
    text-align: center;
}

/* 移动端遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 190;
    opacity: 0;
    transition: opacity var(--transition);
}

/* ---- 主区域 ---- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---- 顶部页头：红头文件 ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 3px double var(--primary);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.header { min-width: 0; }
.header h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    letter-spacing: 1px;
}
.header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* 正本印章水印 */
.seal-original {
    margin-left: auto;
    flex-shrink: 0;
    width: 74px; height: 74px;
    border: 2.5px solid rgba(176, 58, 46, 0.32);
    border-radius: 50%;
    color: rgba(176, 58, 46, 0.36);
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-14deg);
    user-select: none;
    position: relative;
}
.seal-original::before {
    content: '★';
    position: absolute;
    top: 7px;
    font-size: 9px;
    letter-spacing: 0;
}

/* 汉堡按钮（仅移动端显示） */
.nav-toggle {
    display: none;
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    width: 38px; height: 38px;
    border-radius: 9px;
    font-size: 17px;
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}
.nav-toggle:hover { background: var(--primary-light); color: var(--primary); }

/* ---- 内容区 ---- */
.content {
    flex: 1;
    padding: 26px 32px 20px;
    animation: contentIn 0.25s ease;
    display: flex;
    flex-direction: column;
}
.content .container { flex: 1; }
@keyframes contentIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* 节次页脚：- 第 3.1 节 - */
.doc-footer {
    text-align: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 26px 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    user-select: none;
}
.doc-footer::before, .doc-footer::after {
    content: '';
    width: 64px;
    border-top: 1px solid var(--border-color);
}

/* ---- 面包屑 ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    font-size: var(--font-sm);
    color: var(--text-muted);
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 2px; color: #cfc5ab; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

/* ---- 响应式 ---- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        box-shadow: none;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-overlay { display: block; pointer-events: none; }
    body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .nav-toggle { display: inline-flex; }
    .topbar { padding: 12px 18px; }
    .content { padding: 18px 16px 40px; }
}

@media (max-width: 768px) {
    .card { padding: 15px; }
    .header h1 { font-size: 17px; }
    .header p { font-size: 12px; }
}

@media (max-width: 480px) {
    .header p { display: none; }
    .seal-original { display: none; }
}

@media print {
    .sidebar, .topbar, .nav-toggle, .sidebar-overlay, .doc-footer { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
}
