:root {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --bg-hover: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #10b981;
  --accent-hover: #34d399;
  --border: #334155;
  --code-bg: #0c1222;
  --sidebar-width: 280px;
  --header-height: 56px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

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

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.site-header .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.site-header nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.site-header nav a {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-header nav a:hover,
.site-header nav a.active {
  background: var(--bg-hover);
  color: var(--text);
}

.search-box {
  margin-left: auto;
  position: relative;
}

.search-box input {
  width: 220px;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
}

.search-box input:focus { border-color: var(--accent); }

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none;
  z-index: 200;
}

.search-results.open { display: block; }

.search-results a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.search-results a:hover { background: var(--bg-hover); }
.search-results .result-portal { color: var(--text-muted); font-size: 0.75rem; }

/* ── Layout ─────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar h3 {
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar ul { list-style: none; }

.sidebar li a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-left: 3px solid transparent;
}

.sidebar li a:hover,
.sidebar li a.active {
  color: var(--text);
  background: rgba(16, 185, 129, 0.08);
  border-left-color: var(--accent);
}

.content {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 960px;
}

.breadcrumbs {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }

/* ── Typography ─────────────────────────────────────── */
.content h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.content h2 {
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.content h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.content p { margin-bottom: 1rem; }

.content ul, .content ol {
  margin: 0 0 1rem 1.5rem;
}

.content li { margin-bottom: 0.35rem; }

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.875rem;
}

.content th, .content td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.content th {
  background: var(--bg-elevated);
  color: var(--accent);
  font-weight: 600;
}

.content tr:nth-child(even) { background: rgba(30, 41, 59, 0.4); }

.content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #a5f3fc;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.content pre code {
  background: none;
  padding: 0;
  color: #cbd5e1;
}

.content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: rgba(16, 185, 129, 0.06);
  color: var(--text-muted);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.toc h4 { margin-bottom: 0.5rem; color: var(--accent); font-size: 0.8rem; text-transform: uppercase; }
.toc ul { list-style: none; margin: 0; }
.toc li { margin: 0.25rem 0; }
.toc a { color: var(--text-muted); }
.toc a:hover { color: var(--accent); }

/* ── Hub page ───────────────────────────────────────── */
.hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: 3rem;
  text-align: center;
}

.hub h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hub .subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 3rem;
  max-width: 540px;
}

.portal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  width: 100%;
}

.portal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: left;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--card-accent, var(--accent));
}

.portal-card .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.portal-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.portal-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.portal-card.backend { --card-accent: #3b82f6; }
.portal-card.frontend { --card-accent: #10b981; }
.portal-card.manual { --card-accent: #f59e0b; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .content { padding: 1.5rem; }
  .search-box input { width: 140px; }
}

/* ── Imagens do manual (screenshots) ─────────────────── */
.content img.doc-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
