/* 宠物训练 - 交互教程风格 CSS */
:root {
  --accent-color: #9c27b0;
  --accent-light: #e1bee7;
  --accent-dark: #7b1fa2;
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-muted: #9e9e9e;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-code: #263238;
  --border-color: #e0e0e0;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

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

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

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: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

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

.nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
}

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

.search-box {
  position: relative;
}

.search-box input {
  width: 240px;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--bg-primary);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

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

.hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 20px;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 40px;
}

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

.hero-search input {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  box-shadow: var(--shadow-lg);
}

.hero-search input:focus {
  outline: none;
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

.quick-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-link {
  padding: 12px 24px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-link:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Section */
.section {
  padding: 64px 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
  text-align: center;
}

/* Topic Cards */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.topic-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.2s;
}

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

.topic-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.topic-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.topic-card p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Article Lists */
.articles-section {
  background: var(--bg-secondary);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.article-list {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.article-list h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

.article-list ul {
  list-style: none;
}

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

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

.article-list a {
  color: var(--text-primary);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-list a::before {
  content: "•";
  color: var(--accent-color);
  font-weight: bold;
}

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

/* Footer */
.footer {
  background: var(--text-primary);
  color: white;
  padding: 48px 0 24px;
}

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

.footer-brand p {
  opacity: 0.7;
  margin-top: 16px;
  font-size: 14px;
}

.footer h4 {
  font-size: 16px;
  margin-bottom: 20px;
}

.footer ul {
  list-style: none;
}

.footer li {
  margin-bottom: 12px;
}

.footer a {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}

.footer a:hover {
  color: white;
}

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

/* Breadcrumb */
.breadcrumb {
  background: var(--bg-secondary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-muted);
}

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

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

.breadcrumb li:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* Category Page */
.category-header {
  padding: 48px 0;
  text-align: center;
}

.category-header h1 {
  font-size: 36px;
  margin-bottom: 12px;
}

.category-header p {
  color: var(--text-secondary);
  font-size: 18px;
}

.modules-list {
  max-width: 800px;
  margin: 0 auto 48px;
}

.module-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.module-item:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.module-item h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

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

/* Article Page */
.article-layout {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 48px;
  padding: 32px 0;
}

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

.sidebar-left h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.sidebar-left li {
  margin-bottom: 8px;
}

.sidebar-left a {
  color: var(--text-secondary);
  font-size: 14px;
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.sidebar-left a:hover,
.sidebar-left a.active {
  color: var(--accent-color);
  background: var(--accent-light);
}

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

.article-content h1 {
  font-size: 36px;
  margin-bottom: 24px;
}

.article-content h2 {
  font-size: 24px;
  margin: 48px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
  font-size: 20px;
  margin: 32px 0 12px;
}

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

.article-content ul,
.article-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

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

.code-block {
  background: var(--bg-code);
  color: #aed581;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 24px 0;
}

.code-block .comment {
  color: #546e7a;
}

.code-block .keyword {
  color: #c792ea;
}

.tip-box {
  background: #e8f5e9;
  border-left: 4px solid var(--success-color);
  padding: 20px 24px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 24px 0;
}

.tip-box.warning {
  background: #fff3e0;
  border-left-color: var(--warning-color);
}

.tip-box h4 {
  color: var(--success-color);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.tip-box.warning h4 {
  color: var(--warning-color);
}

.tip-box p {
  margin: 0;
  color: var(--text-primary);
}

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

.sidebar-right h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.toc {
  list-style: none;
  border-left: 2px solid var(--border-color);
  padding-left: 16px;
}

.toc li {
  margin-bottom: 12px;
}

.toc a {
  color: var(--text-secondary);
  font-size: 14px;
}

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

/* 404 Page */
.error-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px;
}

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

.error-title {
  font-size: 32px;
  margin-bottom: 16px;
}

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

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent-color);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-layout {
    grid-template-columns: 1fr 280px;
  }

  .sidebar-left {
    display: none;
  }

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

@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .search-box {
    display: none;
  }

  .hero {
    padding: 48px 16px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-desc {
    font-size: 16px;
  }

  .container {
    padding: 0 16px;
  }

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

  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-right {
    display: none;
  }

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

  .quick-links {
    flex-direction: column;
    align-items: center;
  }

  .quick-link {
    width: 200px;
    text-align: center;
  }

  .section {
    padding: 48px 0;
  }

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

@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
  }

  .section-title {
    font-size: 24px;
  }

  .category-header h1 {
    font-size: 28px;
  }

  .article-content h1 {
    font-size: 28px;
  }

  .error-code {
    font-size: 80px;
  }

  .error-title {
    font-size: 24px;
  }
}
