/* ===== CSS Variables ===== */
:root {
  --accent-color: #d63384;
  --accent-light: #f8d7e8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #2c3e50;
  --border-color: #e9ecef;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --transition: all 0.3s ease;
}

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

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-color);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul {
  list-style: none;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.three-column {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 24px;
  padding: 24px 0;
}

/* ===== Header ===== */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.logo span {
  color: var(--text-primary);
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}

.nav a.active,
.nav a:hover {
  color: var(--accent-color);
}

.nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 8px 16px;
  width: 240px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.875rem;
}

.search-box button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, #6f42c1 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  height: fit-content;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.sidebar-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.sidebar-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.sidebar-list .count {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== Widget ===== */
.widget {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.widget:last-child {
  margin-bottom: 0;
}

.widget-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ===== Card ===== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 20px;
}

.card-category {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
}

.card-title a:hover {
  color: var(--accent-color);
}

.card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Content List ===== */
.content-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content-item {
  display: flex;
  gap: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.content-item:hover {
  box-shadow: var(--shadow-hover);
}

.content-item-image {
  width: 200px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.content-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-item-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.content-item-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  flex: 1;
}

.content-item-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== Featured Grid ===== */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.featured-grid .card:first-child {
  grid-column: span 2;
}

.featured-grid .card:first-child .card-image {
  height: 300px;
}

.featured-grid .card:first-child .card-title {
  font-size: 1.5rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb a:hover {
  color: var(--accent-color);
}

.breadcrumb .separator {
  color: var(--text-muted);
}

/* ===== Article ===== */
.article-header {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.article-meta .author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-meta .author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.article-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.article-content {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 32px;
  font-size: 1rem;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 32px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 24px 0 12px;
}

.article-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.article-content img {
  border-radius: var(--radius);
  margin: 24px 0;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
  list-style: disc;
}

.article-content ol li {
  list-style: decimal;
}

/* ===== Author Widget ===== */
.author-widget {
  text-align: center;
}

.author-widget .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
}

.author-widget .name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.author-widget .bio {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.author-widget .stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.author-widget .stats-item {
  text-align: center;
}

.author-widget .stats-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-color);
}

.author-widget .stats-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== TOC ===== */
.toc {
  position: sticky;
  top: 100px;
}

.toc ul {
  padding-left: 0;
}

.toc li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.toc a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: block;
}

.toc a:hover {
  color: var(--accent-color);
}

.toc .h2 {
  padding-left: 0;
}

.toc .h3 {
  padding-left: 16px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.pagination a {
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.pagination a:hover {
  background: var(--accent-color);
  color: #fff;
}

.pagination .current {
  background: var(--accent-color);
  color: #fff;
}

.pagination .prev,
.pagination .next {
  width: auto;
  padding: 0 16px;
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.tag:hover {
  background: var(--accent-color);
  color: #fff;
}

/* ===== Hot Rankings ===== */
.hot-list {
  counter-reset: hot;
}

.hot-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.hot-list li::before {
  counter-increment: hot;
  content: counter(hot);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hot-list li:nth-child(-n+3)::before {
  background: var(--accent-color);
  color: #fff;
}

.hot-list a {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.hot-list a:hover {
  color: var(--accent-color);
}

/* ===== 404 Page ===== */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.error-message {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: var(--accent-color);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  transition: var(--transition);
}

.btn:hover {
  background: #b52a6f;
  color: #fff;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-dark);
  color: #fff;
  padding: 48px 0 24px;
  margin-top: 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}

.footer-brand .logo {
  color: #fff;
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .three-column {
    grid-template-columns: 180px 1fr;
  }

  .sidebar-right {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 16px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 16px;
  }

  .search-box {
    width: auto;
    flex: 1;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .three-column {
    grid-template-columns: 1fr;
  }

  .sidebar-left {
    display: none;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-grid .card:first-child {
    grid-column: span 1;
  }

  .featured-grid .card:first-child .card-image {
    height: 200px;
  }

  .content-item {
    flex-direction: column;
  }

  .content-item-image {
    width: 100%;
    height: 200px;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-image {
    height: 250px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .error-code {
    font-size: 5rem;
  }
}

@media (max-width: 480px) {
  .nav {
    font-size: 0.875rem;
    gap: 12px;
  }

  .card-body {
    padding: 16px;
  }

  .article-header,
  .article-content {
    padding: 20px;
  }
}
