:root {
  --bg-dark: #0d1117;
  --bg-sidebar: #161b22;
  --bg-card: #1c2128;
  --bg-card-hover: #22272e;
  --bg-code: #161b22;
  --border-color: #30363d;
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.15);
  --accent-purple: #c084fc;
  --accent-green: #4ade80;
  --accent-amber: #fbbf24;
  --accent-red: #f87171;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  --header-height: 64px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.main-header {
  height: var(--header-height);
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logo-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text .title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  color: #fff;
}

.logo-text .subtitle {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
}

.version-badge {
  background: rgba(56, 189, 248, 0.12);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 17, 23, 0.6);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--primary);
  color: #0d1117;
  font-weight: 600;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 12px 6px 30px;
  border-radius: 6px;
  font-size: 13px;
  width: 220px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  width: 280px;
}

.clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

.clear-btn.hidden {
  display: none;
}

/* Language Switcher */
.lang-switch-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 3px 6px;
  border-radius: 6px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn.active {
  background: var(--primary);
  color: #0d1117;
}

.lang-switch-group .divider {
  color: var(--border-color);
  font-size: 12px;
}

/* Workspace */
.workspace {
  display: flex;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: 300px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.count-pill {
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--primary);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-item:hover {
  background: var(--bg-card);
  color: #fff;
}

.sidebar-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.sidebar-item .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 20px;
}

.sidebar-item .title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Content Viewer */
.content-viewer {
  flex: 1;
  padding: 32px 48px;
  min-width: 0;
  max-width: 1000px;
}

/* Markdown Rendering */
.markdown-body {
  font-size: 15px;
  line-height: 1.7;
}

.markdown-body h1 {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 24px;
  color: #fff;
}

.markdown-body h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
  color: #f0f6fc;
}

.markdown-body h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
  color: #e6edf3;
}

.markdown-body p {
  margin-bottom: 16px;
}

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

.markdown-body li {
  margin-bottom: 6px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--primary);
  background: rgba(56, 189, 248, 0.06);
  padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
  color: #c9d1d9;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.markdown-body th, .markdown-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  font-size: 14px;
}

.markdown-body th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: var(--primary);
}

.markdown-body code {
  font-family: var(--font-mono);
  background: rgba(110, 118, 129, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #f0f6fc;
}

.markdown-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 20px;
  position: relative;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #e6edf3;
}

/* Blog Cards Feed */
.blog-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.blog-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.category-badge {
  background: rgba(192, 132, 252, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(192, 132, 252, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.post-date {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.blog-card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.blog-card-summary {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

/* Footer */
.main-footer {
  border-top: 1px solid var(--border-color);
  padding: 24px;
  background: var(--bg-sidebar);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
  .workspace {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 200px;
    position: relative;
    top: 0;
  }

  .content-viewer {
    padding: 24px 20px;
  }
}
