/* Chi tiết bài viết CMS. Port từ khối <style> trong ui-template-v2/chi-tiet-tin.html.
   Thân bài HTML từ CMS đặt trong .cms-content - mọi style thẻ thô chỉ áp trong lớp này. */

.reading-progress-bar {
  position: fixed;
  top: 74px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cz-blue-primary), var(--cz-mint));
  z-index: 101;
  transition: width .1s ease;
}

.article-section { padding: 48px 0 92px; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 48px;
  align-items: start;
}
.article-sidebar { position: sticky; top: 98px; }

.article-body {
  /* Không đặt bài trong khung (template có nền, viền, padding 48px) - khung làm vùng đọc hẹp còn ~730px */
  min-width: 0;
}

.article-heading {
  font-size: 1.875rem;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}
.article-intro {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-light-sub);
  margin-bottom: 24px;
}
.article-intro p { margin: 0; }

.article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 0;
  margin-bottom: 28px;
  border-top: 1px solid var(--bg-card-border);
  border-bottom: 1px solid var(--bg-card-border);
}
.article-byline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: .8125rem;
  color: var(--text-muted);
}
.article-share { display: flex; align-items: center; gap: 8px; }
.article-share-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.article-share a,
.article-share button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--bg-card-border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.article-share svg { width: 16px; height: 16px; }
.article-share a:hover,
.article-share button:hover { border-color: var(--cz-blue-primary); color: var(--cz-blue-primary); }
.article-share button.is-copied { border-color: var(--cz-mint); color: var(--cz-mint); }

.article-cover { margin: 0 0 32px; }
.article-cover img { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--bg-card-border); }
.article-cover figcaption { margin-top: 8px; text-align: center; font-size: .8125rem; color: var(--text-muted); }

/* ---------- Thân bài CMS ---------- */
.cms-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-body);
  overflow-wrap: break-word;
}
.cms-content > :first-child { margin-top: 0; }
.cms-content p { margin: 0 0 22px; }
.cms-content h1,
.cms-content h2,
.cms-content h3,
.cms-content h4,
.cms-content h5,
.cms-content h6 { color: var(--text-heading); line-height: 1.35; font-weight: 700; scroll-margin-top: 96px; }
.cms-content h1,
.cms-content h2 {
  font-size: 1.625rem;
  margin: 44px 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-card-border);
}
.cms-content h3 { font-size: 1.25rem; margin: 28px 0 14px; }
.cms-content h4,
.cms-content h5,
.cms-content h6 { font-size: 1.0625rem; margin: 24px 0 12px; }
.cms-content a { color: var(--cz-blue-primary); text-decoration: underline; text-underline-offset: 2px; }
.cms-content a:hover { color: var(--cz-blue-hover); }
.cms-content strong,
.cms-content b { color: var(--text-heading); font-weight: 700; }
.cms-content ul,
.cms-content ol { margin: 0 0 22px; padding-left: 26px; }
.cms-content ul { list-style: disc; }
.cms-content ol { list-style: decimal; }
.cms-content ul ul { list-style: circle; }
.cms-content li { margin-bottom: 8px; }
.cms-content li > ul,
.cms-content li > ol { margin: 8px 0 0; }
.cms-content li::marker { color: var(--cz-blue-primary); }

.cms-content img {
  max-width: 100%;
  height: auto !important;
  border-radius: var(--radius-md);
  margin: 0 auto;
}
.cms-content iframe,
.cms-content video { max-width: 100%; border-radius: var(--radius-md); }
.cms-content figure { margin: 28px 0; max-width: 100%; width: auto !important; }
.cms-content figure img { margin: 0 auto; }
.cms-content figcaption,
.cms-content .image-caption,
.cms-content .caption {
  margin-top: 8px;
  text-align: center;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: italic;
}

.cms-content blockquote {
  background: var(--bg-surface);
  border-left: 4px solid var(--cz-blue-primary);
  padding: 18px 24px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 28px 0;
  color: var(--text-heading);
}
.cms-content blockquote p:last-child { margin-bottom: 0; }

.cms-content hr { border: 0; border-top: 1px solid var(--bg-card-border); margin: 36px 0; }

.cms-content code {
  font-family: var(--font-mono);
  font-size: .875em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  color: var(--text-heading);
}
.cms-content pre {
  margin: 0 0 22px;
  padding: 16px 20px;
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  font-size: .875rem;
  line-height: 1.6;
}
.cms-content pre code { padding: 0; border: 0; background: none; }

/* Bảng: cuộn ngang trong khung (class .cms-table-wrap do article.js bọc thêm) */
.cms-content .cms-table-wrap { max-width: 100%; overflow-x: auto; margin: 28px 0; -webkit-overflow-scrolling: touch; }
.cms-content table {
  width: 100% !important;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.6;
}
.cms-content > table { display: block; overflow-x: auto; margin: 28px 0; }
.cms-content th,
.cms-content td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-card-border);
  color: var(--text-body);
  text-align: left;
  vertical-align: top;
  min-width: 120px;
  background: transparent !important;
}
.cms-content th,
.cms-content thead td {
  background: var(--bg-surface) !important;
  color: var(--text-heading);
  font-weight: 700;
  border-bottom: 2px solid var(--bg-card-border);
}

/* Chữ CMS hay dán kèm màu inline (đen) - ép theo màu theme để đọc được ở chế độ tối */
html[data-theme="dark"] .cms-content [style*="color"] { color: inherit !important; }
html[data-theme="dark"] .cms-content [style*="background"] { background-color: transparent !important; }

/* Ô thông báo "đang cập nhật" trong partial nội dung chính sách (class Tailwind cũ .not-prose) */
.cms-content .not-prose {
  background: var(--cz-amber-soft);
  border: 1px solid rgba(255, 176, 32, .35);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: .9375rem;
  color: var(--text-heading);
  font-weight: 500;
}

/* ---------- Khối cuối bài ---------- */
.article-end-cta {
  margin-top: 40px;
  padding: 24px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
}
.article-end-cta-title { font-weight: 700; font-size: 1.0625rem; color: var(--text-heading); margin-bottom: 6px; }
.article-end-cta p { font-size: .9375rem; color: var(--text-body); }
.article-end-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.article-back { display: inline-block; margin-top: 28px; font-size: .875rem; font-weight: 600; color: var(--cz-blue-primary); }
.article-back:hover { color: var(--cz-blue-hover); }

.article-related { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--bg-card-border); }
.article-related-title { font-size: 1.5rem; color: var(--text-heading); margin-bottom: 24px; }

@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .article-sidebar { position: static; }
  .article-heading { font-size: 1.75rem; }
}
@media (max-width: 768px) {
  .article-section { padding: 28px 0 64px; }
  .article-heading { font-size: 1.5rem; }
  .article-intro { font-size: 1rem; }
  .cms-content { font-size: 1rem; line-height: 1.75; }
  .cms-content h1,
  .cms-content h2 { font-size: 1.375rem; margin-top: 32px; }
  .cms-content h3 { font-size: 1.15rem; }
  .cms-content th,
  .cms-content td { padding: 10px 12px; }
  .article-related { margin-top: 40px; padding-top: 28px; }
  .article-end-cta .btn { flex: 1 1 100%; justify-content: center; text-align: center; white-space: normal; }
}
