/* FileServer 个人知识库 — 样式（沿用原版配色，扩展登录/预览/管理） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}
.container { max-width: 900px; margin: 0 auto; padding: 20px 16px; }

/* ── 顶栏 ── */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
h1 { font-size: 1.5rem; color: #1a1a1a; display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 0.85rem; color: #666; background: #fff; border-radius: 20px; padding: 4px 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.subtitle { color: #888; font-size: 0.85rem; margin-bottom: 20px; }
.inline { display: inline; }

/* ── 面包屑 ── */
.breadcrumbs { font-size: 0.9rem; color: #666; margin: 8px 0 16px; padding: 8px 0; }
.breadcrumbs a { color: #4a90d9; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { color: #ccc; margin: 0 4px; }

/* ── 按钮 ── */
.btn {
  display: inline-block; padding: 8px 14px; font-size: 0.9rem;
  border: 1px solid #ddd; border-radius: 8px; background: #fff; color: #333;
  cursor: pointer; text-decoration: none; transition: all 0.15s;
}
.btn:hover { background: #f5f7fa; border-color: #bbb; }
.btn-primary { background: #4a90d9; border-color: #4a90d9; color: #fff; }
.btn-primary:hover { background: #3a7fc4; }
.btn-ghost { border: none; background: transparent; color: #888; }
.btn-ghost:hover { color: #d9534f; background: transparent; }
.btn-block { width: 100%; }
.btn-icon { border: none; background: transparent; cursor: pointer; font-size: 0.9rem; padding: 5px 8px; border-radius: 6px; color: #555; }
.btn-icon:hover { background: #eef2f8; }
.btn-icon.danger:hover { background: #fdeaea; color: #c0392b; }
.op-label { font-size: 0.8rem; margin-left: 3px; }

/* ── 上传区 ── */
.dropzone {
  border: 2px dashed #c8d4e8; border-radius: 12px; background: #fafcff;
  padding: 18px; text-align: center; color: #8899aa; font-size: 0.9rem;
  margin-bottom: 12px; cursor: pointer; transition: all 0.15s;
}
.dropzone a { color: #4a90d9; }
.dropzone.over { border-color: #4a90d9; background: #eef5ff; }
.upload-progress { margin-top: 8px; color: #4a90d9; font-size: 0.85rem; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }

/* ── 文件表 ── */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
th { background: #fafafa; font-weight: 600; font-size: 0.8rem; color: #999; text-transform: uppercase; padding: 12px 16px; text-align: left; border-bottom: 1px solid #eee; }
th.size { width: 100px; } th.mtime { width: 160px; } th.icon { width: 40px; } th.ops { width: 300px; }
.file-row { cursor: pointer; transition: background 0.15s; border-bottom: 1px solid #f5f5f5; }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #f8f9ff; }
td { padding: 14px 16px; font-size: 0.95rem; }
td.icon { font-size: 1.3rem; }
td.size { color: #888; font-size: 0.85rem; }
td.mtime { color: #aaa; font-size: 0.85rem; }
td.ops { white-space: nowrap; }
.empty { text-align: center; color: #ccc; padding: 40px 16px !important; }
footer { text-align: center; color: #ccc; font-size: 0.8rem; margin-top: 30px; }

/* ── 登录页 ── */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card {
  background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 36px 32px; width: 340px; margin-top: 10vh;
}
.login-card h1 { justify-content: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; margin-bottom: 16px; }
.login-card label { display: block; font-size: 0.85rem; color: #666; margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem;
}
.login-card input:focus { outline: none; border-color: #4a90d9; }
.error-box { background: #fdeaea; color: #c0392b; border-radius: 8px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 14px; }

/* ── 预览页 ── */
.preview-topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(6px);
  padding: 10px 16px; border-bottom: 1px solid #eee;
}
.preview-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-title small { color: #999; font-weight: 400; }
.pdf-frame { width: 100%; height: calc(100vh - 57px); border: none; }
.image-wrap { text-align: center; padding: 24px; }
.image-wrap img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.text-body {
  background: #fff; border-radius: 12px; padding: 20px; margin-top: 16px;
  font-family: "SF Mono", Consolas, "Courier New", monospace; font-size: 0.85rem;
  white-space: pre-wrap; word-break: break-all; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.binary-box { text-align: center; padding: 60px 16px; color: #888; }
.binary-box .btn { margin-top: 16px; }

/* ── Markdown 渲染 ── */
.md-body {
  background: #fff; border-radius: 12px; padding: 32px 36px; margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); line-height: 1.75; font-size: 1rem;
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 1.2em 0 0.6em; line-height: 1.4; }
.md-body h1 { font-size: 1.6rem; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.md-body h2 { font-size: 1.35rem; border-bottom: 1px solid #f0f0f0; padding-bottom: 0.25em; }
.md-body h3 { font-size: 1.15rem; }
.md-body p { margin: 0.8em 0; }
.md-body a { color: #4a90d9; text-decoration: none; }
.md-body a:hover { text-decoration: underline; }
.md-body img { max-width: 100%; border-radius: 6px; }
.md-body blockquote { border-left: 4px solid #d8e2f0; padding: 4px 16px; color: #666; background: #fafbfd; margin: 0.8em 0; }
.md-body code {
  font-family: "SF Mono", Consolas, monospace; font-size: 0.85em;
  background: #f3f4f6; padding: 2px 6px; border-radius: 4px;
}
.md-body pre { background: #f6f8fa; border-radius: 8px; padding: 14px 16px; overflow-x: auto; margin: 0.8em 0; }
.md-body pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.6; }
.md-body table { border-collapse: collapse; margin: 0.8em 0; box-shadow: none; border-radius: 0; }
.md-body th, .md-body td { border: 1px solid #e0e0e0; padding: 8px 12px; font-size: 0.9rem; }
.md-body th { background: #fafafa; }
.md-body ul, .md-body ol { padding-left: 1.8em; margin: 0.8em 0; }
.md-body hr { border: none; border-top: 1px solid #eee; margin: 1.5em 0; }
.md-body .headerlink { color: #ccc; margin-left: 6px; text-decoration: none; }
.md-body .codehilite { background: #f6f8fa; border-radius: 8px; margin: 0.8em 0; }

/* Pygments 代码高亮（默认浅色） */
.codehilite .hll { background-color: #ffffcc }
.codehilite .c { color: #6a737d } .codehilite .k { color: #d73a49; font-weight: bold }
.codehilite .o { color: #d73a49 } .codehilite .cm { color: #6a737d }
.codehilite .cp { color: #6a737d } .codehilite .c1 { color: #6a737d }
.codehilite .s { color: #032f62 } .codehilite .s1 { color: #032f62 } .codehilite .s2 { color: #032f62 }
.codehilite .na { color: #6f42c1 } .codehilite .nb { color: #005cc5 }
.codehilite .nf { color: #6f42c1 } .codehilite .nc { color: #6f42c1; font-weight: bold }
.codehilite .nn { color: #6f42c1 } .codehilite .nt { color: #22863a }
.codehilite .nv { color: #e36209 } .codehilite .mi { color: #005cc5 }
.codehilite .mf { color: #005cc5 } .codehilite .kc { color: #005cc5 }
.codehilite .kd { color: #d73a49 } .codehilite .kn { color: #d73a49 }
.codehilite .err { color: #a61717 }

/* ── 移动端 ── */
@media (max-width: 600px) {
  .container { padding: 12px 8px; }
  th.mtime, td.mtime { display: none; }
  th.size, td.size { width: 70px; font-size: 0.75rem; }
  th.ops { width: 130px; }
  .op-label { display: none; }
  td { padding: 12px 10px; font-size: 0.9rem; }
  h1 { font-size: 1.2rem; }
  .md-body { padding: 20px 16px; }
}

/* ── 搜索表单 ── */
.search-form { margin-left: auto; }
.search-form input {
  padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.9rem; width: 200px;
}
.search-form input:focus { outline: none; border-color: #4a90d9; }
.search-form-big { display: flex; gap: 8px; margin: 16px 0; }
.search-form-big input { flex: 1; width: auto; padding: 10px 14px; font-size: 1rem; }

/* ── 搜索结果 ── */
.search-summary { color: #888; font-size: 0.9rem; margin: 8px 0 16px; }
.search-result {
  background: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.search-file { color: #4a90d9; text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.search-file:hover { text-decoration: underline; }
.search-match {
  font-family: "SF Mono", Consolas, monospace; font-size: 0.8rem; color: #555;
  margin-top: 6px; padding: 4px 8px; background: #f8f9fb; border-radius: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.match-line { color: #4a90d9; margin-right: 8px; }
.empty-search { color: #aaa; text-align: center; padding: 40px 0; }

/* ── 编辑页 ── */
.edit-container { max-width: 1000px; }
#editor {
  width: 100%; min-height: calc(100vh - 140px); margin-top: 12px;
  padding: 18px; border: 1px solid #ddd; border-radius: 12px; background: #fff;
  font-family: "SF Mono", Consolas, monospace; font-size: 0.9rem; line-height: 1.6;
  resize: vertical;
}
#editor:focus { outline: none; border-color: #4a90d9; }
.save-status { margin-top: 8px; font-size: 0.85rem; color: #4a90d9; min-height: 1.2em; }

/* ── 缩略图与灯箱 ── */
.thumb {
  width: 36px; height: 36px; object-fit: cover; border-radius: 6px;
  display: block; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 85vh; border-radius: 6px; box-shadow: 0 4px 40px rgba(0,0,0,0.5); }
.lightbox-caption { color: rgba(255,255,255,0.85); margin-top: 12px; font-size: 0.9rem; }
.image-wrap img { cursor: zoom-in; }

/* ── epub 阅读器 ── */
.epub-container { height: calc(100vh - 57px); display: flex; flex-direction: column; background: #fff; }
.epub-toolbar {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 8px 16px; border-bottom: 1px solid #eee; background: #fafafa;
}
.epub-loc { font-size: 0.8rem; color: #888; min-width: 140px; text-align: center; }
#epub-viewer { flex: 1; overflow: hidden; }

/* ── URL 导入卡片 ── */
.import-card {
  background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.import-card-title { font-weight: 600; font-size: 0.95rem; color: #333; margin-bottom: 4px; }
.import-card-hint { font-size: 0.8rem; color: #999; margin-bottom: 10px; }
.import-row { display: flex; gap: 8px; }
.import-row input {
  flex: 1; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.9rem; height: 40px;
}
.import-row input:focus { outline: none; border-color: #4a90d9; }
.import-btn { height: 40px; white-space: nowrap; }
.import-status { font-size: 0.85rem; color: #4a90d9; margin-top: 8px; }
