/* ════════════════════════════════════════
   BASE RESET & ROOT
════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --nav-h:         60px;
  --sidebar-w:     240px;
  --page-bg:       #f9f9f9;
  --surface:       #ffffff;
  --surface-2:     #f4f4f5;
  --surface-3:     #e4e4e7;
  --surface-4:     #d4d4d8;
  --border:        #e4e4e7;
  --border-subtle: #f0f0f0;
  --ink:           #09090b;
  --ink-2:         #52525b;
  --ink-3:         #a1a1aa;
  --action:        #09090b;
  --success:       #16A34A;
  --danger:        #DC2626;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

html, body { height: 100%; }

body {
  background: var(--page-bg);
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  overflow-x: hidden;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  vertical-align: middle;
}

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ════════════════════════════════════════
   NAVBAR — full width, edge-to-edge
════════════════════════════════════════ */
.docs-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

.docs-nav-logo  { flex-shrink: 0; display: flex; align-items: center; text-decoration: none; }
.docs-nav-logo img { height: 30px; width: auto; }

.docs-nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 28px;
}
.docs-nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.12s;
}
.docs-nav-links a:hover    { color: var(--ink); }
.docs-nav-links a.active   { color: var(--ink); font-weight: 600; }

.docs-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mainnet button — matches landing lp-nav-cta */
.docs-nav-cta {
  position: relative;
  overflow: hidden;
  padding: 8px 18px;
  border-radius: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  border: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
  color: #09090b;
  background: linear-gradient(105deg, #FFE700 0%, #4AECBE 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  transition:
    background-position 0.5s cubic-bezier(0.16,1,0.3,1),
    transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.docs-nav-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 20%,
    rgba(255,255,255,0.45) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  transition: transform 0.55s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
.docs-nav-cta:hover {
  background-position: 100% 50%;
  transform: translateY(-1px) scale(1.03);
}
.docs-nav-cta:hover::before { transform: translateX(100%); }
.docs-nav-cta:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}
.docs-nav-cta .material-symbols-outlined {
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.docs-nav-cta:hover .material-symbols-outlined {
  transform: rotate(20deg) scale(1.2);
}

/* Home button — black variant */
.docs-nav-cta--dark {
  background: #09090b;
  background-size: unset;
  color: #ffffff;
}
.docs-nav-cta--dark::before { display: none; }
.docs-nav-cta--dark:hover {
  background: #1c1c1f;
  background-position: unset;
}
.docs-nav-cta--dark:hover .material-symbols-outlined {
  transform: scale(1.15);
}

/* Mobile hamburger */
#sidebar-toggle-btn {
  display: none;
  padding: 7px 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 7px;
  color: var(--ink);
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  margin-left: 8px;
}
#sidebar-toggle-btn:hover { background: var(--surface-2); }

/* ════════════════════════════════════════
   PAGE SHELL — sidebar + main side by side
════════════════════════════════════════ */
.docs-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  background: #ffffff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-inner {
  padding: 16px 12px;
  flex: 1;
  position: relative;
}

/* ════════════════════════════════════════
   MAIN CONTENT AREA
════════════════════════════════════════ */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  background: #ffffff;
}

.docs-content {
  width: 100%;
  padding: 40px 48px 80px;
}

/* ════════════════════════════════════════
   SIDEBAR HIGHLIGHT PILL (animated)
════════════════════════════════════════ */
#sidebar-highlight {
  position: absolute;
  /* left / right set dynamically by positionHighlight() */
  left: 2px;
  right: 10px;
  top: 0;
  height: 30px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translateY(0px);
  transition:
    transform 0.44s cubic-bezier(0.34, 1.45, 0.64, 1),
    height    0.36s cubic-bezier(0.34, 1.45, 0.64, 1),
    opacity   0.18s ease;
  will-change: transform, height;
}

/* ════════════════════════════════════════
   SIDEBAR NAV ITEMS
════════════════════════════════════════ */
.side-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; transition: color 0.12s;
  text-decoration: none; font-weight: 500;
  position: relative; z-index: 1;
}
.side-item:hover  { color: var(--ink); }
.side-item.active { color: var(--ink); font-weight: 600; }

.side-sub {
  display: block; padding: 5px 10px 5px 12px;
  font-size: 13px; color: var(--ink-3);
  cursor: pointer; text-decoration: none;
  transition: color 0.12s;
  border-radius: 6px;
  position: relative; z-index: 1;
}
.side-sub:hover  { color: var(--ink-2); }
.side-sub.active { color: var(--ink); font-weight: 600; }

.cat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 4px;
  font-size: 11.5px; font-weight: 700;
  color: var(--ink); cursor: pointer; border-radius: 6px;
  transition: color 0.12s;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 10px;
  position: relative; z-index: 1;
}
.cat-header:hover { color: var(--ink-2); }

/* Left accent line connecting child items */
.cat-children {
  overflow: hidden;
  max-height: 900px;
  opacity: 1;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
  padding-left: 6px;
  margin-left: 12px;
  border-left: 1.5px solid var(--border-subtle);
}
.cat-children.collapsed { max-height: 0; opacity: 0; }

.side-item.hidden-search,
.side-sub.hidden-search { display: none; }

/* ── Search box ─────────────────────────────────────────── */
#search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px !important;
  color: var(--ink-3);
  pointer-events: none;
  transition: color 0.2s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

/* Icon animates on focus */
#search-wrap:focus-within .search-icon {
  color: var(--ink-2);
  transform: translateY(-50%) scale(1.08);
}

#sidebar-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  border-radius: 9px;
  padding: 7px 12px 7px 32px;
  outline: none;
  transition:
    background   0.2s ease,
    border-color 0.2s ease,
    box-shadow   0.2s ease;
}

#sidebar-search:hover {
  background: var(--surface-3);
}

#sidebar-search:focus {
  background: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(9,9,11,0.07);
}

#sidebar-search::placeholder {
  color: var(--ink-3);
  font-size: 12.5px;
  transition: opacity 0.15s ease;
}

#sidebar-search:focus::placeholder {
  opacity: 0.5;
}

/* ════════════════════════════════════════
   TAG PILLS
════════════════════════════════════════ */
.tag-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--ink-2); background: var(--surface-2);
}
.tag-market    { background: #eff2ff; color: #3730a3; border-color: #c7d2fe; }
.tag-account   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tag-trade     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tag-position  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-vault     { background: #faf5ff; color: #7c3aed; border-color: #e9d5ff; }
.tag-history   { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.tag-referral  { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.tag-readonly  { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.tag-write     { background: #fefce8; color: #a16207; border-color: #fde68a; }
.tag-onchain   { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tag-market-order { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tag-limit-order  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-tpsl      { background: #fdf4ff; color: #a21caf; border-color: #f5d0fe; }
.tag-default   { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }

/* ════════════════════════════════════════
   DARK TERMINAL WINDOW
════════════════════════════════════════ */
.dark-term {
  border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}
.dark-term:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.16), 0 3px 12px rgba(0,0,0,0.07);
}
.dark-term-bar {
  background: linear-gradient(180deg, #3C3C3C 0%, #303030 100%);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #1E1E1E;
  user-select: none;
}
.mac-dots { display: flex; align-items: center; gap: 7px; }
.mac-dot-r { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
.mac-dot-y { width: 11px; height: 11px; border-radius: 50%; background: #FEBC2E; }
.mac-dot-g { width: 11px; height: 11px; border-radius: 50%; background: #28C840; }
.dark-term-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; color: #737373; letter-spacing: 0.02em;
}
.dark-term-body {
  background: #161617;
  padding: 22px 26px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px; line-height: 1.9; color: #C9CDD4;
  overflow-x: auto;
}

.term-copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; cursor: pointer;
  font-size: 11px; font-family: 'Inter', sans-serif; font-weight: 600;
  letter-spacing: 0.02em; color: #8a8f99;
  background: transparent; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 9999px;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.term-copy-btn:hover  { color: #fff; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); }
.term-copy-btn.copied { color: #3EC9A0; border-color: rgba(62,201,160,0.4); background: rgba(62,201,160,0.08); }

.t-prompt  { color: #3EC9A0; font-weight: 700; }
.t-ok      { color: #3EC9A0; }
.t-key     { color: #7B808C; min-width: 150px; display: inline-block; }
.t-val     { color: #E2E5EC; font-weight: 500; }
.t-dim     { color: #474C56; }
.t-comment { color: #3D4249; font-style: italic; }

@keyframes blink { from,to { opacity:1; } 50% { opacity:0; } }
.tw-cursor {
  display: inline-block; width: 2px; height: 1em;
  background: #3EC9A0; margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 0.75s step-end infinite;
}

/* ════════════════════════════════════════
   OPTIONS TABLE
════════════════════════════════════════ */
.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--border); }
.opts-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 480px; }
.opts-table thead { border-bottom: 1px solid var(--border); }
.opts-table th {
  background: var(--surface-2);
  padding: 12px 16px; text-align: left;
  font-weight: 600; font-size: 13px;
  color: var(--ink); letter-spacing: 0;
}
.opts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--ink-2); line-height: 1.5;
}
.opts-table tr:last-child td { border-bottom: none; }
.opts-table tr:hover td { background: var(--surface-2); }
.opts-table th, .opts-table td { border-left: none; border-right: none; }

.flag-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 5px;
  white-space: nowrap;
}
.ex-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 5px;
}
.req-badge {
  display: inline-block; margin-left: 6px;
  padding: 1px 6px; font-size: 10px; font-weight: 600;
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fecaca; border-radius: 4px;
  vertical-align: middle;
}

/* ════════════════════════════════════════
   CMD CONTENT SECTIONS
════════════════════════════════════════ */
.cmd-header-block {
  padding-bottom: 32px;
}

.cmd-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 32px;
  padding-bottom: 32px;
}

.cmd-section:last-child {
  padding-bottom: 60px;
}

/* ════════════════════════════════════════
   MISC COMPONENTS
════════════════════════════════════════ */
.section-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em;
  color: #71717a; text-transform: uppercase;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-3);
}
.breadcrumb .sep     { color: var(--ink-3); }
.breadcrumb .current { color: var(--ink-2); font-weight: 500; }

.info-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px;
}
.info-note p { font-size: 13px; color: var(--ink-2); line-height: 1.55; }

.scenario-card {
  padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.15s;
}
.scenario-card:hover { border-color: var(--ink); }

/* ════════════════════════════════════════
   MOBILE OVERLAY BACKDROP
════════════════════════════════════════ */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-h);
  background: rgba(0,0,0,0.28);
  z-index: 38;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#sidebar-backdrop.active { display: block; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */

/* ─── Tablet 768–1023px ─── */
@media (min-width: 768px) and (max-width: 1099px) {
  :root { --sidebar-w: 200px; }
  .docs-content { padding: 32px 32px 80px; }
}

/* ─── Large ≥ 1400px ─── */
@media (min-width: 1400px) {
  :root { --sidebar-w: 260px; }
  .docs-content { padding: 44px 56px 80px; }
}

/* ─── Mobile < 768px ─── */
@media (max-width: 767px) {

  :root { --nav-h: 56px; }

  /* Show hamburger, hide nav links */
  #sidebar-toggle-btn      { display: flex !important; }
  .docs-nav-links          { display: none !important; }

  /* Sidebar becomes off-canvas drawer */
  #sidebar {
    width: min(280px, 85vw) !important;
    transform: translateX(-110%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 32px rgba(0,0,0,0.14);
  }
  #sidebar.is-open { transform: translateX(0); }

  /* Main fills full width */
  .docs-main { margin-left: 0 !important; }

  /* Tighter content padding */
  .docs-content { padding: 24px 16px 60px !important; max-width: 100% !important; }

  /* Smaller terminal font */
  .dark-term-body { font-size: 11.5px !important; padding: 14px 14px !important; }

  /* Table horizontal scroll */
  .table-scroll-wrap { border-radius: 8px; }

  /* Command heading */
  #cmd-content h1 { font-size: clamp(24px, 6vw, 36px) !important; }

  /* Nav CTA — hide text, keep icon */
  .docs-nav-cta span.cta-text { display: none; }
  .docs-nav-cta { padding: 7px 10px; }
}



