/* Filter & Sort Bài Viết — UI 1.9.0 — smooth filter/load/collapse */
.hlpf {
  --hlpf-text: #111827;
  --hlpf-muted: #6b7280;
  --hlpf-line: #e7e7e7;
  --hlpf-soft: #fafafa;
  --hlpf-primary: #10245f;
  --hlpf-white: #fff;
  --hlpf-button-radius: 999px;
  --hlpf-button-gap: 7px;
  --hlpf-card-radius: 14px;
  width: 100% !important;
  max-width: 1080px !important;
  margin-right: auto !important;
  margin-left: auto !important;
  color: var(--hlpf-text);
  /* Khớp chiều rộng nội dung mặc định của Flatsome; cột cha giữ gutter hai bên. */
}

.hlpf *,
.hlpf *::before,
.hlpf *::after {
  box-sizing: border-box;
}

/* SVG icon system — khớp bộ icon tham chiếu */
.hlpf-icon-svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
}

/* ===== HERO ===== */
.hlpf__hero {
  margin: 0 0 28px !important;
  transition: opacity .2s ease, transform .2s ease;
}

.hlpf__hero[hidden] {
  display: none !important;
}

.hlpf__hero-label {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  gap: 6px;
  color: var(--hlpf-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hlpf__hero-label-icon {
  display: inline-flex;
  line-height: 1;
}

.hlpf-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(320px, .98fr);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--hlpf-line);
  border-radius: var(--hlpf-card-radius);
  background: var(--hlpf-white);
  box-shadow: 0 4px 15px rgba(16, 24, 40, .06);
}

.hlpf-hero-card__media {
  position: relative;
  display: block;
  min-height: 360px;
  overflow: hidden;
  background: #edf0f4;
}

.hlpf-hero-card__image,
.hlpf-hero-card__media .hlpf-card__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hlpf-hero-card__image {
  position: absolute;
  inset: 0;
}

.hlpf-hero-card__body {
  display: flex;
  min-width: 0;
  padding: 26px 28px 20px;
  flex-direction: column;
  justify-content: center;
}

.hlpf-hero-card__title {
  margin: 8px 0 12px !important;
  font-size: clamp(26px, 2.35vw, 37px) !important;
  font-weight: 700 !important;
  line-height: 1.13 !important;
  letter-spacing: -.025em !important;
  text-transform: none !important;
}

.hlpf-hero-card__title a {
  color: inherit !important;
  text-decoration: none !important;
}

.hlpf-hero-card__excerpt {
  display: -webkit-box;
  margin: 0 !important;
  overflow: hidden;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* ===== TITLE + CATEGORY ===== */
.hlpf__heading-row {
  display: grid !important;
  grid-template-columns: max-content minmax(0, 1fr) !important;
  gap: 18px !important;
  padding: 0 0 14px !important;
  align-items: center !important;
  border-bottom: 1px solid var(--hlpf-line) !important;
}

.hlpf__title {
  display: flex !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--hlpf-text) !important;
  font-size: clamp(26px, 2vw, 31px) !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  letter-spacing: -.025em !important;
  text-transform: none !important;
  white-space: nowrap !important;
}

.hlpf__title-icon {
  display: inline-flex !important;
  width: 19px !important;
  height: 19px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 19px !important;
  color: var(--hlpf-text) !important;
  line-height: 1 !important;
}

.hlpf__title-icon-svg {
  width: 18px !important;
  height: 18px !important;
}

.hlpf__categories {
  display: flex !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: var(--hlpf-button-gap) !important;
}

/* Chặn CSS button mặc định của Flatsome/theme */
.hlpf .hlpf__chip,
.hlpf .hlpf__sort,
.hlpf .hlpf__loadmore {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  border: 1px solid var(--hlpf-line) !important;
  background: var(--hlpf-white) !important;
  color: var(--hlpf-text) !important;
  font-family: inherit !important;
  font-style: normal !important;
  letter-spacing: 0 !important;
  text-decoration: none !important;
  text-indent: 0 !important;
  text-shadow: none !important;
  text-transform: none !important;
  box-shadow: none !important;
  cursor: pointer;
  appearance: none;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.hlpf .hlpf__chip {
  display: inline-flex !important;
  min-height: 32px !important;
  padding: 5px 12px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--hlpf-button-radius) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 20px !important;
  white-space: nowrap !important;
}

.hlpf .hlpf__chip:hover,
.hlpf .hlpf__sort:hover,
.hlpf .hlpf__loadmore:hover {
  border-color: #9da5b0 !important;
  color: var(--hlpf-primary) !important;
  background: var(--hlpf-white) !important;
}

.hlpf .hlpf__chip.is-active,
.hlpf .hlpf__sort.is-active {
  border-color: var(--hlpf-primary) !important;
  background: var(--hlpf-primary) !important;
  color: var(--hlpf-white) !important;
}

/* ===== SORT BAR ===== */
.hlpf__sortbar {
  display: flex !important;
  margin: 14px 0 24px !important;
  padding: 9px 12px !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  border: 1px solid var(--hlpf-line) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .88) !important;
}

.hlpf__sort-label {
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 7px !important;
  color: #5f6773 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap !important;
}

.hlpf__sort-label-icon {
  display: inline-flex !important;
  width: 15px !important;
  height: 15px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 15px !important;
  color: #315fa8 !important;
}

.hlpf__sort-label-icon-svg {
  width: 14px !important;
  height: 14px !important;
}

.hlpf__sort-options {
  display: flex !important;
  min-width: 0 !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 7px !important;
}

.hlpf .hlpf__sort {
  display: inline-flex !important;
  min-height: 32px !important;
  padding: 5px 11px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: var(--hlpf-button-radius) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 20px !important;
  white-space: nowrap !important;
}

.hlpf__sort-badge {
  padding: 2px 6px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .18) !important;
  font-size: 9px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  text-transform: none !important;
}

.hlpf__sort-icon {
  display: inline-flex !important;
  width: 15px !important;
  height: 15px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 15px !important;
  color: currentColor !important;
}

.hlpf__sort-icon-svg {
  width: 14px !important;
  height: 14px !important;
}

.hlpf__sort-icon img {
  display: block;
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.hlpf__sort.is-active .hlpf__sort-icon img {
  filter: brightness(0) invert(1);
}

/* ===== GRID ===== */
.hlpf__status {
  min-height: 0;
  margin: 0;
  color: transparent;
  font-size: 0;
}

.hlpf__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 18px;
  transition: opacity .2s ease, transform .2s ease;
}

.hlpf-card {
  display: flex;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--hlpf-line);
  border-radius: var(--hlpf-card-radius);
  background: var(--hlpf-white);
  box-shadow: 0 3px 12px rgba(16, 24, 40, .04);
  transition: transform .16s ease, box-shadow .16s ease;
}

.hlpf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 24, 40, .08);
}

.hlpf-card--collapse-out {
  opacity: 0;
  transform: translateY(14px) scale(.985);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease !important;
}

.hlpf.is-collapsing .hlpf__loadmore {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .hlpf-card--collapse-out,
  .hlpf__grid,
  .hlpf__hero {
    transition: none !important;
  }
}

.hlpf-card__image-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1.52 / 1;
  background: #edf0f4;
}

.hlpf-card__image,
.hlpf-card__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hlpf-card__placeholder {
  background: linear-gradient(135deg, #dde4ed, #f4f6f8);
}

.hlpf-card__category {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 9px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.hlpf-card__body {
  display: flex;
  min-height: 0;
  padding: 15px 16px 13px;
  flex: 1;
  flex-direction: column;
}

.hlpf-card__meta {
  display: flex;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--hlpf-muted);
  font-size: 12px;
  line-height: 1.3;
}

.hlpf-card__title {
  display: -webkit-box;
  margin: 0 !important;
  overflow: hidden;
  font-size: clamp(19px, 1.65vw, 23px) !important;
  font-weight: 700 !important;
  line-height: 1.18 !important;
  letter-spacing: -.02em !important;
  text-transform: none !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hlpf-card__title a {
  color: inherit !important;
  text-decoration: none !important;
}

.hlpf-card__excerpt {
  display: -webkit-box;
  margin: 9px 0 0 !important;
  overflow: hidden;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.hlpf-card__footer {
  display: flex;
  margin-top: auto;
  padding-top: 13px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--hlpf-line);
  color: var(--hlpf-muted);
  font-size: 12px;
}

.hlpf-card__metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--hlpf-muted);
  line-height: 1;
}

.hlpf-card__metric-icon {
  width: 15px !important;
  height: 15px !important;
  flex: 0 0 15px;
  color: #9aa1aa;
}

.hlpf-card__footer a {
  margin-left: auto;
  color: var(--hlpf-primary) !important;
  font-weight: 700;
  text-decoration: none !important;
}

.hlpf__loadmore-wrap {
  display: flex;
  margin-top: 30px;
  justify-content: center;
}

.hlpf .hlpf__loadmore {
  display: inline-flex !important;
  min-height: 40px !important;
  padding: 8px 17px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--hlpf-button-radius) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 20px !important;
}

.hlpf__empty {
  grid-column: 1 / -1;
  padding: 45px 20px;
  border: 1px dashed var(--hlpf-line);
  border-radius: var(--hlpf-card-radius);
  color: var(--hlpf-muted);
  text-align: center;
}

.hlpf.is-loading .hlpf__grid {
  min-height: 260px;
  opacity: .45;
  pointer-events: none;
}

.hlpf.is-replacing .hlpf__grid,
.hlpf.is-replacing .hlpf__hero {
  transform: translateY(4px);
}

.hlpf.is-replacing .hlpf__hero {
  opacity: .62;
}

.hlpf button[disabled] {
  cursor: wait;
  opacity: .72;
}

/* Skeleton */
.hlpf-skeleton {
  pointer-events: none;
}

.hlpf-skeleton__image,
.hlpf-skeleton__line {
  background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 37%, #eef1f4 63%);
  background-size: 400% 100%;
  animation: hlpf-shimmer 1.25s ease-in-out infinite;
}

.hlpf-skeleton__image {
  aspect-ratio: 1.52 / 1;
}

.hlpf-skeleton__line {
  height: 13px;
  margin-top: 12px;
  border-radius: 999px;
}

.hlpf-skeleton__line.is-short { width: 38%; }
.hlpf-skeleton__line.is-medium { width: 68%; }

@keyframes hlpf-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ===== TABLET ===== */
@media (max-width: 1050px) {
  .hlpf {
    max-width: 100% !important;
  }

  .hlpf__heading-row {
    grid-template-columns: 1fr !important;
    gap: 13px !important;
    align-items: start !important;
  }

  .hlpf__categories {
    justify-content: flex-start !important;
  }

  .hlpf__sortbar {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  .hlpf__sort-options {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  .hlpf__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== MOBILE ===== */
@media (max-width: 680px) {
  .hlpf {
    max-width: 100% !important;
  }

  .hlpf-hero-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hlpf-hero-card__media {
    min-height: 220px;
  }

  .hlpf-hero-card__body {
    padding: 19px;
  }

  .hlpf__title {
    font-size: 26px !important;
    white-space: normal !important;
  }

  .hlpf__categories,
  .hlpf__sort-options {
    width: 100% !important;
    padding-bottom: 5px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    scrollbar-width: thin;
  }

  .hlpf .hlpf__chip,
  .hlpf .hlpf__sort {
    flex: 0 0 auto !important;
  }

  .hlpf__sortbar {
    padding: 10px !important;
  }

  .hlpf__grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .hlpf-card__body {
    padding: 15px;
  }
}

/* Hidden state must win over theme/button display rules */
.hlpf .hlpf__loadmore[hidden] {
  display: none !important;
}


/* =========================================================
 * FINAL ALIGNMENT TUNE — CSS ONLY
 * Căn tiêu đề/category/sort sát giao diện mẫu.
 * Không thay đổi PHP, JS hoặc logic plugin.
 * ========================================================= */

@media (min-width: 1051px) {
  .hlpf__heading-row {
    gap: 18px !important;
  }

  .hlpf__title {
    font-size: 27px !important;
  }

  .hlpf__categories {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .hlpf .hlpf__chip {
    min-height: 30px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
    line-height: 20px !important;
  }

  .hlpf__sortbar {
    padding: 8px 10px !important;
  }

  .hlpf__sort-options {
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    gap: 6px !important;
  }

  .hlpf .hlpf__sort {
    min-height: 30px !important;
    padding: 4px 9px !important;
    font-size: 11px !important;
    line-height: 20px !important;
  }

  .hlpf__sort-label {
    font-size: 11px !important;
  }

  .hlpf__sort-badge {
    padding: 2px 5px !important;
    font-size: 8px !important;
  }
}

