/* ============================================================================
   Documentation Sidebar — docs-sidebar.css

   Layout (3 direct children of #maintext flex container):
     .gs-docs-sidebar-bg  — position:absolute, top:0, bottom:0 (visual only)
     .gs-docs-sidebar     — position:sticky, top:0 (the actual nav)
     .gs-docs-content-wrap — flex:1 (page content)
   ========================================================================== */

/* --- Layout --- */
#maintext.gs-has-sidebar {
  display: flex !important;
  position: relative !important;
  float: none !important;
}

/* Visual-only background/border — stretches full height of #maintext */
#maintext.gs-has-sidebar > .gs-docs-sidebar-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 260px;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  z-index: 1;
  pointer-events: none;
}

#maintext.gs-has-sidebar > .gs-docs-sidebar-bg.gs-sb-collapsed-sidebar {
  display: none;
}

/* Content wrap — takes remaining width */
#maintext.gs-has-sidebar > .gs-docs-content-wrap {
  flex: 1;
  min-width: 0;
}

#maintext.gs-has-sidebar > .gs-docs-content-wrap.gs-sb-content-full {
  margin-left: 0;
}

#maintext.gs-has-sidebar .bodytext {
  padding-left: 24px;
  padding-right: 24px;
}

#maintext.gs-has-sidebar table {
  max-width: 100%;
}

/* --- Sidebar (sticky, viewport-height, scrollable) --- */
#maintext .gs-docs-sidebar {
  position: sticky;
  top: 0;
  width: 260px;
  min-width: 260px;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  box-sizing: border-box;
  padding: 20px 0 40px 0;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: #c4c8cc transparent;
  align-self: flex-start;
}

#maintext .gs-docs-sidebar::-webkit-scrollbar {
  width: 5px;
}

#maintext .gs-docs-sidebar::-webkit-scrollbar-thumb {
  background: #c4c8cc;
  border-radius: 3px;
}

#maintext .gs-docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Filter input --- */
#maintext .gs-docs-sidebar .gs-sb-filter {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px !important;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  background: #f9fafb;
  color: #1B3A5C;
  box-sizing: border-box;
}

#maintext .gs-docs-sidebar .gs-sb-filter:focus {
  border-color: #0097A7;
  background: #fff;
}

#maintext .gs-docs-sidebar .gs-sb-filter::placeholder {
  color: #9ca3af;
}

/* --- Collapse / expand toggle --- */
.gs-docs-sidebar-toggle {
  position: fixed;
  left: 0;
  bottom: 60px;
  z-index: 100;
  width: 28px;
  height: 28px;
  border: 1px solid #d1d5db;
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #1B3A5C;
  transition: background-color 0.15s ease;
  padding: 0;
  line-height: 1;
}

.gs-docs-sidebar-toggle:hover {
  background: #f3f4f6;
}

/* --- Group headings --- */
#maintext .gs-docs-sidebar .gs-sb-group {
  margin: 0;
  padding: 0;
}

#maintext .gs-docs-sidebar .gs-sb-group-hdr {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px !important;
  font-weight: 600;
  color: #1B3A5C;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s ease;
  letter-spacing: 0.01em;
}

#maintext .gs-docs-sidebar .gs-sb-group-hdr:hover {
  background: #f3f4f6;
}

#maintext .gs-docs-sidebar .gs-sb-chevron {
  display: inline-block;
  width: 16px;
  font-size: 10px !important;
  color: #6b7280;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

#maintext .gs-docs-sidebar .gs-sb-group.gs-sb-open > .gs-sb-group-hdr > .gs-sb-chevron {
  transform: rotate(90deg);
}

/* --- Page links --- */
#maintext .gs-docs-sidebar .gs-sb-pages {
  display: none;
}

#maintext .gs-docs-sidebar .gs-sb-group.gs-sb-open > .gs-sb-pages {
  display: block;
}

#maintext .gs-docs-sidebar .gs-sb-pages > a {
  display: block;
  padding: 3px 14px 3px 34px;
  color: #4b5563 !important;
  text-decoration: none !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: color 0.1s ease, border-color 0.1s ease, background-color 0.1s ease;
}

#maintext .gs-docs-sidebar .gs-sb-pages > a:visited {
  color: #4b5563 !important;
}

#maintext .gs-docs-sidebar .gs-sb-pages > a:hover {
  color: #0097A7 !important;
  background: #f9fafb;
  text-decoration: none !important;
}

#maintext .gs-docs-sidebar .gs-sb-pages > a.gs-sb-current {
  color: #1B3A5C !important;
  font-weight: 600;
  border-left-color: #0097A7;
  background: #eef6f7;
}

/* --- Per-page TOC --- */
#maintext .gs-docs-sidebar .gs-sb-toc-label {
  display: block;
  padding: 14px 14px 6px;
  font-size: 11px !important;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px solid #e5e7eb;
  margin-top: 10px;
}

#maintext .gs-docs-sidebar .gs-sb-toc > a {
  display: block;
  padding: 3px 14px 3px 18px;
  color: #4b5563 !important;
  text-decoration: none !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  border-left: 3px solid transparent;
  transition: color 0.1s ease, border-color 0.1s ease;
}

#maintext .gs-docs-sidebar .gs-sb-toc > a:visited {
  color: #4b5563 !important;
}

#maintext .gs-docs-sidebar .gs-sb-toc > a:hover {
  color: #0097A7 !important;
  text-decoration: none !important;
}

#maintext .gs-docs-sidebar .gs-sb-toc > a.gs-sb-active {
  color: #0097A7 !important;
  border-left-color: #0097A7;
  font-weight: 500;
}

#maintext .gs-docs-sidebar .gs-sb-toc > a.gs-sb-toc-sub {
  padding-left: 30px;
  font-size: 12px !important;
}

/* --- Visibility states --- */
#maintext .gs-docs-sidebar .gs-sb-hidden {
  display: none !important;
}

#maintext .gs-docs-sidebar.gs-sb-collapsed-sidebar {
  display: none;
}

/* --- Print --- */
@media print {
  #maintext .gs-docs-sidebar,
  #maintext .gs-docs-sidebar-bg,
  .gs-docs-sidebar-toggle {
    display: none !important;
  }
  #maintext.gs-has-sidebar > .gs-docs-content-wrap {
    margin-left: 0;
  }
  #maintext.gs-has-sidebar .bodytext {
    padding-left: 48px;
    padding-right: 48px;
  }
}

/* --- Mobile --- */
@media only screen and (max-width: 768px) {
  #maintext.gs-has-sidebar > .gs-docs-sidebar-bg {
    display: none;
  }

  #maintext .gs-docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    background: #fff;
    display: none;
  }

  #maintext .gs-docs-sidebar.gs-sb-mobile-open {
    display: block;
  }

  #maintext.gs-has-sidebar > .gs-docs-content-wrap {
    margin-left: 0;
  }

  .gs-docs-sidebar-toggle {
    display: flex;
    bottom: 20px;
  }

  .gs-docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
  }

  .gs-docs-sidebar-overlay.gs-sb-mobile-open {
    display: block;
  }
}
