/* ============================================
   Backend Learning Theme - Main Styles
   后端学习记录主题 - 主样式
   ============================================ */

/* CSS Variables */
:root {
  /* Colors */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary: #06b6d4;
  --accent: #f59e0b;

  /* Background */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;

  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Border */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Spacing - 更紧凑 */
  --container-width: 1100px;
  --sidebar-width: 280px;

  /* Font */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #334155;
  --border-light: #1e293b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100vh;
}

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

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

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

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

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

.header-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

/* Logo */
.site-brand .logo-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 1.25rem;
}

.site-brand .logo img {
  height: 28px;
}

/* Navigation */
.main-nav .nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--bg-secondary);
}

.nav-icon {
  font-size: 1.1em;
}

/* Dropdown */
.has-dropdown {
  position: relative;
}

.dropdown-arrow {
  opacity: 0.6;
  transition: transform 0.2s;
}

.has-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 8px;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.dropdown-menu a:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

/* Header Tools */
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-form {
  position: relative;
}

.search-form input {
  width: 180px;
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-secondary);
  font-size: 0.8125rem;
  transition: all 0.2s;
}

.search-form input:focus {
  outline: none;
  border-color: var(--primary);
  width: 200px;
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.write-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  padding: 20px;
  z-index: 99;
}

.mobile-nav.active {
  display: block;
}

.mobile-nav-list {
  list-style: none;
}

.mobile-nav-list li {
  border-bottom: 1px solid var(--border-light);
}

.mobile-nav-list a {
  display: block;
  padding: 16px 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.page-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
}

.page-overlay.active {
  display: block;
}

/* ============================================
   Hero Section
   ============================================ */
.learning-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 40px 0;
  color: white;
}

.hero-content {
  text-align: center;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-desc {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 24px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 4px;
}

.stat-number {
  display: block;
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.8125rem;
  opacity: 0.9;
}

/* ============================================
   Tech Stack Section (Sidebar)
   ============================================ */
.tech-stack-widget {
  padding: 16px;
}

.tech-stack-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-group-compact h5 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.tech-tags-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tech-tag-compact {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: transform 0.2s;
}

.tech-tag-compact:hover {
  transform: scale(1.05);
}

/* Tech Tag Colors */
.lang-java { background: #fef3c7; color: #92400e; }
.lang-go { background: #e0f2fe; color: #075985; }
.lang-python { background: #dbeafe; color: #1e40af; }
.lang-rust { background: #ffe4e6; color: #9f1239; }
.db-mysql { background: #d1fae5; color: #065f46; }
.db-redis { background: #fee2e2; color: #991b1b; }
.db-mongo { background: #dcfce7; color: #166534; }
.db-es { background: #fef9c3; color: #854d0e; }
.mq-kafka { background: #e0e7ff; color: #3730a3; }
.mq-rabbit { background: #fce7f3; color: #9d174d; }
.dev-docker { background: #dbeafe; color: #1e40af; }
.dev-k8s { background: #e0e7ff; color: #3730a3; }

/* ============================================
   Learning Record Widget
   ============================================ */
.learning-record {
  background: var(--bg-primary);
  padding: 16px;
}

.learning-record .widget-title {
  color: var(--text-primary);
  border-bottom-color: var(--border-light);
}

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

.stats-mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}

.stat-mini-item {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 10px 4px;
}

.stat-mini-value {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.stat-mini-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  padding: 24px 0;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 24px;
}

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

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.section-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-icon {
  font-size: 1.25rem;
}

/* ============================================
   Note Cards
   ============================================ */
.note-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  border-left: 3px solid var(--primary);
}

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

.note-header {
  margin-bottom: 12px;
}

.note-category {
  margin-bottom: 6px;
}

.note-category a {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-tertiary);
  color: var(--primary);
  border-radius: 16px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.note-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}

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

.note-title a:hover {
  color: var(--primary);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.meta-item a {
  color: var(--text-muted);
}

.meta-item a:hover {
  color: var(--primary);
}

.note-excerpt {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  font-size: 0.9375rem;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--primary);
  color: white;
  border-radius: 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
}

.read-more:hover {
  background: var(--primary-dark);
  color: white;
}

.read-more svg {
  transition: transform 0.2s;
}

.read-more:hover svg {
  transform: translateX(2px);
}

.note-views {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================
   Sidebar Widgets
   ============================================ */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
  color: var(--text-primary);
}

/* Author Card */
.author-card {
  text-align: center;
}

.author-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  font-size: 2rem;
}

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

.author-bio {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Quick Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-box {
  text-align: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Category Widget */
.category-list {
  list-style: none;
}

.category-item {
  border-bottom: 1px solid var(--border-light);
}

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

.category-item.child {
  padding-left: 16px;
}

.category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.category-link:hover {
  color: var(--primary);
}

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

/* Tag Cloud */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-radius: 20px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tag-item:hover {
  background: var(--primary);
  color: white;
}

/* Recent Notes */
.note-list {
  list-style: none;
}

.note-item {
  border-bottom: 1px solid var(--border-light);
}

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

.note-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.note-link .note-title {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.note-link:hover .note-title {
  color: var(--primary);
}

.note-link .note-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Archive Widget */
.archive-list {
  list-style: none;
}

.archive-item {
  border-bottom: 1px solid var(--border-light);
}

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

.archive-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.archive-link:hover {
  color: var(--primary);
}

.archive-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   Pagination
   ============================================ */
.pagination-nav {
  margin-top: 24px;
}

.pagination-nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.pagination-nav li a,
.pagination-nav li span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

.pagination-nav li a:hover {
  background: var(--primary);
  color: white;
}

.pagination-nav li.current a {
  background: var(--primary);
  color: white;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.9375rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* ============================================
   Note Detail Page
   ============================================ */
.note-detail {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.note-detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.note-categories {
  margin-bottom: 16px;
}

.note-categories a {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-secondary);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-right: 8px;
}

.note-detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.note-detail-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.note-detail-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-tags {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.tags-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.note-tags a {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-left: 8px;
}

.note-tags a:hover {
  background: var(--primary);
  color: white;
}

/* Note Content */
.note-content {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.note-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 28px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}

.note-content h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 24px 0 12px;
}

.note-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 10px;
}

.note-content p {
  margin-bottom: 12px;
}

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

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

.note-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Inline code */
.note-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--primary);
  word-break: break-word;
}

/* Code block container */
.note-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 0;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 0.875rem;
  position: relative;
}

/* Code block content */
.note-content pre code {
  display: block;
  background: none;
  color: inherit;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* Code block with language label */
.note-content pre[class*="language-"] {
  padding-top: 32px;
}

.note-content pre[class*="language-"]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 4px 16px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Syntax highlighting colors (basic) */
.note-content .hljs-keyword,
.note-content .hljs-selector-tag,
.note-content .hljs-literal {
  color: #c678dd;
}

.note-content .hljs-string,
.note-content .hljs-regexp,
.note-content .hljs-addition,
.note-content .hljs-attribute,
.note-content .hljs-meta-string {
  color: #98c379;
}

.note-content .hljs-number,
.note-content .hljs-built_in,
.note-content .hljs-builtin-name,
.note-content .hljs-literal,
.note-content .hljs-type,
.note-content .hljs-params {
  color: #e5c07b;
}

.note-content .hljs-function,
.note-content .hljs-title,
.note-content .hljs-section,
.note-content .hljs-name {
  color: #61afef;
}

.note-content .hljs-comment,
.note-content .hljs-quote,
.note-content .hljs-deletion {
  color: #5c6370;
  font-style: italic;
}

.note-content .hljs-tag,
.note-content .hljs-template-variable,
.note-content .hljs-variable {
  color: #e06c75;
}

.note-content .hljs-attr,
.note-content .hljs-property {
  color: #d19a66;
}

/* Code block with line numbers */
.note-content .hljs-line-numbers {
  position: absolute;
  left: 0;
  top: 32px;
  bottom: 0;
  width: 40px;
  padding: 16px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  text-align: right;
  color: #5c6370;
  font-size: 0.75rem;
  line-height: 1.6;
  user-select: none;
  overflow: hidden;
}

.note-content pre.has-line-numbers code {
  padding-left: 56px;
}

/* Mermaid diagram support */
.note-content pre.mermaid {
  background: var(--bg-secondary);
}

.note-content pre.mermaid code {
  display: none;
}

/* Collapsible details/summary */
.note-content details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
  background: var(--bg-secondary);
}

.note-content summary {
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.note-content summary:hover {
  color: var(--primary);
}

/* Task list */
.note-content .task-list-item {
  list-style: none;
  margin-left: -20px;
}

.note-content .task-list-item input[type="checkbox"] {
  margin-right: 8px;
}

/* Auto-sizing images in editor preview */
.note-content img[src*="#auto"] {
  max-width: 100%;
  height: auto;
}

.note-content img[src*="#small"] {
  max-width: 300px;
}

.note-content img[src*="#medium"] {
  max-width: 500px;
}

.note-content img[src*="#large"] {
  max-width: 800px;
}

.note-content img[src*="#full"] {
  max-width: 100%;
  width: 100%;
}

.note-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 16px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 16px 0;
  display: block;
}

/* Image caption support */
.note-content figure {
  margin: 16px 0;
}

.note-content figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.note-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.note-content th,
.note-content td {
  padding: 10px;
  border: 1px solid var(--border-color);
  text-align: left;
}

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

/* Note Detail Footer */
.note-detail-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.note-share {
  display: flex;
  align-items: center;
  gap: 12px;
}

.note-share span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.share-link:hover {
  background: var(--primary);
  color: white;
}

/* Post Navigation */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 40px;
}

.nav-prev,
.nav-next {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.nav-prev:empty,
.nav-next:empty {
  display: none;
}

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

.nav-prev a,
.nav-next a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.nav-prev a::before {
  content: '← ';
  color: var(--primary);
}

.nav-next a::after {
  content: ' →';
  color: var(--primary);
}

.nav-prev a:hover,
.nav-next a:hover {
  color: var(--primary);
}

/* ============================================
   Comments
   ============================================ */
.comments-section {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}

.comments-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comments-count {
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

.comment-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.comment-avatar {
  flex-shrink: 0;
}

.comment-avatar .avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.comment-body {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-content {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

.comment-actions {
  font-size: 0.8125rem;
}

.comment-actions a {
  color: var(--primary);
}

/* Comment Form */
.comment-form-wrapper {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

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

.logged-in-as {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.logged-in-as .logout-link {
  margin-left: 12px;
  color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.submit-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: var(--primary-dark);
}

/* ============================================
   Page Styles
   ============================================ */
.page-article {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.page-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.page-content {
  font-size: 1rem;
  line-height: 1.8;
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
  padding: 80px 20px;
}

.error-content {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.error-icon {
  font-size: 5rem;
  margin-bottom: 20px;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 16px;
}

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

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

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ============================================
   Search Page
   ============================================ */
.search-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--primary);
}

.search-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.search-query {
  color: var(--text-secondary);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  margin-top: 40px;
}

.footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copyright {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.footer-powered {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.footer-powered .divider {
  margin: 0 6px;
}

/* ============================================
   Back to Top Button
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

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

  .footer-brand {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .search-form {
    display: none;
  }

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

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

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

  .note-detail,
  .page-article {
    padding: 24px;
  }

  .note-detail-title,
  .page-title {
    font-size: 1.375rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

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

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

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

  .stat-card {
    padding: 16px 12px;
  }

  .stat-number {
    font-size: 1.375rem;
  }

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

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .site-header,
  .sidebar,
  .site-footer,
  .back-to-top,
  .comments-section,
  .post-navigation {
    display: none !important;
  }

  .note-detail,
  .page-article {
    box-shadow: none;
    padding: 0;
  }
}
