.basa-template {
  display: flex;
  gap: 40px;
  padding-top: var(--padding-top);
}

.basa-sidebar {
  flex: 0 0 284px;
  padding: 8px;
  background-color: rgb(249 250 251);
}

/* Search styles */
.basa-search {
  margin-bottom: 16px;
}

.basa-search__wrapper {
  position: relative;
}

.basa-search__input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid rgb(226 230 236);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: all 0.25s ease;
  background-color: #fff;
}

.basa-search__input:focus {
  border-color: rgb(52 109 219);
  box-shadow: 0 0 0 3px rgba(52, 109, 219, 0.1);
}

.basa-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgb(106 110 119);
  pointer-events: none;
}

.basa-search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgb(226 230 236);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.basa-search__item {
  display: flex;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: rgb(28 29 31);
  border-bottom: 1px solid rgb(240 242 246);
  transition: all 0.2s ease;
}

.basa-search__item:last-child {
  border-bottom: none;
}

.basa-search__item:hover {
  background-color: rgb(240 242 246);
}

.basa-search__item-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: rgb(106 110 119);
  margin-top: 2px;
}

.basa-search__item-content {
  flex: 1;
  min-width: 0;
}

.basa-search__item-category {
  font-size: 11px;
  color: rgb(106 110 119);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.basa-search__item-title {
  font-size: 14px;
  font-weight: 500;
  color: rgb(28 29 31);
  margin-bottom: 4px;
  line-height: 1.3;
}

.basa-search__item-excerpt {
  font-size: 12px;
  color: rgb(106 110 119);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.basa-search__loading,
.basa-search__no-results,
.basa-search__error {
  padding: 16px 12px;
  text-align: center;
  font-size: 14px;
  color: rgb(106 110 119);
}

.basa-search__error {
  color: rgb(220 38 38);
}

/* Docs Accordion Styles */
.docs-accordion-wrapper {
  margin-top: 20px;
}

.docs-accordion-title {
  font-size: 20px;
  color: rgb(28, 29, 31);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.docs-accordion {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.docs-accordion__item {
  background-color: #fff;
  border: 1px solid rgb(226 230 236);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.docs-accordion__item:hover .docs-accordion__trigger span {
  color: rgb(28 29 31);
}

.docs-accordion__item:hover .docs-accordion__trigger .docs-accordion__icon {
  background-color: rgb(28 29 31);
}

.docs-accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  color: rgb(28 29 31);
  transition: all 0.2s ease;
}

.docs-accordion__trigger span {
  flex: 1;
  font-size: 16px;
  color: rgb(106, 110, 119);
  font-weight: normal;
}

.docs-accordion__icon {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  transition: transform 0.3s ease;
  background-color: rgb(121, 133, 155);
}

.docs-accordion__item.is-open .docs-accordion__icon {
  transform: rotate(90deg);
}

.docs-accordion__content {
  border-top: 1px solid rgb(240 242 246);
}

ul.docs-accordion__list {
  list-style: none;
  margin: 0;
  padding: 20px 40px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.docs-accordion__list li {
  position: relative;
  padding-left: 0;
}

.docs-accordion__list a {
  display: block;
  font-size: 16px;
  line-height: 1.2;
  color: rgb(52 109 219);
  text-decoration: none;
  text-decoration-line: underline;
  text-decoration-color: color-mix(
    in oklab,
    rgb(87, 110, 152) 40%,
    transparent
  );
  text-underline-offset: 2px;
  transition: all 0.25s ease;
  transition: all 0.2s ease;
}

.docs-accordion__list a:hover {
  color: rgb(28 29 31);
}

/* Docs Link Block */
.docs-link-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  margin: 20px 0;
  background-color: #fff;
  border: 1px solid rgb(226 230 236);
  border-radius: 8px;
  text-decoration: none;
  color: rgb(28 29 31);
  transition: all 0.2s ease;
}

.docs-link-block:hover {
  border-color: rgb(198 218 253);
  background-color: rgb(249 250 251);
}

.docs-link-block__text {
  flex: 1;
  font-size: 16px;
  font-weight: normal;
  color: rgb(28 29 31);
  line-height: 1.4;
}

.docs-link-block__icon {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  transition: transform 0.3s ease;
  background-color: rgb(121, 133, 155);
}

.docs-link-block:hover .docs-link-block__icon {
  transform: translateX(4px);
}

/* Link Preview Popup */
.link-preview-popup {
  position: absolute !important;
  background: white;
  border: 1px solid #e2e6ec;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0;
  z-index: 1000;
  max-width: 320px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  overflow: hidden;
}

.link-preview-popup.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile adjustments for link preview */
@media only screen and (max-width: 768px) {
  .link-preview-popup {
    max-width: 280px;
    font-size: 14px;
  }
}

.basa-content {
  flex: 1;
}

.basa-template__nvigation {
  flex: 0 0 224px;
  position: relative;
}

/* TOC block inside sticky container */
.basa-toc,
.basa-sidebar {
  position: sticky;
  top: calc(var(--header-offset, 0px) + 32px);
  height: calc(var(--toc-available-height, auto) - var(--footer-height, 0px));
  overflow: auto;
}

/* docs sidebar */
.basa-sidebar__list {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.basa-sidebar__item {
  position: relative;
}

.basa-sidebar__item + .basa-sidebar__item {
  margin-top: 4px;
}

.basa-sidebar__link {
  display: inline-block;
  min-height: 26px;
}

.basa-sidebar__item .basa-sidebar__link {
  color: rgb(52 109 219);
}

.basa-sidebar__item.is-current .basa-sidebar__link {
  color: rgb(52 109 219);
}

.basa-sidebar__item-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 12px;
  border-radius: 6px;

  transition: all 0.25s ease;
}

.basa-sidebar__sub .basa-sidebar__item-inner {
  border-radius: 0 6px 6px 0;
}

.basa-sidebar__link-text,
.basa-toc__link {
  font-size: 14px;
  color: color-mix(in oklab, rgb(28 29 31) 64%, transparent);

  transition: all 0.25s ease;
}

.basa-sidebar__item-inner:hover,
.is-current > .basa-sidebar__item-inner {
  background-color: rgb(240 242 246);
}

.basa-sidebar__sub .is-current > .basa-sidebar__item-inner {
  border-left: 1px solid rgb(52 109 219);
  margin-left: -1px;
}

.basa-sidebar__item-inner:hover .basa-sidebar__link-text {
  color: rgb(28 29 31);
}

.is-current > .basa-sidebar__item-inner .basa-sidebar__link-text {
  color: rgb(52 109 219);
}

.basa-sidebar__sub .basa-sidebar__item-inner {
  padding-left: 20px;
}

.basa-sidebar__toggle {
  position: relative;
  z-index: 2;
  display: inline-block;
  border: 0;
  background: transparent;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  cursor: pointer;
  vertical-align: middle;
  border-radius: 99px;

  transition: all 0.25s ease;
}

.basa-sidebar__toggle:hover {
  background-color: rgb(234 237 2426);
}

.basa-sidebar__toggle:before {
  content: "";
  display: inline-block;
  background-image: url("../img/docs/chevron-docs.svg");
  width: 12px;
  height: 12px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
}

.is-open > .basa-sidebar__item-inner .basa-sidebar__toggle:before {
  transform: rotate(90deg);
}

.basa-sidebar__sub {
  margin-left: 20px;
  margin-top: 6px;

  border-left-style: solid;
  border-left-width: 1px;
  border-color: rgb(226 230 236);
}

.basa-toc__list {
  list-style: none;
  margin: 0;
  padding-left: 0;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.basa-toc__link {
  display: inline-block;
  min-height: 26px;
  border-radius: 6px;
  width: 100%;
  padding: 6px 12px 6px 12px;
  transition: all 0.25s ease;
  position: relative;
  text-decoration: none;
}

.basa-toc__link:hover {
  background-color: rgb(240 242 246);
  color: rgb(28 29 31);
}

.basa-toc__link.is-active {
  color: rgb(52 109 219);
  position: relative;
}

.basa-toc__sub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.basa-nav {
  margin-top: 24px;
  display: flex;
  gap: 0.25rem;
}

.basa-nav__link {
  height: 100%;
  padding: 16px;
  border: 1px solid rgb(226 230 236);
  border-radius: 4px;
  display: flex;
  gap: calc(0.25rem * 4);
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: rgb(28 29 31);

  transition: all 0.25s ease;
}

.basa-toc__sub-list .basa-toc__item {
  margin-left: 12px;
  border-left: 1px solid rgb(213, 217, 224);
}

.basa-nav__link:hover {
  border-color: rgb(198 218 253);
}

.basa-toc__sub-list .basa-toc__link {
  border-radius: 0 4px 4px 0;
}

.basa-nav__link-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basa-nav__link-icon svg {
  background-color: rgb(121, 133, 155);
  object-fit: contain;
  width: 100%;
  height: 100%;
  transition: all 0.25s ease;
}

.basa-nav__link:hover .basa-nav__link-icon svg {
  background-color: rgb(87, 110, 152);
}

.basa-nav__prev,
.basa-nav__next {
  flex: 1;
}

.basa-nav__link-text span {
  display: block;
  font-size: 12px;
  color: #6f6e77;
}

.basa-nav__link-text .basa-nav__link__title {
  display: block;
  font-size: 16px;
  color: rgb(28 29 31);
  line-height: 120%;
  font-weight: normal;

  transition: all 0.25s ease;
}

.basa-nav__prev .basa-nav__link__title {
  text-align: right;
}

.basa-nav__prev:hover .basa-nav__link__title,
.basa-nav__next:hover .basa-nav__link__title {
  color: rgb(87 110 152);
}

.basa-nav__prev .basa-nav__link-text span {
  text-align: right;
}

.basa-nav__next .basa-nav__link-text span {
  text-align: left;
}

.last-update__title {
  font-size: 0.875rem;
}

.last-update {
  margin-top: 24px;
  color: rgb(106 110 119);
}

.basa-content__title {
  margin-top: 10px;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 120%;
}

.basa-content__sub-title {
  color: rgb(106, 110, 119);
  font-size: 1.125rem;
  font-weight: normal;
}

.basa-content {
  margin-top: 24px;
}

.top-nav-basa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Mobile sidebar toggle */
@media only screen and (max-width: 969px) {
  .basa-template {
    gap: 20px;
  }

  .basa-template__nvigation {
    display: none;
  }

  .top-nav-basa {
    flex-direction: column-reverse;
    align-items: flex-start;
    row-gap: 15px;
  }

  /* Sidebar becomes off-canvas */
  #docs-sidebar.basa-sidebar {
    position: fixed;
    top: var(--header-offset, 68px);
    left: 0;
    bottom: 0;
    z-index: 101;
    width: min(84vw, 320px);
    max-width: 90vw;
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  }

  body.docs-sidebar-open #docs-sidebar {
    transform: translateX(0);
    top: 0;
  }

  /* Hide sticky behavior for mobile */
  .basa-toc,
  .basa-sidebar {
    position: static;
    height: auto;
  }

  /* Show open button on mobile */
  .basa-sidebar-open.sm_view {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border-radius: 8px;
    border: 1px solid #e2e6ef;
    background: #fff;
    color: rgb(28 29 31);
    position: fixed;
    /* left: 100%; */
    right: 0;
    top: 50%;
    top: 50svh; /* stable centering on mobile to avoid jump */
    transform: translateY(-50%);
    border-radius: 6px 0 0 6px;
    border-right: #fff;
    z-index: 2;
  }

  .basa-sidebar-open.sm_view svg {
    width: 24px;
    height: 24px;
  }

  /* Burger to X animation */
  .basa-burger {
    position: relative;
    width: 24px;
    height: 18px;
    display: inline-block;
  }

  .basa-burger__line {
    position: absolute;
    right: 0; /* align to right edge */
    left: auto;
    width: 100%;
    height: 2px;
    background: #000000b6;
    border-radius: 2px;
    transform-origin: 100% 50%; /* rotate around right edge */
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease,
      bottom 0.25s ease, width 0.25s ease;
  }

  .basa-burger__line:nth-child(1) {
    top: 0;
    width: 24px;
  }
  .basa-burger__line:nth-child(2) {
    top: 8px;
    width: 18px;
  }
  .basa-burger__line:nth-child(3) {
    bottom: 0;
    width: 12px;
  }

  /* When sidebar is open, icon is burger; when hidden (default), we show burger.
     Add X state when body has .docs-sidebar-open to morph lines. */
  body.docs-sidebar-open .basa-sidebar-open .basa-burger__line:nth-child(1) {
    top: 8px;
    width: 14px; /* match longest for clean X */
    transform: rotate(45deg);
  }
  body.docs-sidebar-open .basa-sidebar-open .basa-burger__line:nth-child(2) {
    opacity: 0;
    transform: translateX(6px);
  }
  body.docs-sidebar-open .basa-sidebar-open .basa-burger__line:nth-child(3) {
    bottom: auto;
    top: 8px;
    width: 14px; /* match longest for clean X */
    transform: rotate(-45deg);
  }

  /* Dark overlay */
  .basa-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.35);
  }

  body:not(.docs-sidebar-open) .basa-sidebar-overlay {
    display: none;
  }

  .basa-content__title {
    font-size: 24px;
  }
}

/* Mobile sidebar toggle */
@media only screen and (max-width: 769px) {
  .basa-nav {
    flex-direction: column;
  }

  .last-update {
    margin-top: 10px;
  }
}
