/* 参考 tests/html/main.css 的配色：#45B6F7 主色、#555 正文、#f6f6f6 背景、#eaeaea 边框 */
:root {
  --accent: #45b6f7;
  --accent-hover: #0c7cd5;
  --text: #555;
  --muted: #999;
  --bg: #f6f6f6;
  --card: #fff;
  --border: #eaeaea;
  --danger: #ff5e52;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft Yahei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
a { color: #666; text-decoration: none; }
a:hover { color: var(--accent); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 18px; }

.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: visible;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.logo { font-size: 20px; font-weight: 700; color: #333; }
.logo span { color: var(--accent); }

.nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.nav a { padding: 8px 10px; border-radius: 6px; }
.nav a.active { color: var(--accent); }

.auth-area { display: flex; gap: 10px; align-items: center; }
.btn {
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; }

.layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 18px; padding: 22px 0 40px; }
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 18px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-item {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: box-shadow .15s ease;
}
.post-item:hover { box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.post-item h3 { margin: 0 0 8px; font-size: 18px; }
.post-item h3 a { color: #333; }
.post-item h3 a:hover { color: var(--accent); }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.excerpt { margin-top: 8px; color: #666; font-size: 14px; }

.sidebar .widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.sidebar h3 { margin: 0 0 10px; font-size: 15px; color: #333; }
.sidebar p { margin: 0; color: var(--muted); font-size: 13px; }

.article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 22px 30px;
}
.article h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.25; color: #222; }
.article .md {
  margin-top: 18px;
  font-size: 16px;
}
.article .md h1, .article .md h2, .article .md h3 { margin-top: 1.2em; }
.article .md pre {
  background: #f3f3f3;
  border: 1px solid #e6e6e6;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}
.article .md code { background: #f3f3f3; padding: 2px 6px; border-radius: 4px; }
.article .md blockquote {
  border-left: 4px solid var(--accent);
  margin: 12px 0;
  padding: 6px 14px;
  background: #fafafa;
  color: #444;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: var(--card);
}

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eef7ff; color: var(--accent); font-size: 12px; }

/* Markdown 编辑器页 */
.editor-page { padding: 18px 18px 40px; max-width: 1280px; margin: 0 auto; }
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.editor-toolbar .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.editor-meta { display: grid; gap: 12px; margin-bottom: 14px; }
@media (min-width: 720px) {
  .editor-meta { grid-template-columns: 1fr 1fr; }
}
.editor-meta label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.editor-meta input[type="text"] {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
}
.editor-meta .full { grid-column: 1 / -1; }
.editor-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.editor-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 60vh;
}
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; min-height: auto; }
}
.editor-pane {
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  display: flex; flex-direction: column; overflow: hidden;
}
.editor-pane h3 {
  margin: 0; padding: 10px 14px; font-size: 14px; color: #333;
  border-bottom: 1px solid var(--border); background: #fafafa;
}
.editor-pane textarea.editor-md {
  flex: 1; width: 100%; min-height: 420px; border: none; padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px; line-height: 1.5; resize: vertical; outline: none;
}
.editor-pane .md-preview {
  flex: 1; overflow: auto; padding: 14px 16px; min-height: 420px;
}
.editor-msg {
  padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px;
}
.editor-msg.warn { background: #fff8e6; border: 1px solid #ffe0a3; color: #7a5a00; }
.editor-msg.err { background: #fff0f0; border: 1px solid #ffc9c9; color: #a40000; }
.editor-msg.ok { background: #eefbf0; border: 1px solid #c6ebc9; color: #1b5e20; }

/* 导航栏圆形头像（悬停显示用户名） */
.nav-user-wrap {
  position: relative;
  display: none;
  align-items: center;
  vertical-align: middle;
  overflow: visible;
}
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #eef7ff;
  display: block;
  cursor: default;
}
.nav-user-tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 8px);
  white-space: nowrap;
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.nav-user-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #333;
}
.nav-user-wrap:hover .nav-user-tip {
  opacity: 1;
  visibility: visible;
}
