/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Noto Serif SC", "Georgia", serif;
  background: #faf8f5;
  color: #222;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 0;
  line-height: 1.6;
}

/* ===== Banner ===== */
.banner {
  text-align: center;
  padding: 30px 20px 20px;
  border-bottom: 2px solid #e0d6c8;
  margin-bottom: 30px;
}
.banner h1 { font-size: 2.8rem; font-weight: 700; letter-spacing: 2px; }
.banner p { font-size: 1.1rem; color: #666; margin-top: 6px; }

/* 顶部菜单（五个菜单项） */
.banner .menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  margin-top: 12px;
}
.banner .menu a {
  text-decoration: none;
  color: #8b6b4a;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.banner .menu a:hover {
  border-bottom-color: #8b6b4a;
}

/* ===== 文章列表 ===== */
#post-list { padding: 0 4px; }
article {
  margin-bottom: 38px;
  padding-bottom: 28px;
  border-bottom: 1px dashed #d6cec4;
}
article h2 { font-size: 1.9rem; margin-bottom: 2px; }
article h2 a { text-decoration: none; color: #1a1a1a; }
article h2 a:hover { text-decoration: underline; }
article .date { color: #888; font-size: 0.9rem; margin-bottom: 8px; }
article .summary { font-size: 1rem; color: #444; margin-bottom: 6px; line-height: 1.7; }
article a[href*="全文"] { color: #8b6b4a; text-decoration: none; font-weight: 500; }
article a[href*="全文"]:hover { text-decoration: underline; }

/* ===== 文章详情页 ===== */
#post-content { padding: 10px 4px 30px; }
#post-content h1 { font-size: 2.2rem; margin-bottom: 6px; }
#post-content .meta { color: #888; font-size: 0.9rem; margin-bottom: 4px; }
#post-content .body { font-size: 1.05rem; line-height: 1.9; margin-top: 20px; }
#post-content .body img { max-width: 100%; height: auto; border-radius: 4px; }

/* ===== 后台管理表单 ===== */
.admin-form {
  max-width: 400px;
  margin: 60px auto;
  background: white;
  padding: 30px 35px;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.admin-form h2 { text-align: center; margin-bottom: 20px; font-weight: 400; }
.admin-form input,
.admin-form select {
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}
.admin-form button {
  width: 100%;
  padding: 12px;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
}
.admin-form button:hover { background: #1e2b38; }
.admin-form .error { color: #c0392b; text-align: center; margin-top: 10px; }

/* ===== 后台管理界面 ===== */
.container { max-width: 1100px; margin: 20px auto; padding: 0 20px; }
.toolbar { margin-bottom: 20px; }
.toolbar button { margin-right: 10px; }
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-primary { background: #2c3e50; color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-danger { background: #c0392b; color: white; }
.btn-warning { background: #f39c12; color: white; }
.post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.post-item .title { font-weight: 500; }
.post-item .info { color: #888; font-size: 0.9rem; }
.post-item .actions button { margin-left: 8px; }

.editor-area {
  background: white;
  padding: 20px 25px;
  border-radius: 8px;
  margin-top: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.editor-area .form-group {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.editor-area .form-group label {
  width: 80px;
  flex-shrink: 0;
}
.editor-area .form-group input,
.editor-area .form-group select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
#editor { height: 300px; }
.editor-actions { margin-top: 16px; }

/* ===== 页脚 ===== */
footer {
  margin-top: 40px;
  padding: 20px 0 30px;
  border-top: 1px solid #e0d6c8;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}

/* ===== 侧边栏（抽屉） ===== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #faf8f5;
  border-bottom: 1px solid #e0d6c8;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  gap: 12px;
}
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px 4px;
  user-select: none;
}
.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: #2c3e50;
  border-radius: 2px;
  transition: 0.3s;
}
.hamburger:hover span {
  background: #8b6b4a;
}
.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  background: #f8f6f2;
  z-index: 999;
  transform: translateX(-105%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 20px 18px;
  box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}
.drawer.open {
  transform: translateX(0);
}

.drawer-brand {
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.drawer-brand h1 {
  font-size: 1.6rem;
  margin: 0;
}
.drawer-brand p {
  color: #888;
  font-size: 0.9rem;
  margin: 4px 0 0;
}

.widget {
  margin-bottom: 16px;
  border-bottom: 1px dashed #e0d6c8;
  padding-bottom: 12px;
}
.widget-header {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  color: #2c3e50;
  padding: 4px 0;
  user-select: none;
}
.widget-header:hover {
  color: #1a2a3a;
}
.widget-arrow {
  font-size: 0.7rem;
  color: #999;
}
.widget-body {
  padding-top: 8px;
}
.widget-body ul {
  list-style: none;
  padding-left: 4px;
  margin: 0;
}
.widget-body ul li {
  padding: 4px 0;
  font-size: 0.9rem;
  color: #444;
  display: flex;
  align-items: center;
  gap: 6px;
}
.widget-body ul li a {
  text-decoration: none;
  color: #8b6b4a;
}
.widget-body ul li a:hover {
  text-decoration: underline;
}
.archive-toggle {
  font-size: 0.7rem;
  color: #aaa;
  margin-right: 4px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-cloud .tag {
  background: #eee;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #555;
  cursor: default;
}

/* ===== 两栏布局（桌面） ===== */
.blog-wrapper {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 30px;
}
.main-content {
  flex: 1;
  min-width: 0;
}

/* ===== 页码导航 ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 30px 0 20px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 6px 16px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}
.pagination button:hover:not(:disabled) {
  background: #f0ede8;
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .page-number {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  background: white;
  font-size: 0.95rem;
  min-width: 36px;
  text-align: center;
}
.pagination .page-number:hover {
  background: #f0ede8;
}
.pagination .page-number.active {
  background: #2c3e50;
  color: white;
  border-color: #2c3e50;
  font-weight: bold;
}
.pagination .page-dots {
  padding: 0 4px;
  color: #999;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  body {
    padding-top: 52px !important;
  }
  .banner {
    margin-top: 0;
  }
  .drawer {
    width: 280px;
  }
  .blog-wrapper {
    flex-direction: column;
    padding: 0 12px;
  }
  .drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-105%);
    width: 280px;
    border-radius: 0;
    border: none;
  }
  .drawer.open {
    transform: translateX(0);
  }
  .banner .menu {
    gap: 6px 12px;
  }
  .banner .menu a {
    font-size: 0.8rem;
  }
}

@media (min-width: 769px) {
  .hamburger {
    display: none;
  }
  .header-title {
    display: none;
  }
  body {
    padding-top: 0 !important;
  }
  .drawer {
    position: sticky;
    top: 20px;
    transform: none !important;
    width: 260px;
    max-height: calc(100vh - 40px);
    box-shadow: none;
    border: 1px solid #e8e2d8;
    border-radius: 12px;
    padding: 20px 16px;
    display: block !important;
  }
  .drawer-overlay {
    display: none !important;
  }
  .top-header {
    display: none !important;
  }
  .blog-wrapper {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
  }
  .main-content {
    flex: 1;
    min-width: 0;
  }
}
