/* ============================================================
   NovelForge 深色主题样式（Obsidian / Notion 风格）
   ============================================================ */
:root {
    --bg:        #1e1e2e;
    --bg-2:      #181825;
    --surface:   #313244;
    --surface-2: #45475a;
    --border:    #45475a;
    --text:      #cdd6f4;
    --text-dim:  #9399b2;
    --text-mute: #6c7086;
    --primary:   #cba6f7;
    --primary-d: #a6e3a1;
    --accent:    #89b4fa;
    --danger:    #f38ba8;
    --warning:   #f9e2af;
    --info:      #94e2d5;
    --radius:    10px;
    --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }

/* ===== 按钮 ===== */
.nf-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; font-size: 13px;
    transition: all .15s; line-height: 1.4;
}
.nf-btn:hover { border-color: var(--primary); color: var(--text); }
.nf-btn-primary { background: var(--primary); color: var(--bg-2); border-color: var(--primary); font-weight: 600; }
.nf-btn-primary:hover { background: #b48bf2; color: var(--bg-2); }
.nf-btn-danger { background: var(--danger); color: #1a1a2a; border-color: var(--danger); font-weight: 600; }
.nf-btn-ghost { background: transparent; }
.nf-btn-sm { padding: 4px 10px; font-size: 12px; }
.nf-btn-block { width: 100%; justify-content: center; }

/* ===== 认证页 ===== */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-2); }
.auth-wrap { width: 100%; max-width: 400px; padding: 24px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; justify-content: center; }
.auth-logo { width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: var(--bg-2); display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.auth-title { font-size: 20px; font-weight: 700; }
.auth-subtitle { color: var(--text-dim); font-size: 12px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.auth-card-title { margin: 0 0 4px; font-size: 20px; }
.auth-card-sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.auth-form .nf-field { display: block; margin-bottom: 14px; }
.auth-form .nf-field > span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-dim); }
.nf-check { display: flex; align-items: center; gap: 8px; margin: 6px 0 16px; font-size: 13px; color: var(--text-dim); }
.auth-hint { text-align: center; color: var(--text-mute); font-size: 12px; margin: 18px 0 0; }

/* ===== 表单通用 ===== */
.nf-field { display: block; margin-bottom: 14px; }
.nf-field > span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-dim); }
input, textarea, select {
    width: 100%; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-2);
    color: var(--text); font-size: 13px; font-family: inherit;
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; }
label.nf-check input { width: auto; }

/* ===== 主布局 ===== */
.nf-app { display: flex; min-height: 100vh; }
.nf-sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: var(--bg-2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    overflow-y: auto; padding: 16px 0;
}
.nf-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 18px 16px; }
.nf-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: var(--bg-2); display: grid; place-items: center; font-weight: 800; }
.nf-brand-name { font-weight: 700; }
.nf-nav { display: flex; flex-direction: column; padding: 0 8px; }
.nf-nav-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px; color: var(--text-dim);
    font-size: 13px; margin-bottom: 2px;
}
.nf-nav-item:hover { background: var(--surface); color: var(--text); }
.nf-nav-item.is-active { background: var(--surface); color: var(--primary); font-weight: 600; }
.nf-ico { width: 16px; text-align: center; opacity: .8; }
.nf-nav-project { padding: 12px 12px 4px; color: var(--text-mute); font-size: 11px; letter-spacing: .5px; display: flex; gap: 8px; align-items: center; }
.nf-nav-divider { height: 1px; background: var(--border); margin: 10px 12px; }

.nf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nf-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; border-bottom: 1px solid var(--border);
    background: var(--bg-2); position: sticky; top: 0; z-index: 20;
}
.nf-menu-btn { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.nf-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.nf-crumb { color: var(--text-dim); }
.nf-crumb:hover { color: var(--text); }
.nf-crumb-sep { color: var(--text-mute); }
.nf-crumb-current { color: var(--text); }
.nf-topbar-right { margin-left: auto; font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.nf-badge-admin { background: var(--primary); color: var(--bg-2); font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.nf-content { padding: 24px; flex: 1; }

/* 折叠侧栏 */
body.nf-collapsed .nf-sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

/* ===== 卡片 / 区块 ===== */
.nf-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.nf-card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.nf-page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.nf-page-title { font-size: 20px; font-weight: 700; margin: 0; }
.nf-page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.nf-section-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.nf-muted { color: var(--text-dim); font-size: 12px; }
.nf-stat { display: flex; flex-direction: column; gap: 4px; }
.nf-stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.nf-stat-label { font-size: 12px; color: var(--text-dim); }
.nf-stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 24px; }

/* ===== 表格 / 列表 ===== */
.nf-table { width: 100%; border-collapse: collapse; }
.nf-table th, .nf-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.nf-table th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.nf-table tr:hover td { background: var(--surface); }

/* ===== 徽标 ===== */
.nf-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.nf-badge-success { background: rgba(166,227,161,.15); color: var(--primary-d); }
.nf-badge-info { background: rgba(137,180,250,.15); color: var(--accent); }
.nf-badge-warning { background: rgba(249,226,175,.15); color: var(--warning); }
.nf-badge-danger { background: rgba(243,139,168,.15); color: var(--danger); }
.nf-badge-muted { background: var(--surface-2); color: var(--text-dim); }

/* ===== 进度条 ===== */
.nf-progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.nf-progress-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }

/* ===== Toast ===== */
.nf-toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.nf-toast {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--primary-d); border-radius: 8px;
    padding: 12px 16px; color: var(--text); font-size: 13px;
    box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: nfSlideIn .25s ease;
    max-width: 360px; cursor: pointer;
}
.nf-toast-success { border-left-color: var(--primary-d); }
.nf-toast-danger  { border-left-color: var(--danger); }
.nf-toast-warning { border-left-color: var(--warning); }
.nf-toast-info    { border-left-color: var(--accent); }
.nf-toast-out { animation: nfSlideOut .25s ease forwards; }
@keyframes nfSlideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes nfSlideOut { to { transform: translateX(40px); opacity: 0; } }

/* auth 页 toast */
.auth-body .nf-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 32px; max-width: 90%; }

/* ===== 空状态 ===== */
.nf-empty { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.nf-empty-ico { font-size: 40px; opacity: .5; margin-bottom: 12px; }
.nf-empty p { margin: 0 0 16px; }

/* ===== 模态框 ===== */
.nf-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 20px; }
.nf-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.nf-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.nf-modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.nf-modal-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.nf-modal-body { padding: 20px; }
.nf-modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Markdown 预览 ===== */
.nf-md { line-height: 1.7; }
.nf-md h1, .nf-md h2, .nf-md h3 { margin: 14px 0 8px; }
.nf-md p { margin: 8px 0; }
.nf-md ul { padding-left: 20px; }
.nf-md code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.nf-md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-dim); margin: 8px 0; }

/* ===== 树形大纲 ===== */
.nf-tree { font-size: 13px; }
.nf-tree-node { margin-left: 14px; }
.nf-tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.nf-tree-row:hover { background: var(--surface); }
.nf-tree-toggle { width: 14px; text-align: center; color: var(--text-dim); user-select: none; }
.nf-tree-children.collapsed { display: none; }

/* ===== 筛选条 ===== */
.nf-filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.nf-filter-bar select, .nf-filter-bar input { width: auto; min-width: 130px; }

/* ===== 网格工具 ===== */
.nf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.nf-row > * { flex: 1; min-width: 0; }
.nf-grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.nf-col-fixed { flex: 0 0 auto; }

/* ===== 场景卡片 / 灵感卡片 ===== */
.nf-scene-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: grab; }
.nf-scene-card:hover { border-color: var(--primary); }
.nf-note-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 10px; padding: 14px; }

/* 响应式 */
@media (max-width: 860px) {
    .nf-sidebar { position: fixed; z-index: 50; transition: transform .2s; }
    body.nf-collapsed .nf-sidebar { transform: translateX(-100%); margin: 0; }
    .nf-content { padding: 16px; }
    .nf-grid-2 { grid-template-columns: 1fr; }
}

/* ===== 页脚备案信息 ===== */
.nf-footer {
    padding: 14px 24px; text-align: center;
    font-size: 12px; color: var(--text-mute);
    border-top: 1px solid var(--border);
}
.nf-footer a { color: var(--text-dim); text-decoration: none; margin: 0 8px; }
.nf-footer a:hover { color: var(--primary); }
.nf-footer-sep { color: var(--text-mute); margin: 0 4px; }
/* 居中卡片类页面（登录/错误页等）页脚固定在底部 */
.auth-body .nf-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    border-top: none; padding: 10px;
}
