/* API Reference — ProcPilot Integration API v1 */
@import url('./brand-tokens.css');

:root {
  --brand-orange: var(--brand-accent-ai);
  --brand-teal: var(--brand-secondary);
  --bg: var(--brand-surface);
  --surface: var(--brand-bg);
  --surface-elevated: var(--brand-bg);
  --ink: var(--brand-ink);
  --ink-soft: var(--brand-ink-soft);
  --ink-muted: var(--brand-ink-muted);
  --line: var(--brand-line);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(11, 18, 56, 0.06), 0 12px 28px -8px rgba(11, 18, 56, 0.08);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --sidebar-w: 15.5rem;
  --header-h: 4.75rem;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-teal); }
a:hover { color: var(--brand-orange); }

.api-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--header-border, var(--line));
  height: var(--header-h);
}

.api-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.api-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.api-header__brand img { height: 30px; width: auto; }

.api-header__meta {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-muted);
}

.api-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.api-header__actions .header-actions {
  margin-left: 0;
}

.api-layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 2.5rem;
  padding: 2rem 1.25rem 4rem;
}

.api-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
}

.api-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.api-sidebar a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}

.api-sidebar a:hover,
.api-sidebar a.is-active {
  background: #fff;
  color: var(--brand-teal);
  box-shadow: var(--shadow);
}

.api-sidebar__group {
  margin-top: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  padding: 0 0.65rem;
}

.api-main { min-width: 0; }

.api-hero {
  margin-bottom: 2.5rem;
}

.api-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.api-hero p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 42rem;
}

.api-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.api-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.api-badge--version {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.api-section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.api-section h2 {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.api-section h3 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.5rem;
}

.api-section p { color: var(--ink-soft); margin: 0 0 0.75rem; }

.api-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.api-endpoint {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.25rem 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.api-endpoint__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-elevated);
}

.api-method {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
}

.api-method--get { background: #dbeafe; color: #1d4ed8; }
.api-method--post { background: #dcfce7; color: #15803d; }
.api-method--put { background: #fef3c7; color: #b45309; }

.api-endpoint__path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.api-endpoint__scope {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-family: ui-monospace, monospace;
}

.api-endpoint__body {
  padding: 1.1rem 1.25rem;
}

.api-endpoint__body p:last-child { margin-bottom: 0; }

.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.api-table th,
.api-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.api-table th {
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.api-table code {
  font-size: 0.8em;
}

.api-code {
  position: relative;
  margin: 0.75rem 0;
}

.api-code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--brand-ink);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
}

.api-code__copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
}

.api-code__copy:hover { color: #fff; border-color: #64748b; }

.api-callout {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin: 1rem 0;
  border-left: 4px solid var(--brand-orange);
  background: #fff7ed;
  color: #9a3412;
}

.api-callout--info {
  border-color: var(--brand-teal);
  background: #f0fdfa;
  color: #115e59;
}

.api-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

@media (max-width: 900px) {
  .api-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .api-sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1rem;
  }

  .api-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .api-sidebar__group { width: 100%; margin-top: 0; }

  .api-endpoint__scope { margin-left: 0; width: 100%; }
}

[data-theme="dark"] a { color: var(--link, var(--brand-teal)); }
[data-theme="dark"] a:hover { color: var(--link-hover, var(--brand-orange)); }

[data-theme="dark"] .api-sidebar a:hover,
[data-theme="dark"] .api-sidebar a.is-active {
  background: var(--surface-elevated);
  color: var(--brand-teal);
}

[data-theme="dark"] .api-badge {
  background: var(--surface-elevated);
}

[data-theme="dark"] .api-badge--version {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

[data-theme="dark"] .api-endpoint__head {
  background: var(--surface-elevated);
}

[data-theme="dark"] .api-method--get { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
[data-theme="dark"] .api-method--post { background: rgba(34, 197, 94, 0.2); color: #86efac; }
[data-theme="dark"] .api-method--put { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

[data-theme="dark"] .api-callout {
  background: rgba(249, 115, 22, 0.12);
  color: #fdba74;
}

[data-theme="dark"] .api-callout--info {
  background: rgba(45, 212, 191, 0.1);
  color: #5eead4;
}

[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="text"] {
  background: var(--surface-elevated);
  color: var(--ink);
}
