/* ========================================
   API Documentation Page
   ======================================== */

:root {
  --docs-bg: #ffffff;
  --docs-sidebar-bg: #f8fafc;
  --docs-text: #1e293b;
  --docs-text-muted: #64748b;
  --docs-border: #e2e8f0;
  --docs-code-bg: #0f172a;
  --docs-code-text: #e2e8f0;
  --docs-code-border: #1e293b;
  --docs-primary: #2563eb;
  --docs-primary-hover: #1d4ed8;
  --docs-success: #10b981;
  --docs-warn: #f59e0b;
  --docs-danger: #ef4444;
  --docs-info: #3b82f6;
  --docs-radius: 8px;
}

body {
  background: var(--docs-bg);
  color: var(--docs-text);
}

/* ========================================
   Layout
   ======================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1280px;
  margin: 0 auto;
  gap: 0;
  padding: 0 24px;
}

/* ---------- Sticky TOC Sidebar ---------- */
.docs-toc {
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 24px 16px 40px 0;
  border-right: 1px solid var(--docs-border);
}

.toc-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--docs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-nav a {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--docs-text-muted);
  text-decoration: none;
  border-radius: var(--docs-radius);
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.toc-nav a:hover {
  color: var(--docs-text);
  background: rgba(37, 99, 235, 0.05);
}

.toc-nav a.active {
  color: var(--docs-primary);
  background: rgba(37, 99, 235, 0.08);
  border-left-color: var(--docs-primary);
  font-weight: 600;
}

.toc-section {
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--docs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Main Content ---------- */
.docs-content {
  padding: 40px 48px 80px;
  max-width: 860px;
  min-width: 0;
}

.docs-section {
  padding: 32px 0;
  border-bottom: 1px solid var(--docs-border);
}

.docs-section:last-child {
  border-bottom: none;
}

.docs-section h1 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  color: var(--docs-text);
  line-height: 1.15;
}

.docs-section h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 12px 0 16px;
  color: var(--docs-text);
  line-height: 1.25;
}

.docs-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--docs-text);
  line-height: 1.4;
}

.docs-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--docs-text);
  margin-bottom: 14px;
}

.docs-section p.lead {
  font-size: 17px;
  color: var(--docs-text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.docs-section a {
  color: var(--docs-primary);
  text-decoration: none;
}

.docs-section a:hover {
  text-decoration: underline;
}

.docs-section ol,
.docs-section ul {
  margin: 12px 0 18px;
  padding-left: 24px;
  font-size: 15px;
  line-height: 1.7;
}

.docs-section li {
  margin-bottom: 6px;
}

.docs-section strong {
  font-weight: 600;
  color: var(--docs-text);
}

/* ========================================
   Code Blocks
   ======================================== */

code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  background: rgba(100, 116, 139, 0.12);
  color: #be185d;
  padding: 2px 6px;
  border-radius: 4px;
}

.code-block {
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-code-border);
  border-radius: var(--docs-radius);
  overflow: hidden;
  margin: 12px 0 20px;
}

.code-block pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.code-block code {
  background: transparent;
  color: var(--docs-code-text);
  padding: 0;
  font-size: 13px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
}

/* Language tabs */
.lang-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 0;
  border-bottom: 1px solid var(--docs-border);
}

.lang-tab {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--docs-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.lang-tab:hover {
  color: var(--docs-text);
}

.lang-tab.active {
  color: var(--docs-primary);
  border-bottom-color: var(--docs-primary);
}

.code-block.lang-curl,
.code-block.lang-php,
.code-block.lang-node,
.code-block.lang-python {
  display: none;
}

.code-block.lang-curl.active,
.code-block.lang-php.active,
.code-block.lang-node.active,
.code-block.lang-python.active {
  display: block;
}

/* ========================================
   Endpoint Card
   ======================================== */

.endpoint-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f1f5f9;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  margin: 12px 0 20px;
}

.endpoint-card code {
  background: transparent;
  color: var(--docs-text);
  font-size: 14px;
  font-weight: 500;
  padding: 0;
}

.method-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.method-get {
  background: #dbeafe;
  color: #1e40af;
}

.method-post {
  background: #dcfce7;
  color: #166534;
}

.method-put {
  background: #fef3c7;
  color: #92400e;
}

.method-delete {
  background: #fee2e2;
  color: #991b1b;
}

/* ========================================
   Tables
   ======================================== */

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 13px;
  overflow: hidden;
  border-radius: var(--docs-radius);
  border: 1px solid var(--docs-border);
}

.docs-table thead {
  background: #f1f5f9;
}

.docs-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--docs-text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--docs-border);
}

.docs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--docs-border);
  color: var(--docs-text);
  vertical-align: top;
  line-height: 1.5;
}

.docs-table tbody tr:last-child td {
  border-bottom: none;
}

.docs-table tbody tr:hover {
  background: #f8fafc;
}

/* ========================================
   Callouts
   ======================================== */

.callout {
  padding: 14px 18px;
  border-radius: var(--docs-radius);
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid transparent;
}

.callout ul,
.callout ol {
  margin: 8px 0 0;
  font-size: 13px;
}

.callout-info {
  background: #eff6ff;
  border-left-color: var(--docs-info);
  color: #1e3a8a;
}

.callout-warn {
  background: #fffbeb;
  border-left-color: var(--docs-warn);
  color: #78350f;
}

.callout-danger {
  background: #fef2f2;
  border-left-color: var(--docs-danger);
  color: #7f1d1d;
}

/* ========================================
   Steps
   ======================================== */

.step-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.step {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--docs-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.step-body h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.step-body p {
  margin: 0;
  font-size: 13px;
  color: var(--docs-text-muted);
}

/* ========================================
   Lifecycle Chart
   ======================================== */

.lifecycle-chart {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin: 20px 0;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  flex-wrap: wrap;
}

.lifecycle-step {
  flex: 1;
  min-width: 140px;
  text-align: center;
  padding: 12px;
}

.lifecycle-step p {
  font-size: 12px;
  color: var(--docs-text-muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

.lifecycle-branch {
  margin-bottom: 12px;
}

.lifecycle-branch:last-child {
  margin-bottom: 0;
}

.lifecycle-arrow {
  display: flex;
  align-items: center;
  font-size: 24px;
  color: var(--docs-text-muted);
  font-weight: bold;
}

.lifecycle-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-processing {
  background: #ddd6fe;
  color: #5b21b6;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-failed {
  background: #fee2e2;
  color: #991b1b;
}

/* ========================================
   FAQ
   ======================================== */

.faq-item {
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  margin-bottom: 10px;
}

.faq-item h3 {
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--docs-text);
}

.faq-item p {
  font-size: 14px;
  margin: 0;
  color: var(--docs-text-muted);
  line-height: 1.6;
}

/* ========================================
   Footer CTA
   ======================================== */

.docs-footer {
  border-bottom: none;
  padding-top: 48px;
  padding-bottom: 48px;
}

.footer-cta {
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border-radius: var(--docs-radius);
  color: white;
}

.footer-cta h2 {
  color: white;
  margin-bottom: 8px;
}

.footer-cta p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
  font-size: 16px;
}

.btn-lg {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
}

.footer-cta .btn-primary {
  background: white;
  color: var(--docs-primary);
}

.footer-cta .btn-primary:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }

  .docs-toc {
    display: none;
  }

  .docs-content {
    padding: 24px 0 60px;
  }

  .docs-section h1 {
    font-size: 28px;
  }

  .docs-section h2 {
    font-size: 22px;
  }

  .lifecycle-chart {
    flex-direction: column;
  }

  .lifecycle-arrow {
    transform: rotate(90deg);
    justify-content: center;
  }
}
