/* ===== CSDN-Inspired Design System ===== */
:root {
  --brand: #fc5531;
  --brand-hover: #e04a28;
  --brand-light: #fff3ef;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #303133;
  --text-secondary: #606266;
  --text-muted: #909399;
  --border: #ebeef5;
  --border-dark: #dcdfe6;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 8px;
  --nav-height: 56px;
  --content-width: 860px;
  --sidebar-width: 300px;
  --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--brand); }

/* ===== Top Navigation ===== */
.top-nav {
  height: var(--nav-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.nav-inner {
  max-width: calc(var(--content-width) + var(--sidebar-width) + 40px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  gap: 20px;
}
.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand) !important;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 0;
  flex: 1;
}
.nav-links a {
  padding: 0 14px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--brand);
}
.nav-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.nav-search input {
  width: 200px;
  height: 34px;
  border: 1px solid var(--border-dark);
  border-radius: 17px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.nav-search input:focus { border-color: var(--brand); width: 260px; }
.nav-search button {
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 17px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-search button:hover { background: var(--brand-hover); }
.nav-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-user .btn-login {
  padding: 6px 16px;
  border: 1px solid var(--brand);
  border-radius: 17px;
  color: var(--brand);
  font-size: 13px;
  background: none;
  cursor: pointer;
}
.nav-user .btn-login:hover { background: var(--brand-light); }
.nav-user .btn-post {
  padding: 6px 16px;
  border-radius: 17px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  border: none;
  cursor: pointer;
}
.nav-user .avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== Main Layout ===== */
.main-container {
  max-width: calc(var(--content-width) + var(--sidebar-width) + 40px);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  gap: 16px;
  min-height: calc(100vh - var(--nav-height));
}
.content-area { flex: 1; min-width: 0; }
.sidebar { width: var(--sidebar-width); flex-shrink: 0; }

@media (max-width: 900px) {
  .main-container { flex-direction: column; padding: 8px 12px; }
  .sidebar { width: 100%; }
  .nav-search input { width: 120px; }
  .nav-search input:focus { width: 160px; }
  .nav-links a { padding: 0 8px; font-size: 13px; }
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-card); }

/* Article Card (homepage list) */
.article-card {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.article-card:hover { box-shadow: var(--shadow-card); }
.article-thumb {
  width: 120px; height: 80px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: rgba(255,255,255,0.5);
}
.article-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.article-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-title:hover { color: var(--brand); }
.article-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
  align-items: center;
  flex-wrap: wrap;
}
.article-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--brand);
  border: 1px solid var(--brand);
  background: var(--brand-light);
}
.article-stats { display: flex; gap: 12px; align-items: center; }
.article-stats span { display: flex; align-items: center; gap: 3px; }

@media (max-width: 600px) {
  .article-thumb { width: 80px; height: 56px; }
  .article-title { font-size: 14px; }
  .article-card { padding: 12px 14px; }
}

/* ===== Sidebar Cards ===== */
.sidebar-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.sidebar-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.sidebar-card ul { list-style: none; }
.sidebar-card li { padding: 5px 0; }
.sidebar-card li a { font-size: 13px; color: var(--text-secondary); }
.sidebar-card li a:hover { color: var(--brand); }

/* ===== Article Detail ===== */
.article-header { margin-bottom: 20px; }
.article-header h1 { font-size: 24px; line-height: 1.4; margin-bottom: 12px; color: var(--text); }
.article-header .meta { display: flex; gap: 14px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; align-items: center; }
.article-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}
.article-content h2 { font-size: 20px; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.article-content h3 { font-size: 17px; margin: 20px 0 10px; }
.article-content p { margin-bottom: 14px; }
.article-content code {
  background: #f8f9fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #e74c3c;
}
.article-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
}
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.article-content th, .article-content td { border: 1px solid var(--border-dark); padding: 8px 12px; font-size: 13px; text-align: left; }
.article-content th { background: #f8f9fa; font-weight: 600; }
.article-content blockquote {
  border-left: 3px solid var(--brand);
  padding: 10px 16px;
  background: var(--brand-light);
  margin: 14px 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.article-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 30px;
}
.article-author img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

/* TOC Sidebar */
.toc-item { display: block; padding: 4px 0 4px 0; font-size: 13px; color: var(--text-muted); border-left: 2px solid transparent; padding-left: 10px; transition: all 0.2s; }
.toc-item:hover, .toc-item.active { color: var(--brand); border-left-color: var(--brand); }
.toc-item.toc-h3 { padding-left: 24px; font-size: 12px; }

/* ===== Comments ===== */
.comment-list { margin-top: 20px; }
.comment-item {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; color: var(--text); }
.comment-time { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.comment-content { font-size: 14px; margin-top: 4px; color: var(--text-secondary); }

/* ===== Forms ===== */
.form-page {
  max-width: 400px;
  margin: 60px auto;
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.form-page h2 { font-size: 22px; margin-bottom: 24px; text-align: center; color: var(--text); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--brand); }
.form-group textarea { min-height: 200px; resize: vertical; }
.btn {
  display: inline-block;
  padding: 8px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-block { width: 100%; }
.form-error { color: #f56c6c; font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fef0f0; border-radius: 4px; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 20px 0; }
.pagination a, .pagination span {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--border-dark);
  color: var(--text-secondary);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== Profile Page ===== */
.profile-header {
  display: flex;
  gap: 20px;
  padding: 24px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.profile-info .bio { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.profile-stats { display: flex; gap: 20px; }
.profile-stats span { font-size: 13px; color: var(--text-secondary); }
.profile-stats b { color: var(--text); }

/* ===== Admin ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: #f8f9fa; font-weight: 600; color: var(--text-secondary); }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; }
.status-approved { background: #e8f5e9; color: #4caf50; }
.status-pending { background: #fff8e1; color: #ff9800; }
.status-rejected { background: #fce4ec; color: #f44336; }

/* ===== 404 ===== */
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 72px; color: var(--border-dark); margin-bottom: 12px; }
.error-page p { color: var(--text-muted); margin-bottom: 20px; }

/* ===== Hero Section (Homepage) ===== */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
  padding: 80px 20px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(252,85,49,0.08) 0%, transparent 60%),
              radial-gradient(circle at 70% 50%, rgba(102,126,234,0.06) 0%, transparent 60%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow {
  0% { transform: translate(0, 0); }
  100% { transform: translate(20px, -10px); }
}
.hero-inner { max-width: 900px; margin: 0 auto; position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  background: rgba(252,85,49,0.15);
  color: #ff9f7c;
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid rgba(252,85,49,0.25);
}
.hero h1 {
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 30%, #ffb8a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-bottom: 48px; flex-wrap: wrap; }
.btn-hero-primary {
  padding: 12px 32px;
  border-radius: 25px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-hero-primary:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(252,85,49,0.3); }
.btn-hero-secondary {
  padding: 12px 32px;
  border-radius: 25px;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-hero-secondary:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

/* Hero Stats */
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.hero-stat { text-align: center; }
.hero-stat-num { display: block; font-size: 36px; font-weight: 800; color: #fff; line-height: 1.2; }
.hero-stat-label { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 4px; }

/* Feature Cards */
.features { background: var(--card); padding: 60px 20px; }
.features-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 28px 22px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.feature-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.feature-icon { font-size: 40px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }
.feature-card a { font-size: 13px; color: var(--brand); font-weight: 500; }

/* Latest Articles Section */
.latest-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.section-header h2 { font-size: 22px; color: var(--text); font-weight: 700; }
.section-more { font-size: 14px; color: var(--brand); }
.section-more:hover { text-decoration: underline; }

/* Article Grid (homepage) */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.article-card-grid {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  text-decoration: none;
  border: 1px solid var(--border);
}
.article-card-grid:hover { box-shadow: var(--shadow-card); border-color: var(--brand); transform: translateY(-1px); }
.acg-thumb {
  width: 80px; height: 60px;
  border-radius: 6px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
}
.acg-letter { font-size: 24px; color: rgba(255,255,255,0.6); font-weight: 700; }
.acg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acg-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.acg-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 6px;
}
.acg-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}
.acg-stats, .acg-time, .acg-author { white-space: nowrap; }

.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
}
.empty-state a { color: var(--brand); }

@media (max-width: 768px) {
  .hero h1 { font-size: 32px; }
  .hero-stats { gap: 24px; }
  .hero-stat-num { font-size: 28px; }
  .features-inner { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .features-inner { grid-template-columns: 1fr; }
  .hero { padding: 48px 16px 40px; }
}

/* Remove old homepage-only styles */
.article-card, .sidebar { display: none; }

/* ===== Article Compact List ===== */
.article-compact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.article-compact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.article-compact-item:hover {
  border-color: var(--brand);
  background: var(--card-hover);
}
.acomp-cat {
  font-size: 11px;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.acomp-title {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acomp-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .article-compact-item { flex-wrap: wrap; gap: 6px; }
  .acomp-meta { margin-left: auto; }
}

/* ===== Visit Stats (Footer) ===== */
.visit-stats {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 0 20px;
}
.visit-stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.visit-stat {
  text-align: center;
}
.visit-stat-num {
  font-size: 22px;
  font-weight: 700;
  display: block;
}
.visit-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}
@media (max-width: 600px) {
  .visit-stats-inner { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
