/* ============================================================
   18minds API Documentation - Stylesheet
   Layout: fixed sidebars + margin-based main (Stripe approach)
   ============================================================ */

/* ------------------------------------------------------------
   1. Reset + Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.875em;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}


/* ------------------------------------------------------------
   2. Layout — fixed sidebars + margin-based main
   ------------------------------------------------------------ */
.docs-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #0a0d14;
  border-right: 1px solid var(--border);
}

.docs-main {
  margin-left: 260px;
  padding: 40px 48px 80px;
  min-height: 100vh;
  max-width: 100%;
}

.docs-toc {
  position: fixed;
  right: 0;
  top: 0;
  width: 200px;
  height: 100vh;
  overflow-y: auto;
  z-index: 90;
  padding: 32px 16px;
  border-left: 1px solid var(--border);
  display: none;
}

@media (min-width: 1201px) {
  .docs-toc { display: block; }
  .docs-main { margin-right: 200px; }
}


/* ------------------------------------------------------------
   3. Mobile Header
   ------------------------------------------------------------ */
.docs-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 200;
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.docs-mobile-header button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}

.docs-mobile-header .docs-logo {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
}


/* ------------------------------------------------------------
   4. Sidebar Styles
   ------------------------------------------------------------ */
.docs-sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.docs-sidebar-header .docs-logo {
  display: block;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 12px;
}

.docs-sidebar-links {
  display: flex;
  gap: 12px;
}

.docs-sidebar-links a {
  font-size: 12px;
  color: var(--muted);
  transition: color 0.2s;
}
.docs-sidebar-links a:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

/* Search trigger in sidebar */
.docs-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  transition: var(--transition);
}
.docs-search-trigger:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
}
.docs-search-trigger kbd {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  font-family: var(--font);
  color: var(--dim);
}

/* Navigation */
#docs-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
  text-decoration: none;
}
.docs-nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
}
.docs-nav-item.active {
  color: var(--text);
  background: rgba(99,102,241,0.08);
  border-left-color: var(--accent);
}

.docs-nav-item .nav-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Nested proxy sub-items */
.docs-nav-group-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
}
.docs-nav-group-label:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.docs-nav-group-label.active {
  color: var(--text);
  background: rgba(99,102,241,0.08);
  border-left-color: var(--accent);
}

.docs-nav-children {
  overflow: hidden;
}
.docs-nav-children .docs-nav-item {
  padding-left: 50px;
  font-size: 12px;
}

/* Sidebar footer */
.docs-sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.docs-lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.docs-lang-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}


/* ------------------------------------------------------------
   5. Main Content
   ------------------------------------------------------------ */
.docs-section-header {
  margin-bottom: 32px;
}

.docs-section-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.docs-section-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.docs-section-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  max-width: 680px;
}

/* Static HTML content (getting-started, errors) */
.docs-static-content {
  max-width: 720px;
  line-height: 1.75;
}
.docs-static-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--text);
}
.docs-static-content p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}
.docs-static-content ol,
.docs-static-content ul {
  margin: 0 0 14px 24px;
  color: var(--text-secondary);
}
.docs-static-content li {
  margin-bottom: 6px;
}
.docs-static-content pre {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  color: #e6edf3;
  margin-bottom: 16px;
}
.docs-static-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.docs-static-content th,
.docs-static-content td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.docs-static-content th {
  color: var(--text);
  font-weight: 600;
  background: rgba(255,255,255,0.02);
}
.docs-static-content td {
  color: var(--text-secondary);
}
.docs-static-content strong { color: var(--text); }


/* ------------------------------------------------------------
   6. Endpoint Cards
   ------------------------------------------------------------ */
.docs-endpoint {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
  background: rgba(13, 17, 23, 0.5);
  transition: border-color 0.2s;
}
.docs-endpoint:hover {
  border-color: var(--border-hover);
}

.docs-endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.docs-endpoint-title {
  font-size: 18px;
  font-weight: 700;
}

.docs-endpoint-path {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  padding: 4px 10px;
  border-radius: 6px;
  word-break: break-all;
}

.docs-auth-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.docs-auth-badge.auth-bearer {
  background: rgba(99,102,241,0.12);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.2);
}
.docs-auth-badge.auth-bot {
  background: rgba(16,185,129,0.12);
  color: var(--emerald);
  border: 1px solid rgba(16,185,129,0.2);
}
.docs-auth-badge.auth-none {
  background: rgba(107,114,128,0.12);
  color: var(--muted);
  border: 1px solid rgba(107,114,128,0.2);
}

.docs-endpoint-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  max-width: 680px;
}


/* ------------------------------------------------------------
   7. Parameter Tables
   ------------------------------------------------------------ */
.docs-params-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 20px 0 8px;
}

.docs-params-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

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

.docs-params-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

.docs-params-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

.docs-param-name {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.docs-param-type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99,102,241,0.1);
  color: var(--accent);
}

.docs-param-required {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.docs-param-required.required { color: var(--red); }
.docs-param-required.optional { color: var(--dim); }


/* ------------------------------------------------------------
   8. Request/Response Panels
   ------------------------------------------------------------ */
.docs-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

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

.docs-panel {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.docs-panel-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}


/* ------------------------------------------------------------
   9. Code Examples (tabbed)
   ------------------------------------------------------------ */
.docs-code-wrap {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 16px;
}

.docs-code-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

.docs-code-tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.docs-code-tab:hover { color: var(--text-secondary); }
.docs-code-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.docs-code-panel {
  display: none;
}
.docs-code-panel.active {
  display: block;
}

.docs-code-panel .code-block {
  border: none;
  border-radius: 0;
  margin: 0;
}


/* ------------------------------------------------------------
   10. Playground
   ------------------------------------------------------------ */
.docs-playground {
  margin-top: 20px;
  padding: 20px;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.docs-playground-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 12px;
}

.docs-playground-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.docs-playground-field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.docs-playground-field input,
.docs-playground-field textarea {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}
.docs-playground-field input:focus,
.docs-playground-field textarea:focus {
  border-color: var(--border-focus);
}

.docs-playground-field textarea {
  min-height: 80px;
  resize: vertical;
}

.docs-playground-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}
.docs-playground-send:hover {
  box-shadow: 0 0 20px rgba(99,102,241,0.3);
  transform: translateY(-1px);
}
.docs-playground-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.docs-playground-result {
  margin-top: 12px;
  display: none;
}
.docs-playground-result.visible { display: block; }

.docs-playground-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}
.docs-playground-meta .status-ok { color: var(--emerald); }
.docs-playground-meta .status-err { color: var(--red); }


/* ------------------------------------------------------------
   11. Table of Contents (right sidebar)
   ------------------------------------------------------------ */
.docs-toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
}

.docs-toc-link {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--border);
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.5;
}
.docs-toc-link:hover {
  color: var(--text);
  border-left-color: var(--accent);
  text-decoration: none;
}
.docs-toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
}


/* ------------------------------------------------------------
   12. Search Overlay
   ------------------------------------------------------------ */
.docs-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.docs-search-overlay.open {
  display: flex;
}

.docs-search-modal {
  width: 560px;
  max-width: 92vw;
  background: #111827;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.docs-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.docs-search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
}

#docs-search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}

.docs-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.docs-search-result:hover,
.docs-search-result.highlighted {
  background: rgba(99,102,241,0.1);
}

.docs-search-result-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.docs-search-result-text {
  flex: 1;
  min-width: 0;
}
.docs-search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.docs-search-result-path {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-search-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.docs-search-footer {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--dim);
}
.docs-search-footer kbd {
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font);
}


/* ------------------------------------------------------------
   13. Responsive
   ------------------------------------------------------------ */

/* Sidebar overlay (mobile) */
.docs-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.5);
}
.docs-sidebar-overlay.open { display: block; }

/* <768px: sidebar becomes drawer, mobile header shows */
@media (max-width: 767px) {
  .docs-mobile-header { display: flex; }

  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
  }
  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-main {
    margin-left: 0;
    margin-right: 0;
    padding: 72px 20px 60px;
  }

  .docs-toc { display: none !important; }

  .docs-panels { grid-template-columns: 1fr; }

  .docs-endpoint { padding: 20px; }
}

/* 768-1200: sidebar visible, no TOC */
@media (min-width: 768px) and (max-width: 1200px) {
  .docs-toc { display: none; }
  .docs-main { margin-right: 0; }
}


/* ------------------------------------------------------------
   14. Errors table within endpoint cards
   ------------------------------------------------------------ */
.docs-errors-list {
  margin-top: 12px;
}

.docs-error-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.docs-error-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  min-width: 32px;
}

.docs-error-msg {
  color: var(--text-secondary);
}


/* ------------------------------------------------------------
   15. Misc utilities
   ------------------------------------------------------------ */
.docs-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.docs-method-all {
  background: rgba(107,114,128,0.14);
  color: var(--muted);
}

/* Response status badge */
.docs-status-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
}
.docs-status-badge.s2xx {
  background: rgba(16,185,129,0.12);
  color: var(--emerald);
}
.docs-status-badge.s4xx {
  background: rgba(245,158,11,0.12);
  color: var(--amber);
}
.docs-status-badge.s5xx {
  background: rgba(239,68,68,0.12);
  color: var(--red);
}
