/**
 * VNLibs.com - E-book Print Stylesheet
 * Version: 4.0.0 (Final & Safe Version)
 * Description: Giao diện in hoàn hảo, an toàn tuyệt đối cho giao diện gốc.
 */

/* ===============================================
 * 1. THIẾT LẬP TRANG IN & TIÊU ĐỀ ĐẦU/CUỐI TRANG
 * =============================================== */
@page {
  margin: 2cm 2cm;
}
@page:first {
  margin: 0;
  @top-left { content: none; }
  @top-right { content: none; }
  @bottom-center { content: none; }
}
@page {
  @top-left {
    content: "VNLibs.com";
    font-size: 9pt; color: #666; font-style: italic;
  }
  @top-right {
    content: string(doctitle, first); 
    font-size: 9pt; color: #666; font-style: italic;
  }
  @bottom-center {
    content: "Trang " counter(page);
    font-size: 10pt; color: #333;
  }
}

body {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.6;
}
body {
    string-set: doctitle attr(data-title);
}

/* ===============================================
 * 2. ẨN CÁC THÀNH PHẦN KHÔNG CẦN THIẾT
 * =============================================== */
#header, .navmenu, .mobile-nav-toggle, .social-share-buttons, .breadcrumb-meta, .breadcrumb
#footer, .cookie-consent, script, noscript, [data-sharer],
#turnstile-container,
.author-info-box,

/* [MỚI] Ẩn toàn bộ các yếu tố liên quan đến quảng cáo khi in */
.ad-container,      /* Class chứa quảng cáo của bạn */
ins.adsbygoogle,     /* Thẻ của Google AdSense */
iframe[id*="google_ads_iframe"], /* Iframe quảng cáo của Google */
div[id*="M[..."],    /* Các ID quảng cáo của MGID thường có dạng này */
div[id*="ezoic"]     /* Các ID quảng cáo của Ezoic nếu có */
{
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* ===============================================
 * 3. [HOÀN THIỆN] TRANG BÌA - PHIÊN BẢN TƯƠNG THÍCH TUYỆT ĐỐI
 * =============================================== */
.entry-header {
  position: static;
  height: auto;
  min-height: auto;
  page-break-after: always;

  /* Dùng padding lớn để nội dung tự căn ra giữa và chiếm gần hết trang */
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 4vh 2cm !important;
  box-sizing: border-box;
  border: none !important;
}

/* Các quy tắc còn lại của trang bìa giữ nguyên */
.entry-header .entry-title {
  order: 1;
  font-size: 32pt !important;
  font-weight: 700;
  margin-bottom: 3vh !important;
  border: none !important; padding: 0 !important;
}
.entry-header .entry-title a {
  color: inherit !important; text-decoration: none !important;
}
.entry-header .entry-image {
  order: 2;
  margin: 0 auto 3vh auto;
}
.entry-header .entry-image img {
  max-width: 50% !important; 
  max-height: 50% !important;
  object-fit: contain; box-shadow: none !important;
}
.entry-header .entry-image figcaption {
  font-size: 12pt; font-style: italic; color: #555; margin-top: 15px;
}
#print-cover-meta {
  order: 3;
  font-size: 14pt;
  color: #333;
  width: 100%;
}
#print-cover-meta .meta-container {
  display: flex;
  justify-content: center;
  gap: 2.5em;
  margin-bottom: 1em;
}
#print-cover-meta p { margin: 0.5em 0; }
#print-cover-meta .description {
  margin-top: 1.5em;
  font-size: 11pt;
  color: #444;
}
#print-cover-meta .print-separator {
  display: none;
}
#print-cover-meta .homepage-link {
  margin-top: 2em;
  font-size: 14pt;
  font-weight: bold;
}
#print-cover-meta .homepage-link a {
    color: #000 !important; text-decoration: none !important;
}

/* ===============================================
 * 4. NỘI DUNG CHÍNH
 * =============================================== */
.entry-content p {
  text-align: justify;
  widows: 3; orphans: 3;
}
.entry-content h2, .entry-content h3, .entry-content h4 {
  page-break-after: avoid;
  margin-top: 2em;
}
.entry-content a {
  color: inherit !important; text-decoration: none !important;
}

/* ===============================================
 * 5. [HOÀN HẢO] BÀI VIẾT LIÊN QUAN - BẢNG ĐƠN SẮC (FIXED)
 * =============================================== */
.related-articles-section {
  display: block !important;
  page-break-before: always;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  font-family: "Times New Roman", Times, serif;
}

/* Định dạng lại tiêu đề của bảng */
.related-articles-section h2#related-articles-heading {
  display: block !important;
  font-size: 0 !important;
  text-align: left;
  margin-bottom: 1em;
}
.related-articles-section h2#related-articles-heading::before {
  content: "Tài liệu tham khảo:";
  font-size: 18pt;
  font-weight: bold;
  color: #000;
  margin: 5cm;
}

/* --- CSS Bảng - Độc lập & Không biến --- */

/* [SỬA] Loại bỏ TOÀN BỘ biến (var) để đảm bảo độc lập */
.table-responsive-wrapper {
  border: 2px solid #000;
  margin-top: 1cm;
  border-radius: 0;
  background-color: transparent; /* Bỏ màu nền */
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11pt;
  color: #000;
}

thead {
  background-color: transparent;
  color: #000;
  border-bottom: 2px solid #000;
  border: 1px solid #000 !important;
}

/* [SỬA] Đặt MỘT quy tắc border duy nhất, nhất quán */
th, td {
  border: 1px solid #000 !important;
  padding: 0.8em;
  text-align: left;
  vertical-align: middle;
}

/* Căn chỉnh riêng cho header và cột STT */
th {
  text-align: center;
  font-weight: bold;
}
td:first-child {
  text-align: center;
  width: 10%; /* Giới hạn độ rộng cột STT */
}

/* [SỬA] Ép buộc link thành màu đen, không gạch chân */
tbody td a {
  color: #000 !important; /* Cưỡng chế màu đen */
  text-decoration: none !important; /* Cưỡng chế bỏ gạch chân */
  font-weight: bold !important;
}

/* Đảm bảo không còn màu nền */
tbody tr:nth-child(even) {
  background-color: transparent;
}

/* ===============================================
 * 6. [NÂNG CẤP] THÔNG TIN BẢN QUYỀN
 * =============================================== */
footer.site-footer {
  display: block !important;
  background: none !important;
  border: none !important;
  padding: 0 !important; margin: 0 !important;
  margin-top: 4em;
  page-break-before: auto;
}
footer .site-info {
  display: block !important;
  text-align: center;
  font-size: 12pt;
  color: #555;
  border-top: 1px solid #ccc;
  padding-top: 1em;
}
footer .site-info p, footer .site-info span {
  display: inline !important;
}
