/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; line-height: 1.6; color: #333; background: #f8f9fa; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header { padding: 1rem 0 0; }
main.container { margin-top: 0.5rem; }
.header-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); padding: 1rem 1.5rem; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; }
.main-nav { margin-top: 0.8rem; position: relative; }
.header-search { margin-top: 0.8rem; }
.header-search form { display: flex; gap: 0.5rem; }
.header-left { flex-shrink: 0; }
.header-right { text-align: right; flex: 1; }
.header-avatar img { width: 80px; height: 80px; border-radius: 12px; object-fit: cover; border: 2px solid #e5e7eb; }
.site-title { font-size: 1.8rem; margin-bottom: 0.3rem; }
.site-title a { color: #111; }
.site-desc { color: #666; font-size: 0.9rem; }

.main-nav { margin-top: 1rem; position: relative; }
.header-search { margin-top: 1rem; }
.header-search form { display: flex; gap: 0.5rem; }
.header-search input { flex: 1; padding: 0.5rem 1rem; border: 1px solid #e5e7eb; border-radius: 20px; font-size: 0.9rem; background: #f8f9fa; outline: none; }
.header-search input:focus { border-color: #2563eb; background: #fff; }
.header-search button { padding: 0.5rem 1rem; background: none; border: 1px solid #e5e7eb; border-radius: 20px; cursor: pointer; font-size: 0.9rem; }
.header-search button:hover { background: #f0f0f0; }
.search-hint {
  font-size: 0.78rem;
  color: #999;
  margin-top: 0.4rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.search-hint.show {
  opacity: 1;
}
.main-nav ul { list-style: none; display: flex; gap: 1rem; justify-content: center; flex-wrap: nowrap; overflow-x: auto; }
.main-nav a { color: #555; font-size: 0.95rem; padding: 0.35rem 0; text-decoration: none; transition: color 0.2s; position: relative; z-index: 1; }
.main-nav a:hover, .main-nav a.active { color: #2563eb; }
.nav-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: #2563eb;
  border-radius: 2px;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.container { max-width: 600px; margin: 1rem auto; padding: 0 1rem; }

/* Post list */
.post-list { display: flex; flex-direction: column; gap: 0.7rem; }
.post-card { background: #fff; border-radius: 8px; padding: 1.2rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); transition: box-shadow 0.2s; }
.post-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.post-card:active { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.post-card:hover .post-title { color: #2563eb; }
.post-card .post-title { color: #111; }
.post-title { font-size: 1.2rem; margin-bottom: 0.5rem; }
.post-title a { color: #111; }
.post-title a:hover { color: #2563eb; }
.post-meta { display: flex; gap: 1rem; font-size: 0.85rem; color: #888; margin-bottom: 0.5rem; flex-wrap: wrap; }
.post-meta .tag a { background: #eef2ff; color: #4f46e5; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }
.post-excerpt { color: #555; font-size: 0.9rem; line-height: 1.5; max-height: 280px; overflow: hidden; position: relative; }
.post-excerpt img { max-width: 100%; max-height: 200px; object-fit: cover; border-radius: 4px; margin: 0.3rem 0; display: block; }
.post-excerpt::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background: linear-gradient(transparent, #fff); pointer-events: none; }

/* Post detail */
.post-detail { background: #fff; border-radius: 8px; padding: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.post-detail .post-title { font-size: 1.6rem; margin-bottom: 1rem; }
.post-detail .post-content { margin-top: 1.5rem; line-height: 1.8; }
.post-detail .post-content h1, .post-detail .post-content h2, .post-detail .post-content h3 { margin: 1.5rem 0 0.8rem; }
.post-detail .post-content p { margin-bottom: 1rem; }
.post-detail .post-content img { max-width: 100%; border-radius: 6px; margin: 1rem 0; }
.post-detail .post-content code { background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.9em; }
.post-detail .post-content pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 6px; overflow-x: auto; margin-bottom: 1rem; }
.post-detail .post-content pre code { background: none; color: inherit; }
.post-detail .post-content blockquote { border-left: 4px solid #2563eb; padding-left: 1rem; color: #555; margin: 1rem 0; }
.post-images { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.post-images img { max-width: 100%; border-radius: 6px; }

/* Shuoshuo */
.page-title { font-size: 1.4rem; margin-bottom: 1.5rem; color: #111; }
.shuoshuo-list { display: flex; flex-direction: column; gap: 1rem; }
.shuoshuo-card { background: #fff; border-radius: 8px; padding: 1.2rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.shuoshuo-content { font-size: 0.95rem; line-height: 1.7; margin-bottom: 0.8rem; }
.shuoshuo-images { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.shuoshuo-images img { max-width: 200px; max-height: 200px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.shuoshuo-meta { font-size: 0.8rem; color: #999; }

/* Search */
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.search-form input { flex: 1; padding: 0.6rem 1rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; }
.search-form button { padding: 0.6rem 1.2rem; background: #2563eb; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; }
.search-form button:hover { background: #1d4ed8; }
.search-result-count { color: #666; margin-bottom: 1rem; font-size: 0.9rem; }

/* Password */
.password-form { background: #fff; border-radius: 8px; padding: 2rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); max-width: 400px; margin: 3rem auto; }
.password-form h2 { margin-bottom: 0.5rem; }
.password-form h3 { color: #555; margin-bottom: 1.5rem; font-weight: normal; }
.password-form input { padding: 0.6rem 1rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; width: 100%; margin-bottom: 0.8rem; }
.password-form button { padding: 0.6rem 2rem; background: #2563eb; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; }
.error { color: #dc2626; margin-bottom: 0.8rem; }

/* 404 */
.not-found { text-align: center; padding: 4rem 0; }
.not-found h2 { font-size: 4rem; color: #ddd; }
.not-found p { color: #888; margin: 1rem 0; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.6rem; margin-top: 2.5rem; padding: 1rem 0; font-size: 0.85rem; }
.pagination .prev, .pagination .next { padding: 0.35rem 0.9rem; color: #555; border: 1px solid #e5e7eb; border-radius: 20px; transition: all 0.2s; }
.pagination .prev:hover, .pagination .next:hover { color: #2563eb; border-color: #2563eb; text-decoration: none; }
.pagination .current { color: #aaa; font-size: 0.8rem; }
.empty { text-align: center; color: #999; padding: 3rem 0; }

/* Footer */
.site-footer { text-align: center; padding: 1.5rem 0; color: #bbb; font-size: 0.8rem; border-top: 1px solid rgba(0,0,0,0.06); margin-top: 4rem; background: rgba(0,0,0,0.02); line-height: 1.8; }
.site-footer a { color: #bbb; }
.site-footer a:hover { color: #2563eb; }
.footer-sub { margin-top: 0.2rem; }
.footer-sub a { color: #bbb; }
.footer-sub a:hover { color: #2563eb; }

/* Category */
.category-title { font-size: 1.3rem; margin-bottom: 1.5rem; color: #111; }

/* ===== Admin ===== */
body.admin { background: #f1f5f9; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1e293b; color: #fff; padding: 1.5rem 0; flex-shrink: 0; }
.admin-sidebar h2 { text-align: center; padding: 0 1rem 1rem; border-bottom: 1px solid #334155; font-size: 1.1rem; }
.admin-sidebar nav { padding: 1rem 0; }
.admin-sidebar ul { list-style: none; }
.admin-sidebar a { display: block; padding: 0.6rem 1.5rem; color: #cbd5e1; font-size: 0.9rem; }
.admin-sidebar a:hover { background: #334155; color: #fff; text-decoration: none; }
.admin-main { flex: 1; padding: 1.5rem 2rem; }
.admin-content { max-width: 900px; }
.admin-content h2 { margin-bottom: 1.5rem; font-size: 1.4rem; }

/* Admin header row */
.admin-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: 8px; padding: 1.5rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card h3 { font-size: 2rem; color: #2563eb; }
.stat-card p { color: #666; font-size: 0.9rem; margin-top: 0.3rem; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.admin-table th, .admin-table td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.admin-table th { background: #f8fafc; font-weight: 600; color: #475569; }
.admin-table tr:hover { background: #f8fafc; }
.actions { white-space: nowrap; }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1.2rem; border-radius: 6px; font-size: 0.9rem; cursor: pointer; border: 1px solid #ddd; background: #fff; color: #333; }
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 4px; border: 1px solid #ddd; background: #fff; color: #333; cursor: pointer; }
.btn-sm:hover { background: #f0f0f0; text-decoration: none; }
.btn-danger { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }

/* Admin form */
.admin-form { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; font-size: 0.9rem; color: #374151; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; font-family: inherit; }
.form-group textarea { resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.form-actions { display: flex; gap: 0.8rem; margin-top: 1.5rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; margin-bottom: 1.5rem; background: #fff; padding: 1rem; border-radius: 8px; }
.inline-form input { flex: 1; padding: 0.5rem 0.8rem; border: 1px solid #ddd; border-radius: 6px; }

/* Upload */
.upload-area { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.upload-area button { padding: 0.4rem 0.8rem; background: #f0f0f0; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }

/* Login */
body.admin-login { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f1f5f9; }
.login-box { background: #fff; padding: 2.5rem; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); width: 100%; max-width: 360px; }
.login-box h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.4rem; }
.login-box input { width: 100%; padding: 0.7rem 1rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; margin-bottom: 1rem; }
.login-box button { width: 100%; padding: 0.7rem; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 1rem; cursor: pointer; }
.login-box button:hover { background: #1d4ed8; }

/* Back to top */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; background: linear-gradient(90deg, #2563eb, #7c3aed); width: 0%; z-index: 9999; cursor: pointer; transition: width 0.1s; }
.scroll-progress:hover { height: 5px; }
.back-to-top { position: fixed; bottom: 2.5rem; right: 2rem; width: 36px; height: 36px; background: #fff; color: #555; border-radius: 50%; font-size: 1rem; border: 1px solid #e5e7eb; box-shadow: 0 2px 10px rgba(0,0,0,0.08); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: all 0.3s; z-index: 999; }
.back-to-top:hover { color: #2563eb; box-shadow: 0 4px 14px rgba(0,0,0,0.12); transform: translateY(-2px); }

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar { width: 60px; }
  .admin-sidebar h2 { font-size: 0; padding: 1rem 0; }
  .admin-sidebar a { font-size: 0; padding: 0.8rem; text-align: center; }
  .admin-sidebar a::after { font-size: 0.9rem; }
  .admin-main { padding: 1rem; }
  .post-detail { padding: 1.2rem; }
}
