/* ───────────────────────────────────────────────
   CortexDB Documentation — Global Stylesheet
   ─────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ───────────────────── */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #1f2847;
  --bg-code: #0d1321;
  --bg-sidebar: #0c1120;

  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-heading: #f9fafb;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-secondary: #8b5cf6;
  --accent-green: #34d399;
  --accent-blue: #60a5fa;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;

  --border: #1e293b;
  --border-light: #2d3a52;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

  --sidebar-width: 260px;
  --header-height: 64px;

  --transition: 0.2s ease;
}

/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; }

/* ── Header ──────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  z-index: 100;
}

.site-header .logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header .logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.site-header nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

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

.site-header nav a.active {
  color: var(--accent-light);
}

.github-link {
  margin-left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary) !important;
  font-size: 13px;
  font-weight: 500;
}
.github-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-heading) !important;
  border-color: var(--border-light);
}

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

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-group { margin-bottom: 28px; }

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar a {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.sidebar a:hover {
  color: var(--text-heading);
  background: var(--accent-glow);
}

.sidebar a.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  font-weight: 500;
}

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 48px 64px;
  max-width: 960px;
}

/* ── Typography ──────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 36px; margin-bottom: 16px; letter-spacing: -0.5px; }
h2 { font-size: 24px; margin-top: 48px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 18px; margin-top: 32px; margin-bottom: 12px; }
h4 { font-size: 15px; margin-top: 24px; margin-bottom: 8px; color: var(--accent-light); }

p { margin-bottom: 16px; }

.subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ── Code ────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--bg-code);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent-light);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 16px 0 24px;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
}

.code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Tables ──────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-card);
  color: var(--text-heading);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--accent);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}

tr:hover td { background: var(--accent-glow); }

/* ── Cards ───────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Endpoint blocks ─────────────────────────── */
.endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0 24px;
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.endpoint-header:hover { background: var(--bg-card-hover); }

.method {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.method-get { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.method-post { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); }
.method-delete { background: rgba(251, 113, 133, 0.15); color: var(--accent-rose); }

.endpoint-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-heading);
}

.endpoint-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: auto;
}

.endpoint-body {
  padding: 20px;
  display: none;
}

.endpoint.open .endpoint-body { display: block; }

/* ── Alerts/Callouts ─────────────────────────── */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 16px 0 24px;
  border-left: 4px solid;
  font-size: 14px;
}

.callout-info {
  background: rgba(96, 165, 250, 0.08);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.callout-tip {
  background: rgba(52, 211, 153, 0.08);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.callout-warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.callout strong { color: inherit; }
.callout p { color: var(--text-primary); margin: 0; }

/* ── Hero (Landing) ──────────────────────────── */
.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text-heading), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.hero .subtitle {
  font-size: 20px;
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white !important;
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary) !important;
  font-weight: 500;
  font-size: 15px;
  border-radius: var(--radius-sm);
  margin-left: 12px;
  transition: all var(--transition);
}

.hero-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* ── Steps ───────────────────────────────────── */
.step {
  display: flex;
  gap: 20px;
  margin: 24px 0;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.step-content { flex: 1; }
.step-content h3 { margin-top: 0; }

/* ── Tags / Badges ───────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.badge-required { background: rgba(251, 113, 133, 0.15); color: var(--accent-rose); }
.badge-optional { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }

/* ── Schema field list ───────────────────────── */
.field-list { list-style: none; margin: 12px 0; }

.field-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.field-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-light);
  min-width: 140px;
}

.field-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 70px;
}

/* ── Tabs (SDK switcher) ─────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--text-heading); }
.tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Footer ──────────────────────────────────── */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 32px 64px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Landing page (no sidebar) ───────────────── */
.no-sidebar .content {
  margin-left: 0;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px;
}

.no-sidebar .site-footer {
  margin-left: 0;
  text-align: center;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 32px 20px; }
  .site-footer { margin-left: 0; padding: 24px 20px; }
  .site-header nav { display: none; }
  .hero h1 { font-size: 32px; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header { padding: 0 16px; }
  .hero { padding: 48px 0 32px; }
  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  pre { padding: 12px 16px; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
}
