/* === Pages: Home, Post Detail, Login, Admin, Search === */

/* ---- Home: Article List ---- */
.article-list { display: flex; flex-direction: column; gap: 16px; }

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
}

.article-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Pinned: left accent bar + faint tint */
.article-card.pinned {
  border-left: 3px solid var(--accent);
  background: linear-gradient(to right, var(--accent-lighter), var(--bg-card) 18%);
}

.article-card .post-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.article-card .post-title a { color: inherit; text-decoration: none; }
.article-card .post-title a:hover { color: var(--accent); }

.article-card .post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.article-card .post-meta .tag {
  font-size: 0.78rem;
  padding: 2px 8px;
}

.article-card .post-summary {
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.6;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .read-more {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.article-card:hover .read-more {
  opacity: 1;
  transform: translateX(0);
}

.pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---- Post Detail ---- */
.post-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.post-detail .post-header { margin-bottom: 24px; }

.post-detail .post-header h1 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.post-detail .post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.post-detail .post-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-detail .post-body h2 { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.post-detail .post-body h3 { margin-top: 24px; }
.post-detail .post-body img {
  border-radius: var(--radius);
  margin: 16px 0;
  background: var(--bg-input); /* placeholder while loading */
  box-shadow: var(--shadow-sm);
}
.post-detail .post-body ul, .post-detail .post-body ol { margin-bottom: 16px; }
.post-detail .post-body li { margin-bottom: 6px; }

.like-section { text-align: center; padding: 20px 0; border-top: 1px solid var(--border-light); margin-top: 24px; }

/* ---- Post TOC ---- */
.post-toc {
  background: var(--accent-lighter);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.post-toc-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-toc-title i { color: var(--accent); }

.post-toc-list { list-style: none; padding: 0; margin: 0; }

.post-toc-list li { margin: 0; }

.post-toc-list a {
  display: block;
  padding: 4px 8px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease), background var(--duration) var(--ease);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-toc-list li.toc-h3 a { padding-left: 22px; font-size: 0.86rem; }

.post-toc-list a:hover { color: var(--accent); background: var(--accent-light); }

.post-toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
  background: var(--accent-light);
}

/* ---- Code copy button ---- */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 0.78rem;
  background: rgba(255,255,255,0.12);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}

.code-copy-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }

.code-copy-btn.copied { background: #10b981; border-color: #10b981; color: #fff; }

/* ---- Post nav (prev/next) ---- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.post-nav-item { min-width: 0; }

.post-nav-next { text-align: right; }

.post-nav-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.post-nav-next .post-nav-label i { margin-left: 4px; }
.post-nav-prev .post-nav-label i { margin-right: 4px; }

.post-nav-item a {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-nav-item a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.93rem;
  cursor: pointer;
  transition: all 0.2s;
}

.like-btn:hover { border-color: #e74c3c; color: #e74c3c; }
.like-btn.liked { border-color: #e74c3c; background: #fef2f2; color: #e74c3c; }

/* ---- Login Page ---- */
.login-wrap {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.login-card .login-header {
  background: var(--accent);
  color: #fff;
  padding: 20px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-card .login-body { padding: 24px; }

/* ---- Sidebar ---- */
.sidebar-section { margin-bottom: var(--gap); }

.sidebar-section .card-header { margin-bottom: 12px; padding-bottom: 10px; }

.sidebar-list { list-style: none; }

.sidebar-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.sidebar-list li:last-child { border-bottom: none; }

.sidebar-list li a { color: var(--text-primary); }
.sidebar-list li a:hover { color: var(--accent); }

.sidebar-list .count {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---- Sidebar link row: entire row clickable ---- */
.sidebar-list li.sidebar-link-row {
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 0 -10px;
}
.sidebar-list li.sidebar-link-row:hover {
  background: var(--bg-secondary);
}
.sidebar-list li.sidebar-link-row a {
  flex: 1;
  text-decoration: none;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 48px; display: block; margin-bottom: 16px; opacity: 0.4; }

/* ---- Back to top ---- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  transition: opacity 0.2s;
  z-index: 50;
}

.back-to-top.visible { display: flex; }

/* ---- Reading Progress ---- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s;
  width: 0;
}
/* ---- Donate Section ---- */
.donate-section {
  text-align: center;
  padding: 24px 0;
  margin-top: 24px;
  border-top: 1px solid var(--border-light);
}

.donate-desc {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin-bottom: 16px;
}

.donate-qr-wrap {
  display: inline-block;
  max-width: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--bg-card);
}

.donate-qr-wrap img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.donate-qr-row {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.donate-qr-item {
  text-align: center;
}

.donate-qr-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ---- Reading Progress ---- */
