/* Style trang chi tiết bài viết (5 nhóm + Học bổng), dùng chung qua
 * FMEPost.renderPostDetail. Theme sáng navy/trắng của FME; font theo token
 * fme-refined.css (--fme-font, Segoe UI...), KHÔNG khai Be Vietnam Pro.
 * Không sửa fme-refined.css / fme-header.css / public-media.css.
 * Các class sidebar (.fme-detail-aside, .fme-side-*) được định nghĩa ở đây
  * để mọi trang chi tiết dùng chung (dùng trong HTML). */

/* --- Bố cục 2 cột: bài + sidebar phải --- */
.fme-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 16px 56px;
  font-family: var(--fme-font);
}
.fme-detail-col { min-width: 0; }

/* Card trắng bao nội dung (nền trang #f4f7fa) — chấm dứt "text tràn". */
.fme-detail-wrap {
  background: #fff;
  border: 1px solid #dbe4ec;
  border-radius: 16px;
  padding: 32px;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Khối chi tiết (thứ tự 2 plan) */
.fme-detail-crumb { font-size: 12px; color: #556678; margin: 0; }
.fme-detail-crumb a { color: #556678; }
.fme-detail-crumb a:hover { color: #2274ba; }

.fme-detail-back { margin: 14px 0 0; font-size: 14px; }
.fme-detail-back a { font-weight: 700; }

.fme-detail-badge-row { margin: 0; }
.fme-detail-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #e8eef7;
  color: #163c5e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.fme-detail h1 {
  font-size: 36px;
  line-height: 1.25;
  color: #163c5e;
  margin: 12px 0 8px;
  overflow-wrap: break-word;
}
.fme-detail-meta { font-size: 13px; color: #5f6f7d; margin: 0 0 18px; }

/* Hero: figure 16:9, bo góc 12px. Chỉ render khi có coverImage thật. */
.fme-detail-hero { margin: 0 0 22px; }
.fme-detail-hero figure {
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #edf3fa;
}
.fme-detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tóm tắt: sapo in nghiêng, muted, 17–18px, sau hero. */
.fme-detail-excerpt {
  font-size: 17px;
  line-height: 1.7;
  color: #5a6b7a;
  font-style: italic;
  margin: 0 0 18px;
}

/* Dòng chuyên mục cuối bài (chỉ link chuyên mục của bài, không bịa tag). */
.fme-detail-tags {
  margin: 28px 0 0;
  padding-top: 16px;
  border-top: 1px solid #e9eef4;
  font-size: 13px;
  color: #768995;
}
.fme-detail-tags a { font-weight: 700; }

/* --- Nội dung .article-body: typography đầy đủ --- */
/* (sanitizeHtml lược mọi style= trong content nên typography bắt buộc qua
 * class CSS này; H1 trong content style riêng để không đụng H1 trang.) */
.article-body { font-size: 17px; line-height: 1.8; color: #222; overflow-wrap: break-word; }
.article-body p { margin: 0 0 16px; font-size: 17px; line-height: 1.8; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body h1 { color: #163c5e; font-size: 24px; line-height: 1.3; margin: 28px 0 12px; }
.article-body h2 { color: #163c5e; font-size: 26px; line-height: 1.35; margin: 32px 0 12px; }
.article-body h3 { color: #163c5e; font-size: 20px; line-height: 1.4; margin: 26px 0 10px; }
.article-body h4 { color: #163c5e; font-size: 18px; line-height: 1.4; margin: 22px 0 8px; }
.article-body h5 { color: #163c5e; font-size: 17px; margin: 20px 0 8px; }
.article-body h6 { color: #163c5e; font-size: 16px; margin: 18px 0 8px; }
.article-body blockquote {
  border-left: 4px solid #dc7840;
  margin: 18px 0;
  padding: 6px 16px;
  color: #33475e;
}
.article-body blockquote p { margin: 0 0 8px; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body table {
  border-collapse: collapse;
  max-width: 100%;
  margin: 0 0 16px;
  display: block;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.6;
}
.article-body th, .article-body td {
  border: 1px solid #dbe4ec;
  padding: 8px 10px;
  text-align: left;
}
.article-body th { background: #f2f6fa; color: #163c5e; }
.article-body pre {
  background: #f2f6fa;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
}
.article-body code {
  background: #f2f6fa;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .9em;
}
.article-body pre code { background: none; padding: 0; }
.article-body figure { margin: 18px 0; text-align: center; }
.article-body figcaption {
  font-size: 13px;
  color: #768995;
  margin-top: 8px;
  text-align: center;
}
.article-body img { max-width: 100%; height: auto; border-radius: 8px; }
.article-body hr { border: none; border-top: 1px solid #e9eef4; margin: 24px 0; }
.article-body a { overflow-wrap: break-word; }

/* Chi tiết Tuyển dụng / Thực tập (redesign) */
/* Card thông tin thay meta-grid nền #f5f7fa kiểu bảng thô: lưới 2 cột,
 * mỗi mục có icon cam + nhãn uppercase nhỏ + giá trị navy đậm. H1 đầu
 * .article-body (Mô tả công việc) không cần khoảng trên lớn sau card. */
.fme-recruit-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 32px;
  background: #f8fafc;
  border: 1px solid #dbe4ec;
  border-radius: 12px;
  padding: 20px 22px;
  margin: 0 0 26px;
}
.fme-recruit-item { display: flex; gap: 12px; min-width: 0; align-items: flex-start; }
.fme-recruit-icon { flex: 0 0 18px; width: 18px; height: 18px; color: #dc7840; margin-top: 3px; }
.fme-recruit-item-text { min-width: 0; }
.fme-recruit-item-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #768995;
}
.fme-recruit-item-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #163c5e;
  line-height: 1.45;
  overflow-wrap: break-word;
}
.fme-detail .article-body > h2:first-child { margin-top: 0; }

/* Lưới trường form nộp hồ sơ (học bổng + tuyển dụng/thực tập dùng chung
 * markup .hb-field-grid — trước đây luật này chỉ có trong
 * scholarships.html nên form tuyển dụng/thực tập vỡ layout: các ô dồn một
 * hàng, nhãn đè ô nhập. Đặt ở đây để mọi trang chi tiết dùng chung. */
.hb-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hb-field-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: #18396b; }
.hb-field-grid label.wide { grid-column: 1 / -1; }
.hb-field-grid input, .hb-field-grid select, .hb-field-grid textarea { padding: 10px 12px; border: 1px solid #d9dfe7; border-radius: 8px; font: inherit; font-weight: 400; color: #222; width: 100%; box-sizing: border-box; }
.hb-field-grid .hint { font-size: 12px; font-weight: 400; color: #768995; }

/* --- Bài liên quan: lưới card ≤4 --- */
.fme-detail-related { margin-top: 44px; min-width: 0; }
.fme-detail-related-title {
  font-size: 20px;
  color: #163c5e;
  border-bottom: 2px solid #17376c;
  padding-bottom: 8px;
  margin: 0 0 16px;
}
.fme-detail-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* --- Sidebar phải (sticky desktop, xuống dưới bài khi <1024px) --- */
.fme-detail-aside {
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 20px;
}
.fme-side-block {
  background: #fff;
  border: 1px solid #dbe4ec;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
.fme-side-block:last-child { margin-bottom: 0; }
.fme-side-title {
  font-size: 16px;
  color: #163c5e;
  border-bottom: 2px solid #17376c;
  padding-bottom: 8px;
  margin: 0 0 14px;
}
.fme-side-search { display: flex; gap: 8px; }
.fme-side-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--fme-font);
}
.fme-side-search input:focus { outline: 2px solid #2274ba; outline-offset: 0; border-color: #2274ba; }
.fme-side-search button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #163c5e;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--fme-font);
  cursor: pointer;
  white-space: nowrap;
}
.fme-side-search button:hover { background: #2274ba; }
.fme-side-list, .fme-side-recent {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fme-side-list li, .fme-side-recent li { border-bottom: 1px solid #e9eef4; }
.fme-side-list li:last-child, .fme-side-recent li:last-child { border-bottom: none; }
.fme-side-list a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 2px;
  font-size: 14px;
  font-weight: 700;
  color: #17366d;
}
.fme-side-list a:hover { color: #2274ba; }
.fme-side-list .fme-side-count { color: #768995; font-weight: 400; }
.fme-side-recent a {
  display: block;
  padding: 10px 2px 2px;
  font-size: 14px;
  font-weight: 700;
  color: #17366d;
  line-height: 1.5;
}
.fme-side-recent a:hover { color: #2274ba; }
.fme-side-recent time, .fme-side-recent .fme-side-date {
  display: block;
  padding: 0 2px 10px;
  font-size: 12px;
  color: #768995;
}
.fme-side-empty { font-size: 14px; color: #768995; padding: 4px 2px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .fme-detail-layout { grid-template-columns: minmax(0, 1fr); }
  .fme-detail-aside { position: static; }
}
@media (max-width: 640px) {
  .fme-detail-layout { padding: 24px 12px 40px; gap: 24px; }
  .fme-detail-wrap { padding: 20px 16px; border-radius: 12px; }
  .fme-detail h1 { font-size: 28px; }
  .fme-detail-excerpt { font-size: 17px; }
  .article-body, .article-body p { font-size: 16px; }
  .article-body h2 { font-size: 22px; }
  .article-body h3 { font-size: 19px; }
  .fme-detail-related-grid { grid-template-columns: minmax(0, 1fr); }
  .fme-recruit-card { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; }
}
