/* ============================================
   HumanPing Documentation — styles.css
   Dark theme matching main site
   ============================================ */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  --bg: #0a0a0f;
  --bg-sidebar: #0e0e14;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-code: rgba(255, 255, 255, 0.05);
  --bg-inline-code: rgba(74, 222, 128, 0.1);
  --accent: #4ADE80;
  --accent-hover: #22C55E;
  --accent-glow: rgba(74, 222, 128, 0.15);
  --blue: #60A5FA;
  --purple: #C084FC;
  --orange: #FB923C;
  --red: #F87171;
  --text: #E8E8ED;
  --text-secondary: rgba(232, 232, 237, 0.6);
  --text-tertiary: rgba(232, 232, 237, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --toc-width: 220px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.7; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Top Header ── */
.docs-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
}
.docs-header-inner {
  display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1440px; margin: 0 auto;
}
.docs-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); }
.docs-logo-icon { width: 28px; height: 28px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.docs-logo span { opacity: 0.5; font-weight: 400; margin-left: 4px; }
.docs-header-links { display: flex; align-items: center; gap: 20px; }
.docs-header-links a { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.docs-header-links a:hover { color: var(--text); }
.docs-header-links .btn-sm {
  padding: 6px 14px; background: var(--accent); color: #000; font-weight: 600; border-radius: 6px; font-size: 13px;
}
.docs-header-links .btn-sm:hover { background: var(--accent-hover); color: #000; }

.mobile-menu-toggle { display: none; width: 32px; height: 32px; align-items: center; justify-content: center; color: var(--text); font-size: 20px; }

/* ── Sidebar ── */
.docs-sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: var(--sidebar-width);
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 24px 0; z-index: 50;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-section { margin-bottom: 24px; }
.sidebar-section-title {
  padding: 0 24px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-tertiary); margin-bottom: 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 24px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); transition: all var(--transition); border-left: 2px solid transparent; text-decoration: none;
}
.sidebar-link:hover { color: var(--text); background: var(--bg-card); }
.sidebar-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-glow); font-weight: 600; }
.sidebar-link .sidebar-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

/* ── Main Content ── */
.docs-layout { display: flex; margin-top: 56px; min-height: calc(100vh - 56px); }
.docs-main { flex: 1; margin-left: var(--sidebar-width); padding: 40px 48px 80px; max-width: calc(100% - var(--sidebar-width)); }
.docs-content { max-width: 800px; }

/* ── Breadcrumbs ── */
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-tertiary); margin-bottom: 32px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: 0.4; }

/* ── On This Page (TOC) ── */
.toc {
  position: fixed; top: 96px; right: 24px; width: var(--toc-width);
  max-height: calc(100vh - 120px); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: 12px; }
.toc-link {
  display: block; padding: 4px 0 4px 12px; font-size: 13px; color: var(--text-tertiary);
  border-left: 1px solid var(--border); transition: all var(--transition); text-decoration: none;
}
.toc-link:hover { color: var(--text-secondary); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); }
.toc-link.toc-h3 { padding-left: 24px; font-size: 12px; }

/* ── Typography ── */
.docs-content h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 16px; line-height: 1.2; }
.docs-content h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 48px; margin-bottom: 16px; padding-top: 24px; border-top: 1px solid var(--border); line-height: 1.3; }
.docs-content h2:first-of-type { margin-top: 32px; border-top: none; padding-top: 0; }
.docs-content h3 { font-size: 18px; font-weight: 700; margin-top: 32px; margin-bottom: 12px; line-height: 1.4; }
.docs-content h4 { font-size: 15px; font-weight: 700; margin-top: 24px; margin-bottom: 8px; }
.docs-content p { margin-bottom: 16px; color: var(--text-secondary); }
.docs-content strong { color: var(--text); font-weight: 600; }
.docs-content ul, .docs-content ol { margin-bottom: 16px; padding-left: 24px; color: var(--text-secondary); }
.docs-content li { margin-bottom: 6px; }
.docs-content li::marker { color: var(--accent); }
.docs-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ── Inline code ── */
.docs-content code:not(pre code) {
  background: var(--bg-inline-code); color: var(--accent); padding: 2px 7px; border-radius: 4px;
  font-family: var(--mono); font-size: 0.88em; font-weight: 500;
}

/* ── Code Blocks ── */
.code-block {
  position: relative; background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 24px;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02);
}
.code-lang { font-size: 12px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.code-copy {
  display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 5px;
  font-size: 12px; font-weight: 500; color: var(--text-tertiary);
  background: var(--bg-card); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
}
.code-copy:hover { color: var(--text); border-color: var(--border-strong); }
.code-copy.copied { color: var(--accent); border-color: rgba(74, 222, 128, 0.3); }
.code-body {
  padding: 16px 20px; font-family: var(--mono); font-size: 13px; line-height: 1.75;
  overflow-x: auto; white-space: pre; color: var(--text-secondary); tab-size: 2;
}

/* Syntax highlighting */
.code-body .kw { color: var(--accent); }
.code-body .fn { color: var(--blue); }
.code-body .str { color: #86EFAC; }
.code-body .cm { color: var(--text-tertiary); font-style: italic; }
.code-body .num { color: var(--purple); }
.code-body .op { color: var(--text-secondary); }
.code-body .key { color: var(--blue); }
.code-body .val { color: #86EFAC; }
.code-body .bool { color: var(--purple); }
.code-body .method { color: var(--orange); font-weight: 600; }
.code-body .url { color: var(--text-tertiary); }

/* ── Tables ── */
.docs-table-wrapper { overflow-x: auto; margin-bottom: 24px; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: rgba(255,255,255,0.03); }
th { text-align: left; padding: 12px 16px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Method badges */
.method { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; font-family: var(--mono); letter-spacing: 0.03em; }
.method-get { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.method-post { background: rgba(74, 222, 128, 0.15); color: var(--accent); }
.method-put { background: rgba(251, 146, 60, 0.15); color: var(--orange); }
.method-delete { background: rgba(248, 113, 113, 0.15); color: var(--red); }

/* ── Callout / Alert boxes ── */
.callout {
  padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 24px;
  border-left: 3px solid; font-size: 14px;
}
.callout p { margin-bottom: 0; color: inherit; }
.callout-title { font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.callout-info { background: rgba(96, 165, 250, 0.08); border-color: var(--blue); color: rgba(150, 200, 255, 0.85); }
.callout-warning { background: rgba(251, 191, 36, 0.08); border-color: #FBBF24; color: rgba(255, 220, 130, 0.85); }
.callout-tip { background: rgba(74, 222, 128, 0.08); border-color: var(--accent); color: rgba(134, 239, 172, 0.85); }
.callout-danger { background: rgba(248, 113, 113, 0.08); border-color: var(--red); color: rgba(255, 150, 150, 0.85); }

/* ── Endpoint Cards ── */
.endpoint-card {
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px;
  overflow: hidden; transition: border-color var(--transition);
}
.endpoint-card:hover { border-color: var(--border-strong); }
.endpoint-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); cursor: pointer;
}
.endpoint-path { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); }
.endpoint-desc { font-size: 13px; color: var(--text-tertiary); margin-left: auto; }
.endpoint-body { padding: 20px; }

/* ── Param tables ── */
.param-table { width: 100%; font-size: 13px; }
.param-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); }
.param-name { font-family: var(--mono); font-weight: 600; color: var(--accent); }
.param-type { font-family: var(--mono); font-size: 12px; color: var(--purple); }
.param-required { font-size: 11px; font-weight: 700; color: var(--orange); }
.param-optional { font-size: 11px; color: var(--text-tertiary); }

/* ── Prev/Next Navigation ── */
.docs-nav-footer {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border);
}
.docs-nav-link {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  transition: all var(--transition); text-decoration: none;
}
.docs-nav-link:hover { border-color: var(--accent); background: var(--accent-glow); }
.docs-nav-link.next { text-align: right; align-items: flex-end; }
.docs-nav-label { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.docs-nav-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── Description List (key/val) ── */
.desc-list { margin-bottom: 24px; }
.desc-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.desc-item:last-child { border-bottom: none; }
.desc-key { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); min-width: 120px; flex-shrink: 0; }
.desc-val { font-size: 14px; color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .toc { display: none; }
  .docs-main { max-width: 100%; }
}

@media (max-width: 768px) {
  .docs-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; z-index: 200; width: 280px; }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-main { margin-left: 0; padding: 24px 20px 60px; max-width: 100%; }
  .mobile-menu-toggle { display: flex; }
  .docs-header-links { display: none; }
  .docs-content h1 { font-size: 28px; }
  .docs-content h2 { font-size: 20px; }
  .docs-nav-footer { flex-direction: column; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; display: none;
  }
  .sidebar-overlay.open { display: block; }
}

/* ── Page-specific overrides ── */
.hero-section { margin-bottom: 40px; }
.hero-section h1 { font-size: 42px; }
.hero-section .hero-desc { font-size: 18px; color: var(--text-secondary); margin-bottom: 24px; max-width: 600px; }
.hero-section .hero-links { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-section .hero-link {
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  transition: all var(--transition);
}
.hero-section .hero-link-primary { background: var(--accent); color: #000; }
.hero-section .hero-link-primary:hover { background: var(--accent-hover); }
.hero-section .hero-link-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.hero-section .hero-link-secondary:hover { border-color: var(--border-strong); }

.quick-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 32px 0; }
.quick-nav-card {
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  transition: all var(--transition); display: flex; flex-direction: column; gap: 8px; text-decoration: none;
}
.quick-nav-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.quick-nav-card .qn-icon { font-size: 24px; }
.quick-nav-card .qn-title { font-size: 15px; font-weight: 700; color: var(--text); }
.quick-nav-card .qn-desc { font-size: 13px; color: var(--text-tertiary); }
