/* ===========================
   CHI TIẾT BÀI VIẾT PAGE STYLES
=========================== */

/* ── Article hero banner (image bg + red overlay) ── */
.art-hero {
  position: relative;
  overflow: hidden;
  padding: 40px 0 44px;
}

.art-hero-bg {
  position: absolute;
  inset: 0;
}

.art-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(120, 25, 25, .86) 0%, rgba(90, 18, 18, .9) 100%);
}

.art-hero .container {
  position: relative;
  z-index: 2;
}

.art-hero-bc {
  font-size: 14px;
  color: rgba(255, 255, 255, .7);
  margin-bottom: 36px;
}

.art-hero-bc a {
  color: rgba(255, 255, 255, .7);
}

.art-hero-bc a:hover {
  color: #fff;
}

.art-hero-title {
  font-size: clamp(26px, 3vw, 42px);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  max-width: 860px;
  margin-bottom: 22px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.art-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 15px;
  color: rgba(255, 255, 255, .85);
  margin-bottom: 18px;
}

.art-hero-meta .dot {
  color: rgba(255, 255, 255, .5);
}

.art-hero-meta strong {
  font-weight: 700;
  color: #fff;
}

.art-hero-share {
  display: flex;
  align-items: center;
  gap: 12px;
}

.art-hero-share .share-label {
  font-size: 15px;
  color: rgba(255, 255, 255, .85);
}

.art-hero-share a,
.art-hero-share .js-share-copy {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  cursor: pointer;
}

.art-hero-share a img,
.art-hero-share .js-share-copy img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.art-hero-share a:hover,
.art-hero-share .js-share-copy:hover {
  background: rgba(255, 255, 255, .3);
}

/* Thông báo "Đã sao chép link" */
.art-hero-share .share-copied {
  font-size: 13px;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  padding: 4px 10px;
  border-radius: 14px;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.art-hero-share .share-copied.show {
  opacity: 1;
  transform: translateX(0);
}

/* ── Two-column layout ── */
.art-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 52px;
  padding: 48px 0 80px;
  align-items: start;
}

/* Bài không có mục lục -> nội dung chiếm toàn bộ chiều rộng (giới hạn cho dễ đọc) */
.art-layout.no-toc {
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}

/* ── TOC Sidebar ── */
.art-toc {
  position: sticky;
  top: 130px;
  background: var(--bg-pale);
  border-radius: 10px;
  padding: 24px;
}

.art-toc h2,
.art-toc-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  margin-top: 0;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--red);
}

/* ── TOC đa cấp ── */
.art-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.art-toc .toc-item {
  position: relative;
  padding-left: 16px;       /* chỗ cho nút toggle/đường dẫn */
}

.art-toc .toc-item > a {
  font-size: 14px;
  color: var(--gray);
  line-height: 1.5;
  display: block;
  padding: 3px 0;
}

.art-toc .toc-item > a:hover {
  color: var(--red);
}

.art-toc .toc-item > a.active {
  color: var(--red);
  font-weight: 700;
}

/* Cấp con: thụt lề + đường kẻ dọc nhẹ */
.art-toc .toc-sub {
  margin: 2px 0 2px 8px;
  padding-left: 10px;
  border-left: 1px solid #e2c9c9;
}

/* Nút thu/xổ (mũi tên ▶ / ▼) */
.art-toc .toc-toggle {
  position: absolute;
  left: -2px;
  top: 6px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 1;
}

.art-toc .toc-toggle::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--gray);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s;
  margin: 3px 0 0 3px;
}

/* Đang mở -> mũi tên chỉ xuống */
.art-toc .has-children.open > .toc-toggle::before {
  transform: rotate(90deg);
}

/* Ẩn nhánh con khi không mở */
.art-toc .has-children > .toc-sub {
  display: none;
}
.art-toc .has-children.open > .toc-sub {
  display: block;
}

/* Mục có con: in đậm nhẹ cho dễ phân biệt */
.art-toc .has-children > a {
  font-weight: 600;
  color: var(--dark);
}

/* ── Article main ── */
.art-main {
  padding: 10px;
  min-width: 0;          /* cho phép grid item co lại, không tràn/bóp cột */
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Bảo vệ layout: mọi phần tử dán vào không vượt khung, reset float/width lạ */
.art-main * {
  max-width: 100%;
  box-sizing: border-box;
}

.art-main img,
.art-main video,
.art-main iframe {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px 0;
  border-radius: 8px;
}

/* Reset các khối/float lạ copy từ web khác */
.art-main div,
.art-main figure {
  float: none !important;
  width: auto !important;
  max-width: 100% !important;
  margin-left: 0;
  margin-right: 0;
}

/* ── Căn lề ảnh/video theo WYSIWYG (aligncenter / alignright / alignleft) ──
   Đặt SAU các reset ở trên để thắng độ ưu tiên. */

/* Căn giữa: ảnh/figure/khối do editor thêm class .aligncenter */
.art-main .aligncenter {
  display: block;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center;
}
/* Ảnh nằm trong <figure class="... aligncenter"> */
.art-main figure.aligncenter img,
.art-main .aligncenter img,
.art-main .aligncenter video,
.art-main .aligncenter iframe {
  margin-left: auto;
  margin-right: auto;
}

/* Một số editor căn giữa bằng text-align trên khối/đoạn bao ngoài */
.art-main [style*="text-align: center"] img,
.art-main [style*="text-align:center"] img,
.art-main p[style*="text-align: center"],
.art-main p[style*="text-align:center"] {
  margin-left: auto;
  margin-right: auto;
}

/* Căn phải */
.art-main .alignright {
  float: right !important;
  margin: 8px 0 12px 20px !important;
}
.art-main .alignright img {
  margin: 0;
}

/* Căn trái */
.art-main .alignleft {
  float: left !important;
  margin: 8px 20px 12px 0 !important;
}
.art-main .alignleft img {
  margin: 0;
}

/* Định dạng nội dung bài cho dễ đọc */
.art-main p {
  font-size: 17px;
  line-height: 1.8;
  color: #333;
  margin: 0 0 18px;
}

.art-main h2,
.art-main h3,
.art-main h4 {
  line-height: 1.4;
  margin: 32px 0 14px;
  color: var(--dark);
}

.art-main h2 { font-size: 26px; font-weight: 700; }
.art-main h3 { font-size: 22px; font-weight: 700; }
.art-main h4 { font-size: 19px; font-weight: 700; }

.art-main ul,
.art-main ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

/* Khôi phục bullet/số cho danh sách trong nội dung bài viết
   (reset toàn cục ở style.css đặt list-style: none). */
.art-main ul { list-style: disc; }
.art-main ol { list-style: decimal; }
.art-main ul ul { list-style: circle; }
.art-main ul ul ul { list-style: square; }
.art-main li { display: list-item; }

.art-main li {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 8px;
}

.art-main a {
  color: var(--red);
  text-decoration: underline;
}

.art-main blockquote {
  border-left: 4px solid var(--red);
  background: var(--bg-pale);
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

/* Bảng người dùng tự chèn (Table block / TinyMCE) */
.art-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 16px;
}

.art-main table th,
.art-main table td {
  border: 1px solid #ddd;
  padding: 10px 14px;
  text-align: left;
}

.art-main table th {
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.art-main table tr:nth-child(even) td {
  background: #fafafa;
}

/* ── Price table in article ── */
.art-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0 32px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.art-table thead tr {
  background: var(--red);
}

.art-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.art-table td {
  padding: 14px 20px;
  font-size: 16px;
  color: var(--dark);
  border-bottom: 1px solid #f0f0f0;
}

.art-table tr:nth-child(even) td {
  background: var(--bg-pale);
}

.art-table tr:last-child td {
  border-bottom: none;
}

.art-table tr:hover td {
  background: #f8e8e8;
}

/* ── Article figure ── */
.art-figure {
  margin: 32px 0;
}

.art-figure img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.art-figure figcaption {
  font-size: 13px;
  color: var(--gray-mid);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

/* ── CTA in article ── */
.art-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--yellow);
  color: var(--red);
  border-radius: 7px;
  padding: 14px 32px;
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 32px;
  transition: opacity .2s;
}

.art-cta:hover {
  opacity: .9;
}

/* ── Share buttons (bottom) ── */
.art-share {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 32px;
  border-top: 2px solid #eee;
  margin-top: 40px;
}

.art-share span {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.share-fb {
  background: #1877F2;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.share-zalo {
  background: #0068FF;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.share-tw {
  background: #1DA1F2;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.share-copy {
  background: var(--gray);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: Inter, sans-serif;
}

/* ── Related articles ── */
.related-sect {
  padding: 20px 0 80px;
}

@media (max-width: 1024px) {
  .art-layout {
    grid-template-columns: 220px 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .art-layout {
    grid-template-columns: 1fr;
  }

  .art-toc {
    position: static;
  }
}