/* ═══════════════════════════════════════════════════
   print.css — Print-Friendly Styles
   ใช้กับ media="print"
   ═══════════════════════════════════════════════════ */

/* ─── ปุ่ม Print (แสดงเฉพาะจอ) ─── */
.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: #fff;
  color: var(--text-main);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-print:hover {
  border-color: var(--primary);
  background: #f0f7ff;
  color: var(--primary);
}

/* ─── Print Rules ─── */
@media print {
  /* Reset */
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  @page {
    size: A4;
    margin: 1.5cm;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    background: #fff !important;
  }

  /* ซ่อน elements ที่ไม่ต้องพิมพ์ */
  .topbar,
  .main-nav,
  .site-header,
  .site-footer,
  #backToTop,
  .theme-toggle,
  .bookmark-btn,
  .btn-print,
  .share-btn,
  .news-share,
  .related-news,
  .news-reply-form,
  .sidebar,
  .quick-links,
  .hero-slider,
  .hero-section,
  .bulk-toolbar,
  .sidebar-toggle,
  .pagination,
  .msg-actions,
  nav.main-nav,
  nav[aria-label="breadcrumb"] {
    display: none !important;
  }

  /* Page Container */
  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Article */
  article,
  .news-detail-content {
    width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .news-detail-img {
    max-height: 10cm;
    page-break-inside: avoid;
    margin-bottom: 8mm;
  }

  /* หัวข้อ */
  h1, h2, h3, h4, h5 {
    color: #000 !important;
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  h1 { font-size: 18pt; margin-bottom: 6mm; }
  h2 { font-size: 15pt; margin: 6mm 0 3mm; }
  h3 { font-size: 13pt; }

  /* Paragraph */
  p, li {
    orphans: 3;
    widows: 3;
  }

  /* Images */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Links */
  a {
    color: #000 !important;
    text-decoration: none !important;
  }
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #444;
  }
  /* ไม่ต้องแสดง URL ของลิงก์ภายในเว็บ */
  a[href^="/"]:after,
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }

  /* Tables */
  table {
    border-collapse: collapse;
    width: 100%;
    page-break-inside: auto;
  }
  th, td {
    border: 1px solid #333 !important;
    padding: 4mm 3mm !important;
    font-size: 10pt;
  }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }

  /* Cards */
  .card {
    border: 1px solid #999 !important;
    page-break-inside: avoid;
    margin-bottom: 5mm;
  }

  /* Page break helpers */
  .page-break { page-break-after: always; }
  .page-break-before { page-break-before: always; }
  .no-print { display: none !important; }

  /* Print Header */
  .print-header {
    display: block !important;
    border-bottom: 2px solid #000;
    padding-bottom: 4mm;
    margin-bottom: 6mm;
    font-size: 10pt;
  }
  .print-header .print-title {
    font-size: 14pt;
    font-weight: bold;
  }
  .print-header .print-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 3mm;
    color: #333;
  }

  /* Print Footer */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    border-top: 1px solid #999;
    padding-top: 2mm;
    color: #555;
  }
}

/* ─── ไม่แสดง Print Header/Footer บนจอ ─── */
.print-header,
.print-footer {
  display: none;
}