/**
 * Coding Examples page: VS Code Dark+ style + sidebar
 */
.code-examples-page {
  --vscode-bg: #1e1e1e;
  --vscode-sidebar-bg: #252526;
  --vscode-text: #d4d4d4;
  --vscode-keyword: #569cd6;
  --vscode-string: #ce9178;
  --vscode-number: #b5cea8;
  --vscode-comment: #6a9955;
  --vscode-line-num: #858585;
  --vscode-border: #3c3c3c;
}

.code-examples-page .code-examples-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Sidebar */
.code-examples-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 8rem;
  max-height: calc(100vh - 9rem);
  display: flex;
  flex-direction: column;
  background: var(--vscode-sidebar-bg);
  border-radius: 8px;
  border: 1px solid var(--vscode-border);
  overflow: hidden;
}

.code-examples-sidebar .sidebar-search {
  padding: 0.75rem;
  border-bottom: 1px solid var(--vscode-border);
  background: var(--vscode-sidebar-bg);
}

.code-examples-sidebar .sidebar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2rem;
  border: 1px solid var(--vscode-border);
  border-radius: 4px;
  background: var(--vscode-bg);
  color: var(--vscode-text);
  font-size: 0.875rem;
}

.code-examples-sidebar .sidebar-search input::placeholder {
  color: var(--vscode-line-num);
}

.code-examples-sidebar .sidebar-nav {
  overflow-y: auto;
  padding: 0.5rem 0;
}

.code-examples-sidebar .sidebar-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--vscode-text);
  text-decoration: none;
  font-size: 0.9375rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.code-examples-sidebar .sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
}

.code-examples-sidebar .sidebar-nav a.active {
  background: rgba(255,255,255,0.08);
  border-left-color: var(--primary, #4CAF50);
}

.code-examples-sidebar .sidebar-nav a .badge {
  font-size: 0.7rem;
  margin-left: 0.35rem;
}

/* Main content */
.code-examples-main {
  flex: 1;
  min-width: 0;
  padding-left: 1.5rem;
}

@media (max-width: 991px) {
  .code-examples-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
  .code-examples-main { padding-left: 0; padding-top: 1rem; }
}

/* Section per language */
.code-example-section {
  scroll-margin-top: 8rem;
  margin-bottom: 2.5rem;
}

.code-example-section h2 {
  font-size: 1.25rem;
  color: var(--heading);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

/* Description content before/after code (multiple paragraphs) */
.code-example-content {
  margin-bottom: 1.5rem;
  color: var(--text, #333);
  line-height: 1.6;
}

.code-example-content p {
  margin-bottom: 0.75rem;
}

.code-example-content p:last-child {
  margin-bottom: 0;
}

.code-example-content ul,
.code-example-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.code-example-content li {
  margin-bottom: 0.25rem;
}

.code-example-content code {
  background: rgba(0,0,0,0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.code-example-content h3,
.code-example-content h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.code-example-placeholder {
  padding: 1rem 0;
  color: var(--text, #333);
}

.code-example-placeholder .examples-intro {
  margin-bottom: 0.5rem;
}

.code-example-block {
  margin-bottom: 1.5rem;
}

.code-example-block h3 {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* VS Code style code block */
.vscode-code-wrap {
  background: var(--vscode-bg);
  border: 1px solid var(--vscode-border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.5;
}

.vscode-code-wrap .code-block-header {
  padding: 0.35rem 0.75rem;
  background: rgba(0,0,0,0.2);
  color: var(--vscode-line-num);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--vscode-border);
}

.vscode-code-wrap pre {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: var(--vscode-text);
}

.vscode-code-wrap pre code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.8125rem;
  background: none !important;
  padding: 0 !important;
}

/* Prism VS Code Dark+ overrides when Prism is loaded */
.vscode-code-wrap pre[class*="language-"] {
  padding: 1rem 1.25rem;
}

.vscode-code-wrap .token.comment,
.vscode-code-wrap .token.prolog,
.vscode-code-wrap .token.doctype,
.vscode-code-wrap .token.cdata { color: var(--vscode-comment); }
.vscode-code-wrap .token.keyword { color: var(--vscode-keyword); }
.vscode-code-wrap .token.string { color: var(--vscode-string); }
.vscode-code-wrap .token.number { color: var(--vscode-number); }
.vscode-code-wrap .token.operator { color: #d4d4d4; }
.vscode-code-wrap .token.punctuation { color: #d4d4d4; }
.vscode-code-wrap .token.function { color: #dcdcaa; }
.vscode-code-wrap .token.variable { color: #9cdcfe; }
