/* 基础样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #fff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--card); color: var(--text); }
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { min-height: 120px; resize: vertical; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; background: var(--border); color: var(--text-muted); }
.badge-primary { background: var(--primary); color: #fff; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 14px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* 导航 */
.navbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 0; position: sticky; top: 0; z-index: 100; }
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.navbar .logo { font-size: 20px; font-weight: 700; color: var(--text); }
.navbar .logo:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text-muted); font-size: 14px; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-links a.active { color: var(--primary); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.search-box { position: relative; }
.search-box input { padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: 20px; width: 200px; font-size: 14px; background: var(--bg); color: var(--text); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; }
.user-menu { position: relative; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; object-fit: cover; }
.dropdown { position: absolute; right: 0; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 160px; display: none; }
.dropdown.show { display: block; }
.dropdown a { display: block; padding: 10px 16px; color: var(--text); font-size: 14px; }
.dropdown a:hover { background: var(--bg); text-decoration: none; }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .search-box input { width: 140px; }
}

/* 文章列表 */
.post-list { display: grid; gap: 16px; }
.post-item { display: flex; gap: 16px; padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.post-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.post-cover { width: 200px; height: 140px; border-radius: var(--radius); object-fit: cover; flex-shrink: 0; }
.post-info { flex: 1; display: flex; flex-direction: column; }
.post-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.post-title:hover { color: var(--primary); text-decoration: none; }
.post-excerpt { color: var(--text-muted); font-size: 14px; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post-meta { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.post-meta img { width: 24px; height: 24px; border-radius: 50%; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.post-tags a { font-size: 12px; color: var(--primary); background: rgba(37,99,235,0.1); padding: 2px 8px; border-radius: 4px; }
@media (max-width: 768px) {
  .post-item { flex-direction: column; }
  .post-cover { width: 100%; height: 180px; }
}

/* 文章详情 */
.post-header { text-align: center; padding: 40px 0; }
.post-header h1 { font-size: 32px; margin-bottom: 16px; }
.post-header .meta { color: var(--text-muted); font-size: 14px; }
.post-content { max-width: 800px; margin: 0 auto; padding: 20px; background: var(--card); border-radius: var(--radius); }
.post-content h1, .post-content h2, .post-content h3 { margin: 24px 0 12px; }
.post-content p { margin-bottom: 16px; }
.post-content pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 16px 0; }
.post-content code { font-family: 'Fira Code', monospace; font-size: 14px; }
.post-content p code { background: var(--border); padding: 2px 6px; border-radius: 4px; }
.post-content blockquote { border-left: 4px solid var(--primary); padding-left: 16px; margin: 16px 0; color: var(--text-muted); }
.post-content img { border-radius: var(--radius); margin: 16px 0; }
.post-content ul, .post-content ol { margin: 16px 0; padding-left: 24px; }
.post-content li { margin-bottom: 8px; }
.post-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 10px; text-align: left; }
.post-content th { background: var(--bg); }
.post-content .mermaid { margin: 16px 0; text-align: center; }
.post-content .mermaid svg { max-width: 100%; }
.post-content .katex-block { margin: 16px 0; text-align: center; overflow-x: auto; }
.post-content .katex-inline { display: inline; }
.post-content .error { color: var(--danger); background: #fee2e2; padding: 8px; border-radius: 4px; }
.post-actions { display: flex; justify-content: center; gap: 16px; margin: 24px 0; }
.action-btn { display: flex; align-items: center; gap: 6px; padding: 10px 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--card); color: var(--text); cursor: pointer; transition: all .2s; }
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn svg { width: 18px; height: 18px; }

/* 评论 */
.comments { max-width: 800px; margin: 24px auto; }
.comments h3 { margin-bottom: 16px; }
.comment-form { margin-bottom: 24px; }
.comment-form textarea { width: 100%; min-height: 100px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); resize: vertical; font-size: 14px; }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { color: var(--text-muted); font-size: 12px; }
.comment-content { font-size: 14px; line-height: 1.6; }
.comment-actions { margin-top: 8px; display: flex; gap: 12px; }
.comment-actions button { background: none; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.comment-actions button:hover { color: var(--primary); }
.comment-replies { margin-left: 52px; border-left: 2px solid var(--border); padding-left: 16px; }
.emoji-picker { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.emoji-picker button { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px; border-radius: 4px; }
.emoji-picker button:hover { background: var(--border); }

/* 侧边栏 */
.main-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; padding: 24px 0; }
@media (max-width: 992px) { .main-layout { grid-template-columns: 1fr; } .sidebar { display: none; } }
.sidebar .card h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar .tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar .tag-cloud a { font-size: 12px; padding: 4px 10px; background: var(--bg); border-radius: 4px; color: var(--text-muted); }
.sidebar .tag-cloud a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.sidebar .popular-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar .popular-item:last-child { border-bottom: none; }
.sidebar .popular-item img { width: 60px; height: 45px; border-radius: 4px; object-fit: cover; }
.sidebar .popular-item h5 { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.sidebar .popular-item span { font-size: 11px; color: var(--text-muted); }

/* 编辑器 */
.editor-wrapper { display: flex; height: calc(100vh - 120px); }
.editor-container { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex: 1; }
.editor-pane { display: flex; flex-direction: column; border: 1px solid var(--border); }
.editor-pane:first-child { border-right: none; }
.editor-toolbar { display: flex; gap: 4px; padding: 8px; background: var(--bg); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor-toolbar button { background: none; border: none; padding: 6px 10px; cursor: pointer; border-radius: 4px; color: var(--text); font-size: 14px; }
.editor-toolbar button:hover { background: var(--border); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 0 4px; }
.editor-toolbar .idea-btn { background: #fef3c7; }
#editor { flex: 1; width: 100%; border: none; padding: 16px; font-family: 'Fira Code', monospace; font-size: 14px; resize: none; background: var(--card); color: var(--text); transition: box-shadow .2s; }
#editor.dragover { box-shadow: inset 0 0 0 3px var(--primary); }
#preview { flex: 1; padding: 16px; overflow-y: auto; background: var(--card); }
@media (max-width: 768px) { .editor-container { grid-template-columns: 1fr; } .editor-pane:last-child { display: none; } }

/* 灵感侧边栏 */
.idea-sidebar { width: 0; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); transition: width .2s; display: flex; flex-direction: column; }
.idea-sidebar.show { width: 280px; }
.idea-header { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); gap: 8px; }
.idea-header h4 { margin: 0; font-size: 14px; flex: 1; }
.idea-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.idea-random { background: none; border: none; font-size: 16px; cursor: pointer; }
.idea-random:hover { transform: rotate(180deg); transition: transform 0.3s; }
.idea-search { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.idea-search input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.idea-input { padding: 12px; border-bottom: 1px solid var(--border); }
.idea-input textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; font-size: 13px; resize: none; margin-bottom: 8px; }
.idea-tags-input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; margin-bottom: 8px; }
.idea-list { flex: 1; overflow-y: auto; padding: 8px; }
.idea-item { padding: 10px; background: var(--bg); border-radius: var(--radius); margin-bottom: 8px; font-size: 13px; }
.idea-item.highlight { animation: highlight 1s ease; }
@keyframes highlight { 0%,100% { background: var(--bg); } 50% { background: rgba(var(--primary-rgb), 0.2); } }
.idea-content { margin-bottom: 6px; white-space: pre-wrap; }
.idea-tags { font-size: 11px; color: var(--primary); margin-bottom: 6px; }
.idea-actions { display: flex; gap: 8px; }
.idea-actions button { background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0.6; }
.idea-actions button:hover { opacity: 1; }

/* 大纲导航侧边栏 */
.outline-sidebar { width: 0; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); transition: width .2s; display: flex; flex-direction: column; }
.outline-sidebar.show { width: 220px; }
.outline-list { flex: 1; overflow-y: auto; padding: 8px; }
.outline-item { padding: 6px 10px; cursor: pointer; border-radius: var(--radius); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline-item:hover { background: var(--bg); }
.outline-item.level-1 { font-weight: 600; }
.outline-item.level-2 { padding-left: 20px; }
.outline-item.level-3 { padding-left: 32px; font-size: 12px; color: var(--text-muted); }

/* 素材库侧边栏 */
.material-sidebar { width: 0; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); transition: width .2s; display: flex; flex-direction: column; }
.material-sidebar.show { width: 320px; }
.material-search { padding: 8px; border-bottom: 1px solid var(--border); }
.material-search input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.material-tabs { display: flex; padding: 8px; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.material-tabs .tab { padding: 4px 8px; font-size: 12px; border: none; background: var(--bg); border-radius: var(--radius); cursor: pointer; }
.material-tabs .tab.active { background: var(--primary); color: #fff; }
.material-item { display: flex; align-items: flex-start; gap: 8px; cursor: grab; }
.material-item:active { cursor: grabbing; }
.material-item.dragging { opacity: 0.5; }
.material-type { font-size: 16px; }
.material-info { flex: 1; min-width: 0; }
#editor.drag-over { background: rgba(var(--primary-rgb), 0.1); border-color: var(--primary); }
.material-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 版本历史侧边栏 */
.revision-sidebar { width: 0; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); transition: width .2s; display: flex; flex-direction: column; }
.revision-sidebar.show { width: 280px; }
.revision-item { display: flex; align-items: center; gap: 8px; }
.revision-info { flex: 1; min-width: 0; }
.revision-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revision-time { font-size: 12px; }

/* 查找替换栏 */
.find-replace-bar { display: none; padding: 8px; background: var(--bg); border-bottom: 1px solid var(--border); gap: 8px; align-items: center; flex-wrap: wrap; }
.find-replace-bar.show { display: flex; }
.find-replace-bar input { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; width: 150px; }
.find-replace-bar button { padding: 4px 8px; font-size: 12px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); cursor: pointer; }
.find-replace-bar button:hover { border-color: var(--primary); }
.find-replace-bar .find-close { border: none; font-size: 16px; }
.find-count { font-size: 12px; color: var(--text-muted); min-width: 60px; }

/* 常用片段侧边栏 */
.snippet-sidebar { width: 0; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); transition: width .2s; display: flex; flex-direction: column; }
.snippet-sidebar.show { width: 280px; }
.snippet-list { flex: 1; overflow-y: auto; padding: 8px; }
.snippet-item { padding: 10px; margin-bottom: 6px; background: var(--bg); border-radius: var(--radius); cursor: pointer; }
.snippet-item:hover { background: var(--border); }
.snippet-name { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.snippet-preview { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet-add { padding: 8px; border-top: 1px solid var(--border); }

/* AI工具栏 */
.ai-toolbar { display: none; padding: 8px; background: var(--bg); border-bottom: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
.ai-toolbar.show { display: flex; }
.ai-toolbar button { padding: 4px 12px; font-size: 12px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); cursor: pointer; }
.ai-toolbar button:hover { border-color: var(--primary); color: var(--primary); }
.ai-status { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.ai-status.loading { color: var(--primary); }
.ai-result { max-height: 400px; overflow-y: auto; }
.ai-text { white-space: pre-wrap; font-size: 14px; line-height: 1.6; background: var(--bg); padding: 12px; border-radius: var(--radius); }
.ai-titles { display: flex; flex-direction: column; gap: 8px; }
.ai-title-item { padding: 10px; background: var(--bg); border-radius: var(--radius); cursor: pointer; border: 2px solid transparent; }
.ai-title-item:hover { border-color: var(--border); }
.ai-title-item.selected { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.1); }
.ai-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-tag { padding: 6px 12px; background: var(--bg); border-radius: 20px; cursor: pointer; font-size: 13px; }
.ai-tag:hover { background: var(--primary); color: #fff; }
.ai-image-keywords { display: flex; flex-direction: column; gap: 8px; }
.ai-keyword { padding: 10px; background: var(--bg); border-radius: var(--radius); cursor: pointer; }
.ai-keyword:hover { background: var(--border); }
.ai-seo { font-size: 14px; line-height: 1.8; background: var(--bg); padding: 12px; border-radius: var(--radius); }
.ai-context-menu { position: absolute; display: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001; padding: 4px; }
.ai-context-menu.show { display: flex; gap: 4px; }
.ai-context-menu button { padding: 4px 8px; font-size: 12px; border: none; background: none; cursor: pointer; border-radius: 4px; white-space: nowrap; }
.ai-context-menu button:hover { background: var(--bg); }
.ai-btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: #fff !important; }
.ai-toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* 自动保存状态 */
.auto-save-status { font-size: 12px; color: var(--text-muted); line-height: 36px; }

/* 全局灵感快捷输入 */
.quick-idea-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; display: none; align-items: flex-start; justify-content: center; padding-top: 20vh; }
.quick-idea-overlay.show { display: flex; }
.quick-idea-box { background: var(--card); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.3); width: 90%; max-width: 500px; padding: 16px; }
.quick-idea-box textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; font-size: 14px; resize: none; background: var(--bg); }
.quick-idea-box textarea:focus { outline: none; border-color: var(--primary); }
.quick-idea-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* 编辑器统计 */
.editor-stats { font-size: 12px; color: var(--text-muted); margin-left: auto; padding: 0 8px; }

/* 全屏模式 */
.editor-wrapper.fullscreen { position: fixed; inset: 0; z-index: 1000; background: var(--bg); padding: 0; }
.editor-wrapper.fullscreen .editor-container { height: 100vh; border-radius: 0; }
body.fullscreen-mode { overflow: hidden; }

/* 专注模式 */
body.focus-mode .editor-toolbar { display: none; }
body.focus-mode .ai-toolbar { display: none; }
body.focus-mode .editor-pane:last-child { display: none; }
body.focus-mode .editor-container { grid-template-columns: 1fr; }
body.focus-mode #editor { font-size: 18px; line-height: 1.8; max-width: 700px; margin: 0 auto; padding: 40px; }

/* 媒体库 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-item { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 2px solid transparent; }
.media-item:hover { border-color: var(--primary); }
.media-item.selected { border-color: var(--primary); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item .overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.media-item:hover .overlay { opacity: 1; }
.media-item .overlay button { background: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all .2s; }
.upload-zone:hover { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.upload-zone.dragover { border-color: var(--primary); background: rgba(37,99,235,0.1); }

/* 用户资料 */
.profile-header { text-align: center; padding: 40px 20px; background: var(--card); border-radius: var(--radius); margin-bottom: 24px; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 16px; object-fit: cover; }
.profile-name { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.profile-bio { color: var(--text-muted); max-width: 400px; margin: 0 auto 16px; }
.profile-stats { display: flex; justify-content: center; gap: 32px; }
.profile-stats div { text-align: center; }
.profile-stats strong { display: block; font-size: 20px; }
.profile-stats span { font-size: 13px; color: var(--text-muted); }

/* 管理后台 */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 57px); }
.admin-sidebar { background: var(--card); border-right: 1px solid var(--border); padding: 20px 0; }
.admin-sidebar a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: var(--text-muted); font-size: 14px; }
.admin-sidebar a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.admin-sidebar a.active { background: rgba(37,99,235,0.1); color: var(--primary); border-right: 3px solid var(--primary); }
.admin-sidebar svg { width: 18px; height: 18px; }
.admin-content { padding: 24px; background: var(--bg); }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-size: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); padding: 20px; border-radius: var(--radius); }
.stat-card h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 600; }
@media (max-width: 992px) { .admin-layout { grid-template-columns: 1fr; } .admin-sidebar { display: none; } .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* 表格 */
.table-container { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table th { background: var(--bg); font-weight: 600; font-size: 13px; color: var(--text-muted); }
table.data-table tr:hover { background: var(--bg); }
table.data-table .actions { display: flex; gap: 8px; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 24px; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-muted); cursor: not-allowed; }

/* 模态框 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all .2s; }
.modal.show { opacity: 1; visibility: visible; }
.modal-content { background: var(--card); border-radius: var(--radius); max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* 通知 */
.notification-list { max-width: 600px; margin: 0 auto; }
.notification-item { display: flex; gap: 12px; padding: 16px; background: var(--card); border-radius: var(--radius); margin-bottom: 8px; }
.notification-item.unread { border-left: 3px solid var(--primary); }
.notification-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-body h4 { font-size: 14px; margin-bottom: 4px; }
.notification-body p { font-size: 13px; color: var(--text-muted); }
.notification-body time { font-size: 12px; color: var(--text-muted); }

/* 页脚 */
.footer { background: var(--card); border-top: 1px solid var(--border); padding: 40px 0 20px; margin-top: 40px; }
.footer-content { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 24px; }
.footer h4 { font-size: 14px; margin-bottom: 16px; }
.footer p { font-size: 13px; color: var(--text-muted); }
.footer ul { list-style: none; }
.footer li { margin-bottom: 8px; }
.footer a { font-size: 13px; color: var(--text-muted); }
.footer a:hover { color: var(--primary); }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px) { .footer-content { grid-template-columns: 1fr 1fr; } }

/* 暗色模式切换 */
.theme-toggle { background: none; border: none; cursor: pointer; padding: 8px; color: var(--text-muted); }
.theme-toggle:hover { color: var(--text); }

/* 加载动画 */
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast 提示 */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { background: var(--card); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 12px 20px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; animation: slideIn .3s ease; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.ad-container { margin: 20px 0; text-align: center; min-height: 100px; }
.ad-container ins { display: block; }
.ad-sidebar { padding: 16px; min-height: 250px; }
.ad-article { margin: 32px auto; max-width: 728px; }
.ad-banner { max-width: 100%; overflow: hidden; }
.ad-feed { margin: 16px 0; }
.post-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.post-sidebar { position: sticky; top: 80px; height: fit-content; }
.post-sidebar .card { margin-bottom: 16px; }
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-sidebar { display: none; }
  .ad-sidebar { display: none; }
  .ad-banner { margin: 16px -16px; border-radius: 0; }
}
@media (max-width: 600px) {
  .ad-container { min-height: 50px; }
}


/* 番茄钟面板 */
.pomodoro-panel, .goal-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 200px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  display: none;
}
.pomodoro-panel.show, .goal-panel.show { display: block; }
.pomodoro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.pomodoro-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}
.pomodoro-display {
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  padding: 20px;
  font-family: monospace;
}
.pomodoro-status {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.pomodoro-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 16px 16px;
}
.pomodoro-controls button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
}
.pomodoro-controls button:hover { border-color: var(--primary); color: var(--primary); }
.pomodoro-stats {
  text-align: center;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* 写作目标 */
.goal-input {
  display: flex;
  gap: 8px;
  padding: 16px;
}
.goal-input input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.goal-input button {
  padding: 8px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.goal-progress { padding: 0 16px 16px; }
.goal-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  width: 0;
  transition: width 0.3s;
}
.goal-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 行号显示 */
.editor-pane { position: relative; }
.line-numbers {
  position: absolute;
  left: 0;
  top: 42px;
  width: 40px;
  height: calc(100% - 42px);
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: right;
  overflow: hidden;
  white-space: pre;
  display: none;
  user-select: none;
}
.editor-pane.show-lines .line-numbers { display: block; }
.editor-pane.show-lines #editor { padding-left: 50px; }
#line-num-btn.active { background: var(--primary); color: #fff; border-radius: 4px; }
