.lt-toc * {
  box-sizing: border-box;
}

html[data-color-theme="dark"] .lt-toc--container {
  background: #22292c !important;
  border-color: #465053 !important;
  box-shadow: none !important;
  color: #f2f4f4 !important;
}

html[data-color-theme="dark"] .lt-toc--title,
html[data-color-theme="dark"] .lt-toc--current,
html[data-color-theme="dark"] .lt-toc--link:not(.is-active) {
  color: #f2f4f4 !important;
}

html[data-color-theme="dark"] .lt-toc--list {
  border-color: #465053 !important;
}

.lt-toc--list {
  padding-left: 0;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.lt-toc--link {
  display: block;
  padding: 6px 12px;
  text-decoration: none;
}

.lt-toc--link.is-active {
  background: currentColor;
}

.lt-toc--link.is-active span {
  color: #fff;
}

.lt-toc--current {
  padding: 6px 12px;
}

.lt-toc_is-desktop {
  position: relative;
}

.lt-toc_is-desktop .lt-toc--title {
  margin: 0 0 12px;
  font-size: 20px;
}

.lt-toc_is-desktop .lt-toc--current {
  display: none;
}

.lt-toc_is-desktop .lt-toc--item {
  margin-bottom: 6px;
}

.lt-toc_is-desktop .lt-toc--list {
  display: block !important;
}

.lt-toc_is-desktop .lt-toc--link {
  border-radius: 4px;
}

.lt-toc-mobile {
  display: none;
}

.lt-toc-mobile.is-active {
  display: block;
}

.lt-toc-mobile,
.lt-toc_is-mobile {
  width: 100%;
  height: 50px;
}

.lt-toc-mobile_start {
  margin-bottom: 24px;
}

.lt-toc-mobile_end {
  margin-top: 24px;
}

/* OLD - REPLACED BY BELOW
.lt-toc_is-mobile {
  position: absolute;
  z-index: 99;
}*/

/*Custom POWER fix*/
.lt-toc_is-mobile {
  position: absolute;
  z-index: 99;
  top: 3.1rem !important;
  left: 2.4rem !important;
}

.lt-toc_is-mobile.lt-toc_is-bottom {
  top: 0 !important;
}

.lt-toc_is-mobile .lt-toc--container {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}

.lt-toc_is-mobile .lt-toc--title {
  position: absolute;
  top: 0;
  left: 12px;
  display: block;
  padding: 2px 4px;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
  /*background: #eee;*/
  background-color: var(--link-color); /*CUSTOM POWER*/
  color: var(--text-color); /*CUSTOM POWER*/
  font: var(--font-family-body);
  border-radius: 4px;
  transform: translateY(-50%);
}

.lt-toc_is-mobile .lt-toc--list {
  display: none;
  border-top: 1px solid #e8e8e8;
}

.lt-toc_is-mobile .lt-toc--current,
.lt-toc_is-mobile .lt-toc--link {
  padding: 12px;
  font-size: 16px;
  line-height: 1.5;
}

.lt-toc_is-mobile .lt-toc--current {
  position: relative;
  padding-right: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.lt-toc_is-mobile .lt-toc--current:after,
.lt-toc_is-mobile .lt-toc--current:before {
  position: absolute;
  right: 22px;
  bottom: 50%;
  display: block;
  content: "";
  background: #4e5565;
  border-radius: 1px;
  transition: all 0.3s;
  transform: translate(50%, 50%);
}

.lt-toc_is-mobile .lt-toc--current:before {
  width: 2px;
  height: 12px;
}

.lt-toc_is-mobile .lt-toc--current:after {
  width: 12px;
  height: 2px;
}

.lt-toc_is-mobile .lt-toc--container.is-active .lt-toc--current:before {
  transform: translate(50%, 50%) rotate(-90deg);
}

.lt-toc_is-mobile .lt-toc--container.is-active .lt-toc--current:after {
  opacity: 0;
  transform: translate(50%, 50%) rotate(-90deg);
}

.lt-toc_is-mobile .lt-toc--item:last-child a {
  border-radius: 0 0 4px 4px;
}

/* New styles to ensure TOC is always visible on desktop */
@media (min-width: 992px) {
  .lt-article-container__toc {
    display: block !important;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }

  .lt-toc {
    display: block !important;
  }

  .lt-toc--container {
    display: block !important;
  }
}
