/**
 * RPM Pro API Documentation — brand-aligned styles.
 * Self-contained under /APIDocs/ (does not load marketing theme.css).
 * Palette mirrors marketing site purple gradient CTAs.
 */

:root {
  --api-purple: #5b21b6;
  --api-purple-mid: #4c1d95;
  --api-purple-deep: #312e81;
  --api-gradient: linear-gradient(135deg, #5b21b6 0%, #4c1d95 45%, #312e81 100%);
  --api-ink: #0f172a;
  --api-muted: #64748b;
  --api-border: #e2e8f0;
  --api-surface: #f8fafc;
  --api-white: #ffffff;
  --api-radius: 0.75rem;
  --api-shadow: 0 10px 28px -12px rgba(76, 29, 149, 0.28);
}

/* Base typography closer to marketing site */
.api-docs-body,
.api-docs-body .page {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--api-ink);
  overflow-x: clip;
  max-width: 100%;
}

.api-docs-body img,
.api-docs-body video,
.api-docs-body svg {
  max-width: 100%;
  height: auto;
}

.api-docs-body a {
  color: var(--api-purple);
}

.api-docs-body a:hover {
  color: var(--api-purple-mid);
}

/* Header */
.api-docs-header .api-logo {
  display: block;
  height: 42px;
  max-height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.api-docs-header .logo-image {
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}

.api-page-inner .header.header-over {
  position: absolute;
  width: 100%;
  z-index: 100;
  background: transparent;
}

.api-page-inner .header .menu.sf-menu > li > a {
  color: #fff !important;
}

.api-page-inner .header .menu.sf-menu > li > a:hover,
.api-page-inner .header .menu.sf-menu > li > a.active {
  color: #e9d5ff !important;
}

.api-page-inner .header .sf-arrows .sf-with-ul:after {
  border-color: #fff transparent transparent !important;
}

.api-page-home .header .menu.sf-menu > li > a.active {
  color: #e9d5ff !important;
}

/* Inner page hero */
.api-page-hero {
  position: relative;
  background: var(--api-purple-deep) url("../img/api-hero-bg.png") center center / cover no-repeat;
  color: #fff;
  padding: 110px 0 48px;
  margin-bottom: 0;
  overflow: hidden;
}

.api-page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 33, 182, 0.92) 0%, rgba(49, 46, 129, 0.9) 100%);
}

.api-page-hero .container {
  position: relative;
  z-index: 1;
}

.api-page-hero-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  margin: 0 0 10px;
  color: #fff;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.api-page-hero-desc {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  max-width: 720px;
  overflow-wrap: anywhere;
}

.api-page-hero-desc code {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Home hero */
.api-hero {
  position: relative;
  background: var(--api-purple-deep) url("../img/api-hero-bg.png") center center / cover no-repeat;
  color: #fff;
  padding: 100px 0 64px;
  margin-bottom: 0;
  overflow: hidden;
}

.api-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 33, 182, 0.88) 0%, rgba(49, 46, 129, 0.9) 55%, rgba(15, 23, 42, 0.85) 100%);
}

.api-hero .container {
  position: relative;
  z-index: 1;
}

.api-hero-badge {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-hero h1 {
  font-size: clamp(1.85rem, 4.5vw, 2.65rem);
  font-weight: 700;
  margin: 0 0 16px;
  color: #fff;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.api-hero .lead {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  max-width: 820px;
  margin: 0 auto 28px;
  overflow-wrap: anywhere;
}

.api-hero-buttons .button {
  margin: 0 8px 8px;
}

/* Sidebar scroll-spy */
.menu-vertical.js-menu-vertical a.active {
  color: var(--api-purple) !important;
  font-weight: 600;
  border-left: 3px solid var(--api-purple);
  padding-left: 9px;
  margin-left: -12px;
}

.category-info[id],
.api-endpoint-card[id] {
  scroll-margin-top: 110px;
}

.category-title {
  color: var(--api-ink);
  font-weight: 700;
}

/* Feature cards */
.api-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.api-feature-card {
  background: var(--api-white);
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.api-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--api-shadow);
}

.api-feature-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center;
  display: block;
  background: var(--api-purple-deep);
}

.api-feature-card .card-head {
  background: var(--api-gradient);
  color: #fff;
  text-align: center;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
}

.api-feature-card .card-body {
  padding: 18px;
  text-align: center;
}

.api-feature-card .card-body p {
  font-size: 0.88rem;
  color: var(--api-muted);
  margin: 0 0 14px;
  min-height: 60px;
  line-height: 1.5;
}

.api-feature-card .button {
  font-size: 12px;
  padding: 8px 16px;
}

/* Stats bar */
.api-stats-bar {
  background: var(--api-surface);
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--api-border);
  border-bottom: 1px solid var(--api-border);
}

.api-stats-bar .stat-num {
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--api-purple);
  display: block;
  line-height: 1.1;
}

.api-stats-bar .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--api-muted);
  font-weight: 600;
}

/* Content sections */
.api-section-alt {
  background: var(--api-surface);
  padding: 50px 0;
}

.api-section-white {
  background: #fff;
  padding: 50px 0;
}

.api-two-col {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
}

.api-two-col .col-text,
.api-two-col .col-img {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.api-two-col img {
  max-width: 100%;
  border-radius: var(--api-radius);
  box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.25);
}

.api-blockquote {
  border-left: 4px solid var(--api-purple);
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--api-surface);
  border-radius: 0 var(--api-radius) var(--api-radius) 0;
  font-style: italic;
}

.api-blockquote footer {
  font-style: normal;
  font-weight: 600;
  margin-top: 10px;
  color: var(--api-muted);
}

.api-integration-box {
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  padding: 1.25rem;
  height: 100%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* CTA band — marketing purple */
.api-cta-band {
  background: var(--api-purple-deep) url("../img/api-cta-bg.png") center center / cover;
  color: #fff;
  padding: 50px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.api-cta-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--api-gradient);
  opacity: 0.94;
}

.api-cta-band .container {
  position: relative;
  z-index: 1;
}

.api-cta-band h3 {
  color: #fff;
  margin-bottom: 12px;
  font-weight: 700;
}

.api-cta-band p {
  color: rgba(255, 255, 255, 0.92);
}

/* Endpoint reference */
.api-method {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 8px;
  vertical-align: middle;
}

.api-method-get {
  background: #ede9fe;
  color: var(--api-purple-mid);
}

.api-method-post {
  background: #e8f8ea;
  color: #047857;
}

.api-method-put {
  background: #fff4e6;
  color: #c2410c;
}

.api-method-delete {
  background: #fdecea;
  color: #b91c1c;
}

.api-endpoint-path {
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 14px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.api-endpoint-card {
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  padding: 20px 22px;
  margin-bottom: 28px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  max-width: 100%;
}

.api-endpoint-card h5 {
  margin: 0 0 8px;
  line-height: 1.45;
}

.api-endpoint-card .endpoint-desc {
  margin-bottom: 16px;
  color: #475569;
}

.api-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 600;
}

.api-badge-public {
  background: #ecfdf5;
  color: #047857;
}

.api-badge-session {
  background: #f3e8ff;
  color: #6b21a8;
}

.api-badge-admin {
  background: #ede9fe;
  color: var(--api-purple-mid);
}

.api-badge-webhook {
  background: #fef2f2;
  color: #b91c1c;
}

.api-table {
  width: 100%;
  margin: 12px 0 18px;
  border-collapse: collapse;
  font-size: 13px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.api-table thead,
.api-table tbody,
.api-table tr {
  width: 100%;
}

.api-table th,
.api-table td {
  border: 1px solid var(--api-border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.api-table th {
  background: var(--api-surface);
  font-weight: 600;
  color: var(--api-ink);
}

.api-table code {
  font-size: 12px;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

.api-field-section {
  margin: 18px 0 8px;
}

.api-field-section h6 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--api-purple);
  margin: 0 0 8px;
}

.api-code-pair {
  margin: 16px 0;
}

.api-code-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--api-muted);
  margin-bottom: 6px;
}

.api-search {
  margin-bottom: 20px;
}

.api-search input {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 0.65rem;
  font-size: 14px;
  box-sizing: border-box;
}

.api-search input:focus {
  outline: none;
  border-color: var(--api-purple);
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.15);
}

.api-note {
  background: #f5f3ff;
  border-left: 4px solid var(--api-purple);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  border-radius: 0 0.5rem 0.5rem 0;
  line-height: 1.55;
}

.api-warning {
  background: #fff7ed;
  border-left: 4px solid #ea580c;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  border-radius: 0 0.5rem 0.5rem 0;
  line-height: 1.55;
}

.menu-vertical a.active {
  color: var(--api-purple);
  font-weight: 600;
}

/* AI agent documentation */
.api-nav-agents {
  font-weight: 600 !important;
}

.api-agent-banner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--api-gradient);
  color: #fff;
  border-radius: var(--api-radius);
  padding: 24px 28px;
  margin: 30px 0;
  box-shadow: var(--api-shadow);
}

.api-agent-banner-compact {
  padding: 14px 20px;
  margin: 24px 0 0;
  background: var(--api-gradient);
  font-size: 0.92rem;
  line-height: 1.5;
}

.api-agent-banner-compact a {
  color: #f5f3ff;
  text-decoration: underline;
  font-weight: 600;
}

.api-agent-banner-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.api-agent-banner h3 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 20px;
}

.api-agent-banner p {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.6;
}

.api-agent-banner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* Banner is purple — stroke buttons must be light (default purple-on-purple is invisible) */
.api-agent-banner-links .button,
.api-agent-banner-links a.button {
  margin: 0;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  color: #fff !important;
  background: transparent !important;
  font-weight: 600;
  text-decoration: none !important;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.api-agent-banner-links .button:hover,
.api-agent-banner-links a.button:hover {
  background: #fff !important;
  color: var(--api-purple-mid) !important;
  border-color: #fff !important;
}

.api-agent-raw {
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  margin: 20px 0 40px;
  overflow: hidden;
}

.api-agent-raw-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--api-surface);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--api-muted);
  border-bottom: 1px solid var(--api-border);
}

.api-agent-raw-toolbar a {
  color: var(--api-purple);
  font-weight: 600;
}

.api-agent-markdown {
  margin: 0;
  padding: 20px;
  max-height: 600px;
  overflow: auto;
  background: #fafbfc;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Footer */
.api-docs-footer .footer {
  background: var(--api-surface);
  border-top: 1px solid var(--api-border);
  padding: 1.75rem 0 1.5rem;
}

.api-footer-links {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
}

.api-footer-links a {
  color: var(--api-purple-mid);
  font-weight: 600;
  text-decoration: none;
}

.api-footer-links a:hover {
  text-decoration: underline;
}

.api-footer-sep {
  color: #94a3b8;
  margin: 0 0.35rem;
}

.api-footer-copy {
  color: var(--api-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Code blocks */
.api-docs-body .code-highlight,
.api-docs-body pre {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 0.65rem;
}

.api-docs-body code {
  overflow-wrap: anywhere;
}

/* Buttons — lean purple when theme stroke is blue-ish */
.api-docs-body .button.stroke {
  border-color: var(--api-purple);
  color: var(--api-purple);
}

.api-docs-body .button.stroke:hover {
  background: var(--api-purple);
  color: #fff;
  border-color: var(--api-purple);
}

.api-hero .button.stroke.white,
.api-cta-band .button.stroke.white,
.api-docs-body .button.api-btn-on-dark,
.api-docs-body a.button.api-btn-on-dark {
  border-color: rgba(255, 255, 255, 0.9) !important;
  color: #fff !important;
  background: transparent !important;
}

.api-hero .button.stroke.white:hover,
.api-cta-band .button.stroke.white:hover,
.api-docs-body .button.api-btn-on-dark:hover,
.api-docs-body a.button.api-btn-on-dark:hover {
  background: #fff !important;
  color: var(--api-purple-mid) !important;
  border-color: #fff !important;
}

@media (max-width: 991.98px) {
  .api-docs-nav .menu {
    font-size: 0.85rem;
  }
}

@media (max-width: 767px) {
  .api-hero {
    padding: 88px 0 48px;
  }

  .api-page-hero {
    padding: 96px 0 40px;
  }

  .api-endpoint-path {
    font-size: 12px;
  }

  .api-endpoint-card {
    padding: 16px;
  }

  .api-feature-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .api-agent-banner,
  .api-agent-banner-compact {
    padding: 14px 16px;
  }

  .api-footer-links {
    line-height: 1.8;
  }
}
