/* =============================================================
   news-detail.css — styles สำหรับหน้ารายละเอียดข่าว
   ใช้กับ pages/news/news-detail.php
   ============================================================= */

/* ---------- Wrapper ---------- */
/* เอา max-width:860px ออก ให้เต็มความกว้างของ .inner-content แทน
   (เดิมจำกัดไว้ทำให้เหลือพื้นที่ว่างด้านขวาเยอะ ไม่พอดีขอบ — ตกลงกับ EK 2026-07-27) */
.nd-wrap {
  width: 100%;
}

/* ---------- Back link ---------- */
.nd-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
  margin-bottom: 1.25rem;
  transition: color 0.12s;
}

.nd-back:hover {
  color: #1e40af;
}

/* ---------- Badge ---------- */
.nd-badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 9999px;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* ---------- Title ---------- */
.nd-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

/* ---------- Meta ---------- */
.nd-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.nd-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ---------- Keyword badges ---------- */
.nd-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.nd-keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #185fa5;
  background: #e6f1fb;
  padding: 4px 10px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.12s;
}

.nd-keyword-tag:hover {
  background: #d0e4f7;
}

/* ---------- Cover image ---------- */
.nd-cover {
  width: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 12px;
  display: block;
  margin-bottom: 1.75rem;
  background: #f3f4f6;
}

/* landscape (ratio >= 1.2): สูง 400px
   (ลดจาก 420px เดิม ให้สอดคล้องกับหน้าโฮม — ตกลงกับ EK 2026-07-27) */
.nd-cover--landscape {
  max-height: 400px;
}

/* square (0.8 <= ratio < 1.2): กว้างเต็ม container เหมือนเดิม แค่สูงขึ้นเป็น 550px */
.nd-cover--square {
  max-height: 550px;
}

/* portrait (ratio < 0.8): กว้างเต็ม container เหมือนเดิม แค่สูงขึ้นเป็น 650px */
.nd-cover--portrait {
  max-height: 650px;
}

/* ---------- Body content ---------- */
.nd-body {
  font-size: 15px;
  line-height: 1.8;
  color: #374151;
  margin-bottom: 2rem;
}

.nd-body h2,
.nd-body h3 {
  font-weight: 600;
  color: #111827;
  margin: 1.5rem 0 0.5rem;
}

.nd-body h2 {
  font-size: 18px;
}
.nd-body h3 {
  font-size: 16px;
}

.nd-body p {
  margin: 0 0 1rem;
}

.nd-body ul,
.nd-body ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.nd-body li {
  margin-bottom: 4px;
}

/* ---------- Section title ---------- */
.nd-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.875rem;
  margin-top: 2rem;
}

/* ---------- Gallery ---------- */
.nd-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}

.nd-gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4/3;
  background: #f3f4f6;
}

.nd-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  transition: transform 0.2s;
}

.nd-gallery-item:hover img {
  transform: scale(1.04);
}

.nd-gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  color: #fff;
  font-size: 22px;
}

.nd-gallery-item:hover .nd-gallery-overlay {
  opacity: 1;
}

.nd-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  font-size: 11px;
  padding: 18px 8px 6px;
  line-height: 1.4;
}

/* ---------- Attachments ---------- */
.nd-attach-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.nd-attach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

.nd-attach-row:last-child {
  border-bottom: none;
}

.nd-attach-row:hover {
  background: #eff6ff;
}

.nd-attach-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.nd-attach-body {
  flex: 1;
  min-width: 0;
}

.nd-attach-name {
  font-size: 14px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nd-attach-row:hover .nd-attach-name {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nd-attach-size {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

.nd-attach-dl {
  font-size: 15px;
  color: #d1d5db;
  flex-shrink: 0;
}

/* ---------- Related news ---------- */
.nd-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 1.5rem;
}

.nd-related-card {
  border: 0.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 0.12s;
}

.nd-related-card:hover {
  border-color: #185fa5;
}

.nd-related-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  background: #f3f4f6;
}

.nd-related-body {
  padding: 10px 12px;
}

.nd-rel-title {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  line-height: 1.5;
  margin-bottom: 4px;
}

.nd-related-card:hover .nd-rel-title {
  color: #1d4ed8;
}

.nd-rel-date {
  font-size: 12px;
  color: #9ca3af;
}

/* ---------- Related news keyword tags ---------- */
.nd-rel-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.nd-rel-keyword-tag {
  font-size: 10px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 7px;
  border-radius: 100px;
}

/* ---------- PDF Viewer Modal (shared from doc-list.css) ---------- */
.pdf-modal-bg {
  display: none;
  background: rgba(0, 0, 0, 0.52);
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.pdf-modal-bg.is-open {
  display: flex;
}

.pdf-modal {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  margin: auto;
}

.pdf-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
}

.pdf-modal__title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 3px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  font-size: 18px;
  line-height: 1;
}

.pdf-modal__close:hover {
  background: #f3f4f6;
  color: #374151;
}

.pdf-modal__toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
}

.pdf-modal__toolbar span {
  font-size: 12px;
  color: #6b7280;
}

.pdf-nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.1s;
}

.pdf-nav-btn:hover:not(:disabled) {
  background: #f3f4f6;
}

.pdf-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.pdf-modal__canvas-wrap {
  background: #525659;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  min-height: 480px;
}

.pdf-modal__canvas-wrap canvas {
  background: #fff;
  display: block;
  max-width: 100%;
}

.pdf-modal__status {
  color: #aaa;
  font-size: 13px;
  margin: auto;
}

.pdf-modal__foot {
  display: flex;
  justify-content: flex-end;
  padding: 8px 14px;
  border-top: 1px solid #f3f4f6;
}

.btn-open-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  text-decoration: none;
}

.btn-open-tab:hover {
  background: #f3f4f6;
  color: #374151;
}
