/* Nexlayer Better Docs — elizaga.dev */
:root {
  --bg: #0a0a0a;
  --surface: #0f0f0f;
  --surface2: #151515;
  --border: #1e1e1e;
  --border2: #2a2a2a;
  --text: #f0f0f0;
  --text2: #878593;
  --text3: #4a4a4a;
  --accent: #22b7cb;
  --accent-dim: rgba(34, 183, 203, 0.1);
  --accent-border: rgba(34, 183, 203, 0.25);
  --green: #22c55e;
  --green-dim: #14532d;
  --yellow: #eab308;
  --red: #ef4444;
  --purple: #a855f7;
  --purple-dim: #3b1d6e;
  --code-bg: #080808;
  --radius: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

/* ── Layout ─────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

nav.sidebar {
  width: 240px;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  z-index: 100;
}

nav.sidebar::-webkit-scrollbar { width: 4px; }
nav.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-logo {
  padding: 1rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-logo a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-logo .nx-logo-svg {
  height: 20px;
  width: auto;
}
.sidebar-logo .logo-badge {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: fit-content;
}

.nav-section {
  padding: 0 1rem;
  margin-bottom: 0.25rem;
}
.nav-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 0.875rem 0.25rem 0.375rem;
  font-weight: 600;
}
.nav-link {
  display: block;
  padding: 0.375rem 0.625rem;
  color: var(--text2);
  text-decoration: none;
  border-radius: 5px;
  font-size: 0.875rem;
  transition: background 0.1s, color 0.1s;
}
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; border-left: 2px solid var(--accent); margin-left: -2px; }
.nav-link .nav-badge {
  float: right;
  font-size: 0.625rem;
  background: var(--green-dim);
  color: var(--green);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

main.content {
  margin-left: 240px;
  flex: 1;
  max-width: 860px;
  padding: 3rem 2.5rem;
}

/* ── Mobile nav ─────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 200;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  nav.sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  nav.sidebar.open { transform: translateX(0); }
  main.content { margin-left: 0; padding: 2rem 1.25rem; }
}

/* ── Typography ─────────────────────────── */
h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.75rem; }
h2 { font-size: 1.375rem; font-weight: 600; margin: 2.5rem 0 1rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.0625rem; font-weight: 600; margin: 1.75rem 0 0.625rem; }
h4 { font-size: 0.9375rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: var(--text2); }
p { margin-bottom: 0.875rem; color: var(--text2); }
p strong { color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0.5rem 0 0.875rem 1.25rem; color: var(--text2); }
li { margin-bottom: 0.25rem; }
li strong { color: var(--text); }

/* ── Sections ───────────────────────────── */
.section { margin-bottom: 3rem; }
.section-anchor { display: block; position: relative; top: -80px; visibility: hidden; }

.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-header p {
  font-size: 1rem;
  color: var(--text2);
  margin-top: 0.5rem;
  margin-bottom: 0;
}
.page-header .meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.875rem;
  flex-wrap: wrap;
}
.badge {
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-blue   { background: rgba(34,183,203,0.12); border: 1px solid rgba(34,183,203,0.3); color: #22b7cb; }
.badge-green  { background: rgba(34,197,94,0.10);  border: 1px solid rgba(34,197,94,0.25); color: var(--green); }
.badge-purple { background: var(--purple-dim); border: 1px solid rgba(168,85,247,0.25); color: var(--purple); }

/* ── Tool cards ─────────────────────────── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem;
  cursor: pointer;
  user-select: none;
}
.tool-header:hover { background: var(--surface2); }
.tool-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.tool-meta { flex: 1; }
.tool-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
}
.tool-desc { font-size: 0.8125rem; color: var(--text2); margin-top: 0.25rem; }
.tool-chevron {
  color: var(--text3);
  font-size: 0.75rem;
  margin-top: 6px;
  transition: transform 0.2s;
}
.tool-card.open .tool-chevron { transform: rotate(90deg); }
.tool-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}
.tool-card.open .tool-body { display: block; }

/* ── Params table ───────────────────────── */
.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.875rem 0;
  font-size: 0.8125rem;
}
.params-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  color: var(--text3);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom: 1px solid var(--border2);
}
.params-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
}
.params-table tr:last-child td { border-bottom: none; }
.param-name {
  font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
  color: var(--text);
  white-space: nowrap;
}
.param-type {
  font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
  color: var(--purple);
  font-size: 0.75rem;
}
.param-req {
  color: var(--yellow);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}
.param-opt { color: var(--text3); font-size: 0.6875rem; }

/* ── Code blocks ─────────────────────────── */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  overflow-x: auto;
  margin: 0.875rem 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
}
code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
  font-size: 0.8125rem;
  background: var(--surface2);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  color: var(--text);
}
pre code { background: none; padding: 0; font-size: inherit; }

.code-label {
  font-size: 0.6875rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Syntax highlight colors */
.kw { color: #c792ea; }    /* keyword */
.str { color: #c3e88d; }   /* string */
.num { color: #f78c6c; }   /* number */
.cmt { color: #546e7a; font-style: italic; } /* comment */
.key { color: #82aaff; }   /* yaml key */
.val { color: #c3e88d; }   /* yaml value */
.op  { color: #89ddff; }   /* operator */

/* ── Callouts ────────────────────────────── */
.callout {
  border-left: 3px solid;
  padding: 0.875rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-size: 0.875rem;
}
.callout p { margin: 0; }
.callout-title {
  font-weight: 600;
  font-size: 0.8125rem;
  margin-bottom: 0.25rem;
}
.callout-tip { border-color: var(--green); background: rgba(34,197,94,0.06); }
.callout-tip .callout-title { color: var(--green); }
.callout-note { border-color: var(--accent); background: rgba(59,130,246,0.06); }
.callout-note .callout-title { color: var(--accent); }
.callout-warn { border-color: var(--yellow); background: rgba(234,179,8,0.06); }
.callout-warn .callout-title { color: var(--yellow); }

/* ── Schema table ───────────────────────── */
.schema-section { margin: 1rem 0; }
.schema-field {
  display: grid;
  grid-template-columns: 200px 80px 1fr;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  align-items: start;
}
.schema-field:last-child { border-bottom: none; }
.schema-key {
  font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
  color: var(--text);
}
.schema-key .req { color: var(--yellow); font-size: 0.625rem; vertical-align: super; margin-left: 2px; }
.schema-type { color: var(--purple); font-family: monospace; }
.schema-desc { color: var(--text2); }

/* ── API endpoint cards ──────────────────── */
.endpoint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border);
}
.method {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.method-get { background: rgba(34,197,94,0.15); color: var(--green); }
.method-post { background: rgba(34,183,203,0.12); color: var(--accent); }
.endpoint-path {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}
.endpoint-desc { font-size: 0.8125rem; color: var(--text2); margin-left: auto; }
.endpoint-body { padding: 1rem 1.125rem; }

/* ── TOC / Quick nav ─────────────────────── */
.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.quick-nav a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text2);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.quick-nav a:hover { border-color: var(--accent); color: var(--accent); }

/* ── Install block ───────────────────────── */
.install-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.install-block code {
  flex: 1;
  background: none;
  font-size: 0.9rem;
}
.copy-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text3);
  cursor: pointer;
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  transition: color 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.copy-btn:hover { color: var(--text); border-color: var(--text3); }
.copy-btn.copied { color: var(--green); border-color: var(--green-dim); }

/* ── Tool icon colors — Nexlayer cyan theme ─ */
.icon-deploy  { background: rgba(34,183,203,0.12); color: #22b7cb; }
.icon-logs    { background: rgba(34,183,203,0.08); color: #5ecfdc; }
.icon-health  { background: rgba(34,197,94,0.10);  color: #4ade80; }
.icon-domain  { background: rgba(34,183,203,0.15); color: #22b7cb; }
.icon-env     { background: rgba(34,183,203,0.08); color: #7dd9e4; }
.icon-scale   { background: rgba(34,183,203,0.12); color: #22b7cb; }
.icon-list    { background: rgba(34,183,203,0.06); color: #5ecfdc; }

footer {
  margin-left: 240px;
  padding: 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text3);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
footer a { color: var(--text3); }
footer a:hover { color: var(--text2); }

/* ── Nexlayer top stripe ─────────────────── */
nav.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #22b7cb, #0f7a8a);
  position: absolute;
  top: 0; left: 0; right: 0;
}

/* ── Nexlayer accent glow on tool open ───── */
.tool-card.open {
  border-color: var(--accent-border);
}
.tool-card.open .tool-header { border-bottom-color: var(--accent-border); }

/* ── Gradient heading ────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #22b7cb 0%, #7dd9e4 60%, #e0f7fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Nexlayer wordmark in footer ─────────── */
.nx-footer-logo { height: 14px; width: auto; vertical-align: middle; opacity: 0.5; }
.nx-footer-logo:hover { opacity: 0.8; }

@media (max-width: 768px) {
  footer { margin-left: 0; padding: 1.5rem 1.25rem; }
}
