/* ══════════════════════════════════════════════════════════════
   TOCWOO — Mục lục bài viết  |  flatsome-dienmay child theme
   ══════════════════════════════════════════════════════════════ */

/* ── Container ─────────────────────────────────────────────── */
.tocwoo {
  background: #f8faff;
  border: 1px solid #d0dff5;
  border-left: 4px solid var(--pri, #1a6bbf);
  border-radius: 6px;
  margin: 20px 0 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  max-width: 780px;
}

/* ── Header ─────────────────────────────────────────────────── */
.tocwoo__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #d0dff5;
  background: #edf3fd;
  border-radius: 5px 5px 0 0;
}

.tocwoo__title {
  font-weight: 700;
  font-size: 14.5px;
  color: #1a3a6b;
  letter-spacing: .01em;
}

/* Nút thu gọn / mở rộng chính */
.tocwoo__toggle {
  background: none;
  border: 1px solid #b0c8e8;
  color: var(--pri, #1a6bbf);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.tocwoo__toggle:hover {
  background: var(--pri, #1a6bbf);
  color: #fff;
  border-color: var(--pri, #1a6bbf);
}

/* ── List gốc ───────────────────────────────────────────────── */
#tocwoo-list {
  list-style: none;
  margin: 0;
  padding: 10px 16px 12px;
}
#tocwoo-list,
.toc-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── H2 ─────────────────────────────────────────────────────── */
.toc-h2 {
  margin: 4px 0;
}
.toc-h2__row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.toc-h2 > .toc-h2__row > .toc-link {
  font-weight: 600;
  color: #1a3a6b;
}

/* ── H3 ─────────────────────────────────────────────────────── */
.toc-sub {
  padding-left: 20px;
  margin-top: 2px;
}
.toc-h3 {
  margin: 3px 0;
}
.toc-h3__row {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── H4 ─────────────────────────────────────────────────────── */
.toc-h4 {
  margin: 2px 0;
}
.toc-h4 .toc-link {
  font-size: 13px;
  color: #555;
}

/* ── Link chung ─────────────────────────────────────────────── */
.toc-link {
  text-decoration: none;
  color: #2459a8;
  transition: color .15s;
  flex: 1;
  min-width: 0;
}
.toc-link:hover {
  color: var(--pri, #e3440c);
  text-decoration: underline;
}
.toc-link--active {
  color: var(--pri, #e3440c) !important;
  font-weight: 700;
}

/* ── Số thứ tự ──────────────────────────────────────────────── */
.toc-num {
  display: inline-block;
  min-width: 26px;
  color: var(--pri, #1a6bbf);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Nút toggle sub-list ▶/▼ ────────────────────────────────── */
.toc-sub-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  color: #8a9ec5;
  padding: 2px 4px;
  line-height: 1;
  transition: color .15s, transform .2s;
  flex-shrink: 0;
}
.toc-sub-toggle:hover {
  color: var(--pri, #1a6bbf);
}
.toc-sub-toggle[aria-expanded="true"] {
  transform: rotate(90deg);
}

/* ── Sub-list ẩn khi collapsed ──────────────────────────────── */
.toc-sub--hidden {
  display: none;
}

/* ── Khi toàn bộ TOC bị thu gọn ────────────────────────────── */
.tocwoo.tocwoo--collapsed #tocwoo-list {
  display: none;
}
.tocwoo.tocwoo--collapsed .tocwoo__header {
  border-bottom: none;
  border-radius: 5px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tocwoo { font-size: 13px; }
  .toc-num { min-width: 22px; }
}
