/**
 * Mục lục «Trên trang này» — sidebar + mobile (trang chi tiết tin / tài nguyên).
 * Load khi có data-bun-news-toc="1".
 */

/* —— Card sidebar —— */
.news-detail-tpl .nh-side-panel.nh-article-toc-panel,
[data-bun-news-toc="1"] .nh-side-panel.nh-article-toc-panel {
  padding: 18px 18px 16px;
  background: linear-gradient(165deg, #fffaf6 0%, #fff 42%);
  border: 1px solid #f0e0d6;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(45, 31, 25, 0.07);
}

@media (min-width: 992px) {
  .news-detail-tpl .nh-detail-feed__row > .nh-sidebar--article-toc,
  .news-detail-tpl .nh-detail-feed > .row > .nh-sidebar--article-toc {
    align-self: stretch;
  }

  .news-detail-tpl .nh-sidebar--article-toc .nh-sidebar__stack {
    gap: 22px;
  }

  /* CSS sticky (khi trình duyệt cho phép) */
  .news-detail-tpl .nh-side-panel.nh-article-toc-panel,
  .news-hub .nh-sidebar--article-toc .nh-side-panel.nh-article-toc-panel,
  [data-bun-news-toc="1"] .nh-article-toc-sticky-host .nh-article-toc-panel {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--site-top-offset, 152px) + 14px);
    z-index: 6;
    max-height: calc(100vh - var(--site-top-offset, 152px) - 28px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 116, 24, 0.35) transparent;
  }

  /* JS neo cố định (html overflow-x làm sticky hay hỏng) */
  .nh-article-toc-panel.is-toc-fixed {
    position: fixed !important;
    z-index: 40;
    max-height: calc(100vh - var(--site-top-offset, 152px) - 28px);
    overflow: auto;
    box-sizing: border-box;
  }

  .nh-article-toc-panel.is-toc-stuck-bottom {
    position: absolute !important;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    z-index: 6;
    max-height: calc(100vh - var(--site-top-offset, 152px) - 28px);
    overflow: auto;
  }

  .nh-article-toc-sticky-placeholder {
    display: none;
    width: 100%;
    pointer-events: none;
  }

  [data-bun-news-toc="1"].resource-scope .resource-detail-main > .row > .col-lg-9 {
    align-self: stretch;
    position: relative;
  }

  [data-bun-news-toc="1"].resource-scope .resource-detail-content {
    min-height: 100%;
  }

  [data-bun-news-toc="1"].resource-scope .nh-article-toc-sticky-host {
    position: relative;
  }
}

.news-detail-tpl .nh-side-panel.nh-article-toc-panel h2,
[data-bun-news-toc="1"] .nh-side-panel.nh-article-toc-panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px !important;
  padding-bottom: 12px;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  color: #141110;
  border-bottom: 1px solid #f5ebe4;
  letter-spacing: -0.01em;
}

.news-detail-tpl .nh-side-panel.nh-article-toc-panel h2 i,
[data-bun-news-toc="1"] .nh-side-panel.nh-article-toc-panel h2 i {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 14px;
  color: #fff !important;
  background: linear-gradient(135deg, #ff8a15, #ff5d00);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(255, 93, 0, 0.28);
}

/* —— Danh sách mục lục —— */
.news-detail-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-detail-toc__item {
  margin: 0;
  padding: 0;
}

.news-detail-toc__list a {
  display: block;
  padding: 7px 10px 7px 12px;
  margin: 2px -8px;
  border-radius: 8px;
  color: #3d3835 !important;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
  text-decoration: none !important;
  border-left: 2px solid transparent;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.news-detail-toc__item--sub > a {
  padding-left: 20px;
  font-size: 13px;
  font-weight: 450;
  color: #5c5552 !important;
}

.news-detail-toc__list a:hover {
  color: #c44f00 !important;
  background: #fff6ef;
  border-left-color: #ff8a15;
}

.news-detail-toc__list a.is-active,
.news-detail-toc__list a[aria-current="true"] {
  color: #b84a00 !important;
  font-weight: 600;
  background: #fff4eb;
  border-left-color: #ff5d00;
}

/* —— Footer: về chuyên mục —— */
.news-detail-toc__foot {
  margin-top: 14px;
  padding-top: 14px !important;
  border-top: 1px solid #f0e4dc !important;
}

.news-detail-toc__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: #b84a00 !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  background: #fff4eb;
  border: 1px solid rgba(255, 116, 24, 0.3);
  border-radius: 999px;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.news-detail-toc__back:hover {
  color: #fff !important;
  background: linear-gradient(135deg, #ff8a15, #ff5d00);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(255, 93, 0, 0.28);
}

.news-detail-toc__back i {
  font-size: 14px;
}

/* —— Mobile accordion —— */
.news-detail-toc--mobile .accordion-item {
  overflow: hidden;
  border: 1px solid #f0e0d6 !important;
  border-radius: 14px !important;
  background: linear-gradient(165deg, #fffaf6 0%, #fff 50%);
  box-shadow: 0 8px 24px rgba(45, 31, 25, 0.06);
}

.news-detail-toc--mobile .accordion-button {
  font-size: 15px;
  font-weight: 600;
  color: #141110;
  background: transparent;
  box-shadow: none !important;
}

.news-detail-toc--mobile .accordion-button:not(.collapsed) {
  color: #b84a00;
  background: #fff6ef;
}

.news-detail-toc--mobile .accordion-button:focus {
  border-color: rgba(255, 116, 24, 0.35);
  box-shadow: 0 0 0 0.2rem rgba(255, 116, 24, 0.15) !important;
}

.news-detail-toc--mobile .accordion-body {
  padding-top: 0;
}
