﻿:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --bg: #f3f4f6;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --sidebar-w: 230px;   /* 侧边栏宽度（桌面可拖拽自由调宽） */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 本地字体：英文优先使用自托管 Inter（拉丁字符），不依赖外部 CDN */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/Scripts/lib/fonts/inter-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/Scripts/lib/fonts/inter-600.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+2000-206F;
}

/* 什么语言用什么字体：按 body[data-lang] 切换字体栈（均为本机/自托管字体） */
html[data-lang="EnUs"] body,
body[data-lang="EnUs"] { font-family: "Inter", "Segoe UI", system-ui, sans-serif; }
body[data-lang="ZhCn"] { font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif; }
body[data-lang="ZhTw"] { font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", system-ui, sans-serif; }
body[data-lang="JaJp"] { font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif; }

body { font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--text); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
    overflow-y: auto; padding: 16px 10px; z-index: 160;
    transition: width .25s ease, transform .25s ease;
}
.brand { font-size: 15px; font-weight: 700; color: #fff; padding: 6px 12px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 14px; }
.menu { flex: 1; }
.menu-item {
    display: flex; align-items: center; gap: 8px; color: var(--sidebar-text);
    padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; font-size: 14px;
}
.menu-item:hover, .menu-item.active { background: rgba(255,255,255,.12); color: #fff; }
.menu-group-label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; opacity: .9; }
.menu-group-children { margin-left: 16px; }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; transition: margin-left .25s ease; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--card-bg); border-bottom: 1px solid var(--border);
    padding: 12px 24px; height: 56px; position: sticky; top: 0; z-index: 50;
}
.lang-switcher { display: flex; gap: 6px; }
.lang-btn {
    border: 1px solid var(--border); background: #fff; color: var(--text);
    border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
.lang-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-name { font-size: 14px; color: var(--text-muted); }
.link { color: var(--primary); }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 14px; }

.content { padding: 24px; }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }

.btn {
    border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer;
    font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
    background: var(--primary); color: #fff; transition: .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); color: #fff; }
.btn.warning { background: var(--warning); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f9fafb; font-weight: 600; color: var(--text-muted); }
tr:hover td { background: #f9fafb; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.badge.draft { background: #f3f4f6; color: #374151; }
.badge.submitted { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.public { background: #e0e7ff; color: #3730a3; }
.badge.private { background: #fae8ff; color: #86198f; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; color: var(--text-muted); }
.form-field input, .form-field select, .form-field textarea {
    border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--primary); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 14px; }

.pagination { display: flex; gap: 12px; align-items: center; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }
.pagination .pager-info { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.pagination .pager-btns { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination .pager-curr { padding: 0 6px; font-size: 13px; color: #374151; white-space: nowrap; }
.pagination .pager-size select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 640px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #111827; color: #fff; padding: 12px 22px; border-radius: 8px; z-index: 300; font-size: 14px;
}
.toast.hidden { display: none; }

/* 时间线容器 */
.timeline-container, .calendar-container, .compare-container { min-height: 400px; }

.login-card { max-width: 400px; margin: 80px auto; }
.hero { padding: 40px 20px; text-align: center; }
.hero h1 { font-size: 28px; margin-bottom: 12px; }
.hero p { color: var(--text-muted); }

/* ---------- 侧边栏：折叠 / 抽屉 / 拖拽调宽（多终端自适应） ---------- */
/* 折叠为图标栏（桌面）：仅图标、文字隐藏、宽度收紧 */
body.sidebar-collapsed { --sidebar-w: 64px; }
body.sidebar-collapsed .brand,
body.sidebar-collapsed .menu-item > span,
body.sidebar-collapsed .menu-group-label > span { display: none; }
body.sidebar-collapsed .menu-item,
body.sidebar-collapsed .menu-group-label { justify-content: center; }
body.sidebar-collapsed .menu-group-children { margin-left: 0; }

/* 顶栏折叠/抽屉按钮 */
.sidebar-toggle {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    width: 34px; height: 34px; font-size: 16px; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.sidebar-toggle:hover { background: #f3f4f6; }
.topbar-left { display: flex; align-items: center; gap: 10px; }

/* 桌面：拖拽调宽手柄（位于侧边栏右缘） */
.sidebar-resizer {
    position: fixed; top: 0; bottom: 0; left: calc(var(--sidebar-w) - 5px); width: 10px;
    cursor: col-resize; z-index: 115; display: none;
}
@media (min-width: 900px) { .sidebar-resizer { display: block; } }
.sidebar.resizing, .sidebar.resizing ~ .main { transition: none !important; }

/* 移动端抽屉遮罩 */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150; display: none; }
.sidebar-backdrop.show { display: block; }

/* 移动端（≤899px）：侧边栏变抽屉，主区占满全宽 */
@media (max-width: 899px) {
    .sidebar {
        width: min(280px, 85vw) !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: none;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 24px rgba(0,0,0,.25); }
    .sidebar-resizer { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 16px 12px; }
    .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .form-grid { grid-template-columns: 1fr; }
    .card { overflow-x: auto; }
    .modal { width: 94vw; }
    .toolbar { gap: 8px; }
}

/* 底部备案号（每个页面底部） */
.site-footer {
    padding: 14px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-2, #6b7280);
    border-top: 1px solid var(--border);
    line-height: 1.6;
}
.site-footer a {
    color: inherit;
    text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }
