/* Bottom Bar Component - Main CSS Entry Point */
/* Import all component styles in order */
/* Bottom Bar Component - Base Styles */
/* Main container */
.bottom-bar {
  position: fixed;
  bottom: var(--kb, 0px);
  /* --kb is now scoped on the element itself */
  left: 0;
  right: 0;
  z-index: 1050;
  background: white;
  /* Explicit base opacity + long fade; keep drawer slide snappy */
  opacity: 1;
  transition: opacity 1s ease, transform 0.3s ease-in-out;
  will-change: transform, bottom, opacity;
  /* hint that bottom and opacity may change */
  transform: translateY(0); }

/* When closed, slide so only the top bar (60px) peeks above the bottom edge */
.bottom-bar:not(.is-open) {
  /* use the element-scoped variable with a fallback of 60px */
  --bar-top-height: 60px;
  transform: translateY(calc(100% - var(--bar-top-height))); }

/* Top Bar */
.bottom-bar__top {
  height: 60px;
  background: white;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  position: relative; }

/* Content containers */
.bottom-bar__content {
  padding: 20px;
  opacity: 0;
  display: none;
  transition: opacity 0.2s ease;
  height: 100%;
  overflow-y: auto; }

.bottom-bar__content.is-active {
  display: block;
  opacity: 1; }

/* Custom scrollbar */
.bottom-bar__content::-webkit-scrollbar {
  width: 6px; }

.bottom-bar__content::-webkit-scrollbar-track {
  background: #f1f1f1; }

.bottom-bar__content::-webkit-scrollbar-thumb {
  background: #2F6BE3;
  border-radius: 3px; }

/* Firefox scrollbar */
.bottom-bar__content {
  scrollbar-width: thin;
  scrollbar-color: #2F6BE3 #f1f1f1; }

/* iOS safe area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-bar {
    padding-bottom: env(safe-area-inset-bottom); } }

/* Fade the whole bar when user is at the page bottom */
.bottom-bar.is-occluded-bottom {
  opacity: 0;
  pointer-events: none; }

#bottom-bar {
  transition: opacity .5s ease, transform 0.3s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  .bottom-bar {
    transition: none; } }

/* Bottom Bar Component - Button Styles */
/* Common button styles */
.bottom-bar__scroll-top,
.bottom-bar__search-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 1s ease;
  position: relative; }

/* Scroll to top button */
.bottom-bar__scroll-top {
  position: absolute;
  left: 20px;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.3s ease; }

.bottom-bar__scroll-top.is-hidden {
  opacity: 0;
  pointer-events: none; }

.bottom-bar__scroll-top .circle-bg {
  opacity: 0;
  transition: opacity 1s ease; }

.bottom-bar__scroll-top .arrow-icon {
  transition: fill 1s ease; }

/* JS-driven hover/active (no :hover) */
.bottom-bar__scroll-top.is-hover .circle-bg,
.bottom-bar__scroll-top.is-active .circle-bg {
  opacity: 1; }

.bottom-bar__scroll-top.is-hover .arrow-icon,
.bottom-bar__scroll-top.is-active .arrow-icon {
  fill: white; }

/* ToC Button */
.bottom-bar__toc-btn {
  background: transparent;
  border: 1px solid #2F6BE3;
  border-radius: 200px;
  color: #2F6BE3;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 1s ease; }

.bottom-bar__toc-btn .toc-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: stroke 1s ease; }

/* JS-driven hover/active (no :hover) */
.bottom-bar__toc-btn.is-hover,
.bottom-bar__toc-btn.is-active {
  background: #2F6BE3;
  color: white; }

.bottom-bar__toc-btn.is-hover .toc-icon,
.bottom-bar__toc-btn.is-active .toc-icon {
  stroke: white; }

/* Search Button */
.bottom-bar__search-btn {
  position: absolute;
  right: 0; }

.bottom-bar__search-btn .circle-bg {
  opacity: 0;
  transition: opacity 1s ease; }

.bottom-bar__search-btn .search-icon {
  transition: all 1s ease; }

.bottom-bar__search-btn .search-icon circle,
.bottom-bar__search-btn .search-icon line {
  transition: stroke 1s ease; }

/* JS-driven hover/active (no :hover) */
.bottom-bar__search-btn.is-hover .circle-bg,
.bottom-bar__search-btn.is-active .circle-bg {
  opacity: 1; }

.bottom-bar__search-btn.is-hover .search-icon circle,
.bottom-bar__search-btn.is-hover .search-icon line,
.bottom-bar__search-btn.is-active .search-icon circle,
.bottom-bar__search-btn.is-active .search-icon line {
  stroke: white; }

.bottom-bar__search-btn svg {
  width: 40px;
  height: 40px; }

.bottom-bar__scroll-top svg {
  width: 32px;
  height: 32px; }

/* Perfect vertical centering for the TOC button */
.bottom-bar__toc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  line-height: 1; }

/* Inline SVGs baseline-align by default; make it a block so flex can truly center it */
.bottom-bar__toc-btn .toc-icon {
  display: block; }

/* Make the text box-tight so baseline quirks don't push it */
.bottom-bar__toc-btn > span {
  display: block;
  line-height: 1; }

/* Bottom Bar Component - Drawer Styles */
/* Drawer container */
.bottom-bar__drawer {
  background: white;
  border-top: 1px solid #e0e0e0;
  overflow: hidden;
  height: 0;
  transition: height 0.3s ease-in-out;
  --bb-toc-max-height: 70vh; }

/* Drawer height states */
.bottom-bar__drawer.state-toc {
  max-height: var(--bb-toc-max-height); }

.bottom-bar__drawer.state-search {
  height: 120px; }

/* Drawer height states - Mobile Small */
@media (max-width: 575px) {
  .bottom-bar__drawer {
    --bb-toc-max-height: 70vh; } }

/* Drawer height states - Mobile Medium */
@media (min-width: 576px) and (max-width: 767px) {
  .bottom-bar__drawer {
    --bb-toc-max-height: 60vh; } }

/* Drawer height states - Tablet */
@media (min-width: 768px) and (max-width: 991px) {
  .bottom-bar__drawer {
    --bb-toc-max-height: 50vh; } }

/* Drawer height states - Desktop Small */
@media (min-width: 992px) and (max-width: 1199px) {
  .bottom-bar__drawer {
    --bb-toc-max-height: 40vh; } }

/* Drawer height states - Desktop Large */
@media (min-width: 1200px) {
  .bottom-bar__drawer {
    --bb-toc-max-height: 35vh; } }

/* Bottom Bar Component - TOC Styles */
/* TOC Wrapper */
.bottom-bar-toc-wrapper {
  padding: 0; }

.bottom-bar-toc-title {
  color: #2F6BE3;
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: 600;
  padding: 0 20px; }

/* TOC List Styles */
.bottom-bar-toc {
  font-size: 20px; }

.bottom-bar-toc__list {
  list-style: none;
  margin: 0;
  padding: 0; }

.bottom-bar-toc__item {
  position: relative;
  margin: 0; }

.bottom-bar-toc__item-wrapper {
  display: flex;
  align-items: center;
  position: relative; }

/* Toggle button for expandable items */
.bottom-bar-toc__toggle {
  /* keep the circle look */
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  border: 1px solid #d6d6d6;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0;
  padding: 0;
  cursor: pointer; }

/* strip hover visuals entirely */
.bottom-bar-toc__toggle:hover {
  border-color: #d6d6d6;
  background: #fff;
  color: #666; }

/* keep the rotate change on expand/collapse */
.bottom-bar-toc__toggle .chevron {
  width: 14px;
  height: 14px;
  transform: rotate(-90deg);
  transition: transform 0.3s ease; }

.bottom-bar-toc__toggle[aria-expanded="true"] .chevron {
  transform: rotate(0); }

/* TOC Links */
.bottom-bar-toc__link {
  display: block;
  padding: 8px 10px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  flex: 1;
  position: relative; }

.bottom-bar-toc__link:hover {
  color: #2F6BE3;
  background-color: rgba(47, 107, 227, 0.05); }

.bottom-bar-toc__link.active {
  color: #2F6BE3;
  font-weight: 600;
  background-color: rgba(47, 107, 227, 0.1);
  border-left-color: #2F6BE3; }

/* Language indicator */
.bottom-bar-toc__link .lang-indicator {
  font-size: 12px;
  opacity: 0.7;
  margin-left: 4px; }

/* Children lists (nested items) */
.bottom-bar-toc__children {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* Remove CSS transitions - handled by JS now */
  /* Initial state handled by JS */ }

/* When expanded class is added (JS will handle actual animation) */
.bottom-bar-toc__children.expanded {
  /* JS will set height and opacity */ }

/* Indent nested levels */
.bottom-bar-toc__children .bottom-bar-toc__item-wrapper {
  padding-left: 24px; }

.bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__item-wrapper {
  padding-left: 48px; }

.bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__item-wrapper {
  padding-left: 72px; }

.bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__children .bottom-bar-toc__item-wrapper {
  padding-left: 96px; }

/* Active path highlighting */
.bottom-bar-toc__item.active-path > .bottom-bar-toc__item-wrapper > .bottom-bar-toc__link {
  color: #2F6BE3;
  font-weight: 500; }

/* No placeholder circles for leaf items */
.bottom-bar-toc__item.without-child > .bottom-bar-toc__item-wrapper {
  padding-left: 34px; }

.bottom-bar-toc__item.without-child > .bottom-bar-toc__item-wrapper::before {
  content: none; }

/* keep active-path circle border a bit stronger (no hover involved) */
.bottom-bar-toc__item.active-path > .bottom-bar-toc__item-wrapper > .bottom-bar-toc__toggle,
.bottom-bar-toc__item.active > .bottom-bar-toc__item-wrapper > .bottom-bar-toc__toggle {
  border-color: #2F6BE3; }

/* Prevent layout shift during animations */
.bottom-bar-toc__children * {
  will-change: opacity; }

/* Ensure smooth text rendering during opacity animations */
.bottom-bar-toc__children {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; }

/* Bottom Bar Component - Search Styles */
/* Search content container */
.bottom-bar-search-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 20px; }

.bottom-bar-search {
  position: relative;
  width: 100%;
  max-width: 600px; }

/* Search submit button */
.bottom-bar-search-submit {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #999;
  /* Grey by default */
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  z-index: 1; }

/* When button is disabled (no text) */
.bottom-bar-search-submit:disabled {
  cursor: default;
  color: #999; }

/* When button is enabled (has text) */
.bottom-bar-search-submit:not(:disabled) {
  color: #2F6BE3; }

.bottom-bar-search-submit:not(:disabled):hover {
  opacity: 0.8; }

.bottom-bar-search-submit:not(:disabled):active {
  opacity: 0.6; }

/* Search input */
.bottom-bar-search-input {
  width: 100%;
  padding: 12px 20px 12px 45px;
  font-size: 16px;
  text-indent: 0; }

/* Mobile adjustments */
@media (max-width: 768px) {
  .bottom-bar-search-container {
    padding: 15px; }
  /* When input is focused, ensure it's visible */
  .bottom-bar-search-input:focus {
    position: relative; } }

/* Bottom Bar Component - Animations & Transitions */
/* Smooth transitions for drawer state changes */
.bottom-bar {
  transition: transform 0.3s ease-in-out; }

.bottom-bar__drawer {
  transition: height 0.3s ease-in-out; }

.bottom-bar__content {
  transition: opacity 0.2s ease; }

/* Button hover transitions */
.bottom-bar__scroll-top,
.bottom-bar__search-btn,
.bottom-bar__toc-btn {
  transition: all .2s; }

/* Icon animations */
.bottom-bar__scroll-top .circle-bg,
.bottom-bar__search-btn .circle-bg {
  transition: opacity 0.2s; }

.bottom-bar__scroll-top .arrow-icon {
  transition: fill 0.2s; }

.bottom-bar__search-btn .search-icon,
.bottom-bar__search-btn .search-icon circle,
.bottom-bar__search-btn .search-icon line {
  transition: stroke 0.2s; }

.bottom-bar__toc-btn .toc-icon {
  transition: stroke 0.2s; }

/* TOC toggle button rotation animation (kept for chevron) */
.bottom-bar-toc__toggle {
  transition: transform 0.2s ease; }

.bottom-bar-toc__toggle .chevron {
  transition: transform 0.3s ease; }

/* TOC link hover animation */
.bottom-bar-toc__link {
  transition: all 0.2s; }

/* TOC children animations handled by JavaScript */
/* Removed .bottom-bar-toc__children transition to prevent conflicts */
/* Scroll top button visibility */
.bottom-bar__scroll-top {
  transition: opacity 0.3s ease; }

/* Search input focus animation */
.bottom-bar-search-input {
  transition: all 0.3s ease; }

/* Ensure smooth rendering during animations */
@media (prefers-reduced-motion: no-preference) {
  .bottom-bar-toc__children {
    will-change: height, opacity; } }

/* For users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bottom-bar-toc__children {
    /* JS will check for this and skip animations */
    will-change: auto; } }

/* Bottom Bar Component - Responsive Styles */
/* Already defined drawer heights in drawer.css, this file for other responsive needs */
/* iOS Safe Area Support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-bar {
    padding-bottom: env(safe-area-inset-bottom); } }

@media (max-width: 767px) {
  .bottom-bar-search-container {
    padding: 15px; }
  .bottom-bar-search-input:focus {
    position: relative; }
  .bottom-bar-toc__link {
    padding: 6px 10px; } }

/* Hide bottom-bar at this breakpoint and higher*/
@media (min-width: 768px) {
  #bottom-bar {
    display: none; } }
