/* MCPSpec Documentation - Shared Styles */

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --brand: #3b82f6;
  --brand-light: #60a5fa;
  --brand-dark: #2563eb;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255,255,255,0.05);
  --border-light: rgba(255,255,255,0.1);
  --sidebar-w: 260px;
  --toc-w: 200px;
  --nav-h: 64px;
  --content-max: 800px;
}

/* ---- Base ---- */
html { scroll-padding-top: calc(var(--nav-h) + 1rem); }
* { box-sizing: border-box; }

/* ---- Gradients ---- */
.gradient-hero { background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 50%, var(--navy-900) 100%); }
.gradient-card { background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%); }
.glow { box-shadow: 0 0 40px rgba(59,130,246,0.15); }

/* ---- Prism overrides ---- */
pre[class*="language-"] { margin: 0; border-radius: 0.5rem; font-size: 0.875rem; }
code[class*="language-"] { font-size: 0.875rem; }

/* ---- Code block wrapper ---- */
.code-block { position: relative; }
.code-block .copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  padding: 0.25rem 0.5rem; border-radius: 0.25rem;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-dim); font-size: 0.75rem; cursor: pointer;
  opacity: 0; transition: opacity 0.2s;
}
.code-block:hover .copy-btn { opacity: 1; }
.code-block .copy-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.copy-btn.copied { color: #4ade80 !important; }

/* ---- Terminal output ---- */
.terminal-output {
  background: var(--navy-900); border: 1px solid var(--border-light);
  border-radius: 0.5rem; padding: 1rem; font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.875rem; color: #cbd5e1; line-height: 1.6; overflow-x: auto;
}

/* ---- Nav tabs ---- */
.nav-tab { padding: 0.375rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem; transition: all 0.15s; }
.nav-tab:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-tab.active { color: #fff; background: rgba(59,130,246,0.15); }

/* ---- Docs layout ---- */
.docs-layout { display: flex; min-height: calc(100vh - var(--nav-h)); }

.docs-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: var(--nav-h); bottom: 0; left: 0;
  overflow-y: auto; padding: 1.5rem 1rem;
  border-right: 1px solid var(--border);
  background: var(--navy-900);
  z-index: 30;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--navy-700); border-radius: 2px; }

.docs-content {
  flex: 1; max-width: var(--content-max);
  margin-left: var(--sidebar-w); padding: 2rem 2.5rem 4rem;
}

.docs-toc {
  width: var(--toc-w); flex-shrink: 0;
  position: fixed; top: var(--nav-h); right: 0; bottom: 0;
  overflow-y: auto; padding: 1.5rem 1rem;
  border-left: 1px solid var(--border);
  display: none;
}
.docs-toc::-webkit-scrollbar { width: 4px; }
.docs-toc::-webkit-scrollbar-thumb { background: var(--navy-700); border-radius: 2px; }

/* Sidebar nav items */
.sidebar-group-title {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-dim);
  padding: 0.75rem 0.5rem 0.375rem; margin-top: 0.75rem;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.sidebar-group-title:first-child { margin-top: 0; }
.sidebar-group-title .chevron {
  transition: transform 0.2s; font-size: 0.625rem;
}
.sidebar-group-title.collapsed .chevron { transform: rotate(-90deg); }
.sidebar-group.collapsed .sidebar-links { display: none; }

.sidebar-link {
  display: block; padding: 0.3rem 0.5rem 0.3rem 0.75rem;
  font-size: 0.8125rem; color: var(--text-muted); border-radius: 0.25rem;
  text-decoration: none; transition: all 0.1s;
  border-left: 2px solid transparent;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.04); }
.sidebar-link.active {
  color: var(--brand-light); background: rgba(59,130,246,0.08);
  border-left-color: var(--brand);
}

/* TOC items */
.toc-title {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-dim);
  padding: 0.75rem 0 0.5rem;
}
.toc-link {
  display: block; padding: 0.2rem 0; font-size: 0.75rem;
  color: var(--text-dim); text-decoration: none; transition: color 0.1s;
  border-left: 2px solid transparent; padding-left: 0.75rem;
}
.toc-link:hover { color: var(--text-muted); }
.toc-link.active { color: var(--brand-light); border-left-color: var(--brand); }
.toc-link.toc-h3 { padding-left: 1.25rem; }

/* Docs content typography */
.docs-content h2 {
  font-size: 1.5rem; font-weight: 700; color: #fff;
  margin-top: 3rem; margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 {
  font-size: 1.125rem; font-weight: 600; color: #e2e8f0;
  margin-top: 2rem; margin-bottom: 0.75rem;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
.docs-content p { color: var(--text-muted); line-height: 1.7; margin-bottom: 1rem; }
.docs-content ul, .docs-content ol { color: var(--text-muted); margin-bottom: 1rem; padding-left: 1.5rem; }
.docs-content li { margin-bottom: 0.375rem; line-height: 1.6; }
.docs-content strong { color: #e2e8f0; }
.docs-content code:not([class*="language-"]) {
  background: rgba(255,255,255,0.06); padding: 0.125rem 0.375rem;
  border-radius: 0.25rem; font-size: 0.8125rem; color: var(--brand-light);
}
.docs-content a { color: var(--brand-light); text-decoration: none; }
.docs-content a:hover { text-decoration: underline; }
.docs-content .code-block { margin-bottom: 1.25rem; }
.docs-content table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.25rem;
  font-size: 0.875rem;
}
.docs-content th {
  text-align: left; padding: 0.5rem 0.75rem; color: var(--text-dim);
  border-bottom: 1px solid var(--border-light); font-weight: 600;
}
.docs-content td {
  padding: 0.5rem 0.75rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.docs-content blockquote {
  border-left: 3px solid var(--brand); padding: 0.75rem 1rem;
  background: rgba(59,130,246,0.05); border-radius: 0 0.5rem 0.5rem 0;
  margin-bottom: 1.25rem;
}
.docs-content blockquote p { margin-bottom: 0; }

/* Mobile sidebar overlay */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 29;
}
.sidebar-backdrop.visible { display: block; }

/* ---- Responsive ---- */
@media (min-width: 1280px) {
  .docs-toc { display: block; }
  .docs-content { margin-right: var(--toc-w); }
}

@media (max-width: 1023px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 280px;
  }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-content { margin-left: 0; padding: 1.5rem 1rem 3rem; }
}

/* ---- Examples page ---- */
.example-card {
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  border: 1px solid var(--border); border-radius: 0.75rem;
  padding: 1.5rem; transition: border-color 0.2s;
}
.example-card:hover { border-color: rgba(59,130,246,0.3); }

.collapsible-code { position: relative; }
.collapsible-code.collapsed { max-height: 240px; overflow: hidden; }
.collapsible-code.collapsed::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 60px; background: linear-gradient(transparent, var(--navy-900));
  pointer-events: none;
}
.toggle-code {
  display: inline-block; margin-top: 0.5rem; font-size: 0.75rem;
  color: var(--brand-light); cursor: pointer; padding: 0.25rem 0;
}
.toggle-code:hover { text-decoration: underline; }

/* ---- Utility ---- */
.badge {
  display: inline-block; padding: 0.125rem 0.5rem; border-radius: 9999px;
  font-size: 0.6875rem; font-weight: 500;
}
.badge-green { background: rgba(74,222,128,0.1); color: #4ade80; }
.badge-yellow { background: rgba(250,204,21,0.1); color: #facc15; }
.badge-blue { background: rgba(59,130,246,0.1); color: #60a5fa; }

@media (max-width: 768px) {
  .features-grid { grid-template-columns: 1fr !important; }
}
