/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f1117;
  --bg-card:    #181c26;
  --bg-sidebar: #13151f;
  --border:     #252836;
  --text:       #d4d8e8;
  --text-muted: #6b7290;
  --accent:     #7c6af7;
  --accent2:    #4ecdc4;
  --danger:     #e74c3c;
  --warn:       #e67e22;
  --info:       #3498db;
  --success:    #2ecc71;
  --radius:     8px;
  --sidebar-w:  260px;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
}
.brand-icon { font-size: 1.3rem; }

.navbar-links { display: flex; gap: 1rem; }
.navbar-links a { color: var(--text-muted); font-size: .9rem; }
.navbar-links a:hover { color: var(--text); text-decoration: none; }

.navbar-search {
  margin-left: auto;
  display: flex;
  gap: .4rem;
}
.navbar-search input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .35rem .75rem;
  font-size: .85rem;
  width: 200px;
  outline: none;
}
.navbar-search input:focus { border-color: var(--accent); }
.navbar-search button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  padding: .35rem .75rem;
  font-size: .85rem;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - 56px - 48px);
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.sidebar-section { margin-bottom: .25rem; }
.sidebar-title {
  padding: .6rem 1rem .3rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.sidebar-title a { color: var(--text-muted); }
.sidebar-title a:hover { color: var(--accent); text-decoration: none; }

.sidebar-link {
  display: block;
  padding: .25rem 1rem .25rem 1.25rem;
  font-size: .83rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color .15s, background .15s;
}
.sidebar-link:hover {
  color: var(--text);
  background: rgba(124,106,247,.08);
  text-decoration: none;
  border-left-color: var(--accent);
}

/* ─── Content ───────────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 2rem 2.5rem;
  min-width: 0;
  max-width: 960px;
}

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.hero-title { font-size: 2.2rem; font-weight: 800; margin-bottom: .5rem; }
.hero-subtitle { color: var(--text-muted); font-size: 1.05rem; }
.hero-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.hero-stats strong { color: var(--accent); }

/* ─── Intro ─────────────────────────────────────────────────────────────────── */
.intro { margin-bottom: 2.5rem; }
.intro h2 { font-size: 1.3rem; margin-bottom: .75rem; }
.intro p { margin-bottom: .75rem; color: var(--text-muted); }

/* ─── Category cards grid ───────────────────────────────────────────────────── */
.categories-grid h2 { font-size: 1.3rem; margin-bottom: 1rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.cat-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color .15s, transform .1s;
  text-decoration: none;
  color: var(--text);
}
.cat-card:hover { transform: translateY(-2px); text-decoration: none; }

.cat-card-name { font-weight: 700; font-size: .95rem; margin-bottom: .25rem; }
.cat-card-count { font-size: .75rem; color: var(--text-muted); margin-bottom: .75rem; }
.cat-card-preview {
  list-style: none;
  font-size: .78rem;
  color: var(--text-muted);
}
.cat-card-preview li { padding: .1rem 0; }
.cat-card-preview .more { font-style: italic; }

/* ─── Node list ─────────────────────────────────────────────────────────────── */
.node-list { display: flex; flex-direction: column; gap: .75rem; }

.node-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s;
}
.node-card:hover { text-decoration: none; background: #1d2133; }

.node-card-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .3rem;
}
.node-card-name { font-weight: 700; font-size: 1rem; }
.node-card-id { font-size: .75rem; color: var(--text-muted); font-family: var(--mono); }
.node-card-desc { font-size: .88rem; color: var(--text-muted); margin-bottom: .4rem; }
.node-cat-badge {
  display: inline-block;
  font-size: .7rem;
  background: rgba(124,106,247,.15);
  color: var(--accent);
  border-radius: 4px;
  padding: .1rem .45rem;
  margin-bottom: .35rem;
}
.node-card-ports { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }

/* ─── Port badges ───────────────────────────────────────────────────────────── */
.port-badge {
  font-size: .72rem;
  border-radius: 4px;
  padding: .1rem .5rem;
}
.port-in  { background: rgba(52,152,219,.15); color: var(--info); }
.port-out { background: rgba(46,204,113,.15); color: var(--success); }

/* ─── Node detail page ──────────────────────────────────────────────────────── */
.page-title { font-size: 1.8rem; font-weight: 800; margin-bottom: .35rem; }
.page-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

.node-header {
  border-left: 5px solid var(--accent);
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.5rem;
}
.node-header-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.node-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  border-radius: 4px;
  padding: .15rem .55rem;
}
.node-id { font-family: var(--mono); font-size: .82rem; color: var(--text-muted); }
.node-title { font-size: 1.7rem; font-weight: 800; margin-bottom: .4rem; }
.node-description { color: var(--text-muted); }

/* ─── Callouts ──────────────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: .9rem;
  border-left: 4px solid;
}
.callout-info { background: rgba(52,152,219,.1); border-color: var(--info); }
.callout-warn { background: rgba(230,126,34,.1); border-color: var(--warn); }
.callout strong { font-weight: 700; }

/* ─── Port tables ───────────────────────────────────────────────────────────── */
.ports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) { .ports-grid { grid-template-columns: 1fr; } }

.ports-section h2, .props-section h2, .examples-section h2 {
  font-size: 1.1rem;
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}

.ports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.ports-table th, .ports-table td {
  text-align: left;
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border);
}
.ports-table th { color: var(--text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.ports-table tbody tr:last-child td { border-bottom: none; }
.ports-table code { font-family: var(--mono); font-size: .82rem; }

.port-name { color: var(--text); font-weight: 500; }

/* ─── Type badges ───────────────────────────────────────────────────────────── */
.type-badge {
  display: inline-block;
  font-size: .72rem;
  font-family: var(--mono);
  border-radius: 4px;
  padding: .1rem .45rem;
  background: rgba(124,106,247,.12);
  color: var(--accent);
}
.type-exec     { background: rgba(241,196,15,.12); color: #f1c40f; }
.type-string   { background: rgba(46,204,113,.12); color: var(--success); }
.type-number   { background: rgba(52,152,219,.12); color: var(--info); }
.type-boolean  { background: rgba(231,76,60,.12);  color: var(--danger); }
.type-player   { background: rgba(155,89,182,.12); color: #9b59b6; }
.type-entity   { background: rgba(230,126,34,.12); color: var(--warn); }
.type-location { background: rgba(26,188,156,.12); color: #1abc9c; }
.type-vector   { background: rgba(52,73,94,.35);   color: #95a5a6; }
.type-list     { background: rgba(78,205,196,.12); color: var(--accent2); }
.type-any      { background: rgba(100,100,100,.2); color: #aaa; }

/* ─── Examples ──────────────────────────────────────────────────────────────── */
.examples-section { margin-top: 1.5rem; }
.example-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.example-title { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; color: var(--text); }
.example-card p { color: var(--text-muted); font-size: .9rem; margin-bottom: .6rem; }
.example-steps { margin-left: 1.2rem; font-size: .88rem; color: var(--text-muted); }
.example-steps li { margin-bottom: .25rem; }

/* ─── Code blocks ───────────────────────────────────────────────────────────── */
.code-block {
  background: #0a0c14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-top: .6rem;
  font-family: var(--mono);
  font-size: .83rem;
  line-height: 1.6;
  color: #c9d1e0;
}
.code-block code { font-family: inherit; background: none; padding: 0; }

code {
  font-family: var(--mono);
  font-size: .85em;
  background: rgba(124,106,247,.1);
  border-radius: 4px;
  padding: .1em .35em;
  color: var(--accent);
}

/* ─── Stats page ────────────────────────────────────────────────────────────── */
.stats-counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 600px) { .stats-counters { grid-template-columns: 1fr; } }

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

.chart-section { margin-bottom: 2.5rem; }
.chart-section h2 { font-size: 1.1rem; margin-bottom: .75rem; }
.chart-range { font-size: .8rem; color: var(--text-muted); font-weight: 400; }
.chart-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.chart-container canvas { max-height: 260px; }
.chart-sm canvas { max-height: 220px; }

.doughnut-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (max-width: 750px) { .doughnut-row { grid-template-columns: 1fr; } }

.submit-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}
.submit-section h2 { font-size: 1.1rem; margin-bottom: .75rem; }
.submit-section h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.submit-section p  { color: var(--text-muted); font-size: .9rem; margin-bottom: .5rem; }

.api-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.api-list li { font-size: .88rem; }

/* ─── Search ────────────────────────────────────────────────────────────────── */
.search-form { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.search-form input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .5rem .9rem;
  font-size: .95rem;
  outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  padding: .5rem 1.1rem;
  font-size: .9rem;
}
.search-meta { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; }

/* ─── Error page ────────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--accent); line-height: 1; }
.error-page h1 { font-size: 1.8rem; margin: .75rem 0 .5rem; }
.error-page p  { color: var(--text-muted); margin-bottom: 1.5rem; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: .55rem 1.3rem;
  font-size: .9rem;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  height: 48px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-muted);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }
