:root {
  --accent-color: #9c27b0;
  --accent-light: #e1bee7;
  --accent-dark: #7b1fa2;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #1a1a2e;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
  --max-width: 1200px;
}

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

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-primary);
}

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

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

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

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.nav {
  display: flex;
  gap: 2rem;
}

.nav a {
  color: var(--text-primary);
  font-weight: 500;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  width: 200px;
  font-size: 0.9rem;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--accent-dark) 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
}

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

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

.hero-search {
  max-width: 500px;
  margin: 0 auto;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
}

/* Quick Links */
.quick-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--bg-secondary);
}

.quick-link {
  padding: 0.75rem 1.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: var(--shadow);
}

.quick-link:hover {
  color: var(--accent-color);
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
}

/* Section Title */
.section-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow 0.3s;
}

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

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Topic List */
.topic-list {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.topic-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topic-item:last-child {
  border-bottom: none;
}

.topic-item:hover {
  background: var(--bg-secondary);
}

/* Three Column Layout */
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.col h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
}

.col ul {
  list-style: none;
}

.col li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-color);
}

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

.col a {
  color: var(--text-primary);
}

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

/* Breadcrumb */
.breadcrumb {
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--text-secondary);
}

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

/* Category Hero */
.category-hero {
  background: var(--bg-secondary);
  padding: 3rem 2rem;
  text-align: center;
}

.category-hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.category-hero p {
  color: var(--text-secondary);
}

/* Module List */
.module-list {
  margin-bottom: 2rem;
}

.module-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.module-item h3 {
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.module-item p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Class Grid */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.class-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.class-item h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.class-item span {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Article Layout */
.article-container {
  display: grid;
  grid-template-columns: 250px 1fr 200px;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
}

.sidebar-left {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sidebar-left h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.sidebar-left p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.article-content {
  min-width: 0;
}

.article-content h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.article-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

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

.code-block {
  background: var(--bg-dark);
  color: #fff;
  padding: 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.param-table th,
.param-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.param-table th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.sidebar-right {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sidebar-right h4 {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.toc {
  list-style: none;
  font-size: 0.9rem;
}

.toc li {
  padding: 0.4rem 0;
}

.toc a {
  color: var(--text-secondary);
}

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

/* Related Articles */
.related-section {
  background: var(--bg-secondary);
  padding: 2rem;
  margin-top: 3rem;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.related-links a {
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.related-links 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: 4rem 2rem;
}

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

.error-title {
  font-size: 2rem;
  margin: 1rem 0;
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent-color);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
}

.btn:hover {
  background: var(--accent-dark);
  color: white;
}

/* Footer */
.footer {
  background: var(--bg-dark);
  color: white;
  padding: 3rem 2rem 2rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  padding: 0.3rem 0;
}

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

.footer-col a:hover {
  color: white;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .article-container {
    grid-template-columns: 1fr;
  }

  .sidebar-left,
  .sidebar-right {
    position: static;
    order: 2;
  }

  .article-content {
    order: 1;
  }
}

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

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

  .search-box {
    display: none;
  }

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

  .quick-links {
    flex-wrap: wrap;
  }

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

  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

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

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