:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --success: #3fb950;
  --warning: #d29922;
  --border: #30363d;
  --code-bg: #1f2428;
  --sidebar-width: 280px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 28px;
  height: 28px;
}

.logo-icon svg path:first-child {
  fill: url(#logo-gradient);
}

.logo-icon svg path:last-child {
  fill: #fff;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Search */
.search-container {
  position: relative;
}

.search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px 8px 36px;
  color: var(--text-primary);
  font-size: 14px;
  width: 200px;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  width: 260px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-category {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

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

.search-result-item:hover {
  background: var(--bg-tertiary);
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.search-result-title mark {
  background: rgba(88, 166, 255, 0.3);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.search-no-results {
  padding: 24px 16px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 14px;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 0;
}

.header-nav a:hover {
  color: var(--text-primary);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 60px);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  margin-bottom: 4px;
}

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

.sidebar-links a:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-links a.active {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
}

/* Main Content */
.main {
  margin-left: var(--sidebar-width);
  margin-top: 60px;
  padding: 48px;
  max-width: 900px;
}

/* Main Content Container (for index.html) */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: 60px;
  padding: 0 48px 48px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 60px 0 40px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-section h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-section .code-block {
  max-width: 500px;
  margin: 32px auto 0;
  text-align: left;
}

/* Legacy Hero */
.hero {
  text-align: center;
  padding: 80px 48px;
  margin-left: var(--sidebar-width);
  margin-top: 60px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--bg-primary);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

/* Code Blocks */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 24px 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.code-block code {
  color: var(--text-primary);
}

/* Syntax Highlighting */
.keyword {
  color: #ff7b72;
}

.string {
  color: #a5d6ff;
}

.comment {
  color: #8b949e;
}

.function {
  color: #d2a8ff;
}

.type {
  color: #79c0ff;
}

.number {
  color: #79c0ff;
}

/* Features Section (inside main-content) */
.features-section {
  padding: 20px 0 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

/* Example Section (inside main-content) */
.example-section {
  max-width: 900px;
  margin: 0 auto;
  padding-top: 20px;
}

.example-section h2 {
  font-size: 24px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.example-section h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Features Grid (legacy) */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 48px auto;
  max-width: 1000px;
  padding: 0 48px;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(88, 166, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--accent);
}

.feature-icon svg {
  stroke: var(--accent);
}

.feature-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

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

/* Content Styles */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  margin-bottom: 16px;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 24px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 18px;
  margin-top: 32px;
}

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

code:not(pre code) {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

th,
td {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

td {
  color: var(--text-secondary);
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 24px 0;
  border-left: 4px solid;
}

.alert-info {
  background: rgba(88, 166, 255, 0.1);
  border-color: var(--accent);
}

.alert-warning {
  background: rgba(210, 153, 34, 0.1);
  border-color: var(--warning);
}

.alert-success {
  background: rgba(63, 185, 80, 0.1);
  border-color: var(--success);
}

/* API Card */
.api-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 16px 0;
  overflow: hidden;
}

.api-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.api-method {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.method-get {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.method-post {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent);
}

.method-patch {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

.method-delete {
  background: rgba(248, 81, 73, 0.2);
  color: #f85149;
}

.api-name {
  font-weight: 500;
}

.api-body {
  padding: 20px;
  display: none;
}

.api-card.open .api-body {
  display: block;
}

/* Footer */
.footer {
  margin-left: var(--sidebar-width);
  padding: 48px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main,
  .hero,
  .footer {
    margin-left: 0;
  }

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

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