/* ============================================================
   TrustPosts Widget — Frontend CSS
   Scoped to .elementor-widget-trustposts via {{WRAPPER}} in controls.
   No side-effects on other elements.
   ============================================================ */

/* ── Reset / Base ───────────────────────────────────────────── */
.tp-posts-wrapper * {
  box-sizing: border-box;
}
.tp-posts-wrapper a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

/* ── Grid ───────────────────────────────────────────────────── */
.tp-posts-grid {
  display: grid;
  grid-template-columns: repeat(var(--tp-cols, 3), 1fr);
  gap: 20px;
}
@media (max-width: 1024px) {
  .tp-posts-grid {
    grid-template-columns: repeat(var(--tp-cols-t, 2), 1fr);
  }
}
@media (max-width: 767px) {
  .tp-posts-grid {
    grid-template-columns: repeat(var(--tp-cols-m, 1), 1fr);
  }
}


/* ── Thumbnail Position — Desktop (class tĩnh từ PHP) ──────── */
.tp-post-item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tp-post-item.tp-thumb-top,
.tp-post-item.tp-thumb-bottom { flex-direction: column; }

.tp-post-item.tp-thumb-left  { flex-direction: row;         align-items: flex-start; }
.tp-post-item.tp-thumb-right { flex-direction: row-reverse; align-items: flex-start; }

/* Thumbnail width cố định khi left/right */
.tp-post-item.tp-thumb-left  .tp-post-thumbnail,
.tp-post-item.tp-thumb-right .tp-post-thumbnail {
  flex: 0 0 var(--tp-thumb-side-width, 200px);
  width: var(--tp-thumb-side-width, 200px);
  height: auto;
}
.tp-post-item.tp-thumb-left  .tp-post-thumbnail img,
.tp-post-item.tp-thumb-right .tp-post-thumbnail img {
  height: 100%;
  object-fit: cover;
}
.tp-post-item.tp-thumb-left  .tp-post-body,
.tp-post-item.tp-thumb-right .tp-post-body {
  flex: 1 1 0;
  min-width: 0;
}

/* ── Thumbnail Position — Tablet override ───────────────────── */
@media (max-width: 1024px) {
  .tp-post-item.tp-thumb-tablet-top,
  .tp-post-item.tp-thumb-tablet-bottom { flex-direction: column !important; }

  .tp-post-item.tp-thumb-tablet-left  { flex-direction: row         !important; align-items: flex-start; }
  .tp-post-item.tp-thumb-tablet-right { flex-direction: row-reverse !important; align-items: flex-start; }

  .tp-post-item.tp-thumb-tablet-left  .tp-post-thumbnail,
  .tp-post-item.tp-thumb-tablet-right .tp-post-thumbnail {
    flex: 0 0 var(--tp-thumb-side-width, 180px);
    width: var(--tp-thumb-side-width, 180px);
    height: auto;
  }
  .tp-post-item.tp-thumb-tablet-left  .tp-post-thumbnail img,
  .tp-post-item.tp-thumb-tablet-right .tp-post-thumbnail img {
    height: 100%;
    object-fit: cover;
  }
  .tp-post-item.tp-thumb-tablet-left  .tp-post-body,
  .tp-post-item.tp-thumb-tablet-right .tp-post-body {
    flex: 1 1 0;
    min-width: 0;
  }

  /* Reset thumbnail height về auto khi tablet chuyển về top/bottom */
  .tp-post-item.tp-thumb-tablet-top  .tp-post-thumbnail,
  .tp-post-item.tp-thumb-tablet-bottom .tp-post-thumbnail {
    flex: none;
    width: 100%;
    height: 220px;
  }
}

/* ── Thumbnail Position — Mobile override ───────────────────── */
@media (max-width: 767px) {
  .tp-post-item.tp-thumb-mobile-top,
  .tp-post-item.tp-thumb-mobile-bottom { flex-direction: column !important; }

  .tp-post-item.tp-thumb-mobile-left  { flex-direction: row         !important; align-items: flex-start; }
  .tp-post-item.tp-thumb-mobile-right { flex-direction: row-reverse !important; align-items: flex-start; }

  .tp-post-item.tp-thumb-mobile-left  .tp-post-thumbnail,
  .tp-post-item.tp-thumb-mobile-right .tp-post-thumbnail {
    flex: 0 0 var(--tp-thumb-side-width, 120px);
    width: var(--tp-thumb-side-width, 120px);
    height: auto;
  }
  .tp-post-item.tp-thumb-mobile-left  .tp-post-thumbnail img,
  .tp-post-item.tp-thumb-mobile-right .tp-post-thumbnail img {
    height: 100%;
    object-fit: cover;
  }
  .tp-post-item.tp-thumb-mobile-left  .tp-post-body,
  .tp-post-item.tp-thumb-mobile-right .tp-post-body {
    flex: 1 1 0;
    min-width: 0;
  }

  /* Reset thumbnail khi mobile chuyển về top/bottom */
  .tp-post-item.tp-thumb-mobile-top  .tp-post-thumbnail,
  .tp-post-item.tp-thumb-mobile-bottom .tp-post-thumbnail {
    flex: none;
    width: 100%;
    height: 220px;
  }
}

/* ── Masonry ────────────────────────────────────────────────── */
.tp-posts-masonry {
  columns: var(--tp-cols, 3);
  column-gap: 20px; /* override bởi column_gap control */
}
.tp-posts-masonry .tp-post-item {
  break-inside: avoid;
  margin-bottom: 20px; /* override bởi row_gap control */
  display: block; /* CSS columns cần block, không dùng flex */
}
.tp-posts-masonry .tp-post-item .tp-post-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 1024px) {
  .tp-posts-masonry { columns: var(--tp-cols-t, 2); }
}
@media (max-width: 767px) {
  .tp-posts-masonry { columns: var(--tp-cols-m, 1); }
}

/* ── List ───────────────────────────────────────────────────── */
.tp-posts-list {
  display: flex;
  flex-direction: column;
  /* gap được control bởi row_gap selector (.tp-post-item + .tp-post-item) */
}
.tp-posts-list .tp-post-item {
  width: 100%;
}
/* List: thumbnail left/right → flex-direction: row, thumbnail có min-height */
.tp-posts-list .tp-post-item.tp-thumb-left,
.tp-posts-list .tp-post-item.tp-thumb-right {
  align-items: stretch;
}
.tp-posts-list .tp-post-item.tp-thumb-left  .tp-post-thumbnail,
.tp-posts-list .tp-post-item.tp-thumb-right .tp-post-thumbnail {
  flex-shrink: 0;
  height: auto;
  align-self: stretch;
}
.tp-posts-list .tp-post-item.tp-thumb-left  .tp-post-thumbnail img,
.tp-posts-list .tp-post-item.tp-thumb-right .tp-post-thumbnail img {
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  width: 100%;
}
/* Cần position relative trên thumbnail khi list left/right */
.tp-posts-list .tp-post-item.tp-thumb-left  .tp-post-thumbnail,
.tp-posts-list .tp-post-item.tp-thumb-right .tp-post-thumbnail {
  position: relative;
}
/* Trên mobile: list tự stack dọc nếu không có class override */
@media (max-width: 767px) {
  .tp-posts-list .tp-post-item:not(.tp-thumb-mobile-left):not(.tp-thumb-mobile-right) {
    flex-direction: column;
  }
  .tp-posts-list .tp-post-item:not(.tp-thumb-mobile-left):not(.tp-thumb-mobile-right) .tp-post-thumbnail {
    height: 220px;
  }
}

/* ── Carousel ───────────────────────────────────────────────── */
.tp-posts-carousel {
  position: relative;
  --tp-gap: 20px;       /* override bởi column_gap control */
  --tp-nav-left: 12px;
  --tp-nav-right: 12px;
  --tp-cols-current: var(--tp-cols, 3);
  --tp-scroll-current: var(--tp-scroll, 1);
  --tp-transition-ms: 500ms;
}
@media (max-width: 1024px) {
  .tp-posts-carousel {
    --tp-cols-current: var(--tp-cols-t, 2);
    --tp-scroll-current: var(--tp-scroll-t, 1);
  }
}
@media (max-width: 767px) {
  .tp-posts-carousel {
    --tp-cols-current: var(--tp-cols-m, 1);
    --tp-scroll-current: var(--tp-scroll-m, 1);
  }
}

/* Overflow: hidden chỉ áp vào clip wrapper — carousel container luôn visible
   để arrows ở top/bottom/outside không bị cắt */
.tp-posts-carousel {
  overflow: visible;
}
/* tp-swiper-clip: bọc track để clip items tràn ra khi slide */
.tp-swiper-clip {
  overflow: hidden;
  position: relative;
  width: 100%;
  touch-action: pan-y;
  cursor: grab;
}
.tp-swiper-clip.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.tp-swiper-clip.is-dragging .tp-post-item {
  pointer-events: none;
}
/* middle position: carousel vẫn cần clip track — không ảnh hưởng vì clip wrapper đã handle */

.tp-swiper-track {
  display: flex;
  gap: var(--tp-gap);
  transform: translate3d(0, 0, 0);
  transition: transform var(--tp-transition-ms, 500ms) cubic-bezier(0.22, 0.61, 0.36, 1);
}
.tp-posts-carousel.is-ready .tp-swiper-track {
  backface-visibility: hidden;
}
.tp-carousel-clone {
  flex-shrink: 0;
}

/* Carousel item width — tính đúng khi có gap */
.tp-swiper-track .tp-post-item {
  flex: 0 0 calc(
    (100% - var(--tp-gap) * (var(--tp-cols-current, 3) - 1)) / var(--tp-cols-current, 3)
  );
  min-width: 0;
}

/* ── Navigation Arrows — base ───────────────────────────────── */
.tp-carousel-prev,
.tp-carousel-next {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: 10;
  /* default colors — override bởi Elementor controls */
  background-color: rgba(0, 0, 0, 0.45);
  color: #fff;
  transition: background-color 0.22s ease, opacity 0.22s ease,
              transform 0.22s ease, box-shadow 0.22s ease;
  /* Không để lại outline xấu */
  outline: none;
}
.tp-carousel-prev:focus-visible,
.tp-carousel-next:focus-visible {
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.6);
}
.tp-carousel-prev svg,
.tp-carousel-next svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  /* stroke/fill override bởi Elementor controls */
  stroke: currentColor;
  fill: none;
  pointer-events: none;
}
/* Base hover: chỉ đổi màu — transform được override riêng theo từng position */
.tp-carousel-prev:hover,
.tp-carousel-next:hover {
  background-color: rgba(0, 0, 0, 0.85);
}
.tp-carousel-prev:disabled,
.tp-carousel-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Arrow Position: middle (default — overlay giữa carousel) ── */
.tp-carousel-prev.tp-nav-pos-middle,
.tp-carousel-next.tp-nav-pos-middle {
  top: 50%;
  transform: translateY(-50%);
}
.tp-carousel-prev.tp-nav-pos-middle:hover,
.tp-carousel-next.tp-nav-pos-middle:hover {
  transform: translateY(-50%) scale(1.08);
}
.tp-carousel-prev.tp-nav-pos-middle:disabled,
.tp-carousel-next.tp-nav-pos-middle:disabled {
  transform: translateY(-50%);
}
.tp-carousel-prev.tp-nav-pos-middle { left:  var(--tp-nav-left,  12px); }
.tp-carousel-next.tp-nav-pos-middle { right: var(--tp-nav-right, 12px); }

/* ── Arrow Position: top-right ──────────────────────────────── */
/*
 * Arrows nằm trên carousel — carousel cần overflow: visible (class tp-nav-top từ PHP).
 * Cần padding-top để tạo không gian tránh bị che bởi nội dung phía trên.
 */
.tp-posts-carousel.tp-nav-top {
  padding-top: 60px;
}
.tp-carousel-prev.tp-nav-pos-top,
.tp-carousel-next.tp-nav-pos-top {
  top: 0;
  bottom: auto;
  transform: none;
}
.tp-carousel-prev.tp-nav-pos-top:hover,
.tp-carousel-next.tp-nav-pos-top:hover {
  transform: scale(1.08);
}
.tp-carousel-prev.tp-nav-pos-top:disabled,
.tp-carousel-next.tp-nav-pos-top:disabled {
  transform: none;
}
/* Prev nằm cách Next một khoảng, cả hai góc trên phải */
.tp-carousel-prev.tp-nav-pos-top { right: 52px; left: auto; }
.tp-carousel-next.tp-nav-pos-top { right: 0;    left: auto; }

/* ── Arrow Position: bottom-center ─────────────────────────── */
/*
 * Arrows nằm dưới carousel — carousel cần overflow: visible (class tp-nav-bottom từ PHP).
 * Dùng class tp-nav-bottom (từ PHP) thay vì :has() để tránh compat issue.
 */
.tp-posts-carousel.tp-nav-bottom {
  padding-bottom: 60px;
}
.tp-carousel-prev.tp-nav-pos-bottom,
.tp-carousel-next.tp-nav-pos-bottom {
  top: auto;
  bottom: 0;
}
/* hover/disabled override riêng theo từng button bên dưới */
.tp-carousel-prev.tp-nav-pos-bottom {
  left: 50%;
  transform: translateX(-100%) translateX(-6px);
}
.tp-carousel-next.tp-nav-pos-bottom {
  left: 50%;
  transform: translateX(6px);
}
.tp-carousel-prev.tp-nav-pos-bottom:hover {
  transform: translateX(-100%) translateX(-6px) scale(1.08);
}
.tp-carousel-next.tp-nav-pos-bottom:hover {
  transform: translateX(6px) scale(1.08);
}
.tp-carousel-prev.tp-nav-pos-bottom:disabled {
  transform: translateX(-100%) translateX(-6px);
}
.tp-carousel-next.tp-nav-pos-bottom:disabled {
  transform: translateX(6px);
}

/* ── Arrow Position: outside ────────────────────────────────── */
/*
 * Arrows nằm ngoài carousel trái/phải.
 * overflow: visible được set bởi class tp-nav-outside (từ PHP) trên carousel.
 */
.tp-carousel-prev.tp-nav-pos-outside,
.tp-carousel-next.tp-nav-pos-outside {
  top: 50%;
  transform: translateY(-50%);
}
.tp-carousel-prev.tp-nav-pos-outside:hover,
.tp-carousel-next.tp-nav-pos-outside:hover {
  transform: translateY(-50%) scale(1.08);
}
.tp-carousel-prev.tp-nav-pos-outside:disabled,
.tp-carousel-next.tp-nav-pos-outside:disabled {
  transform: translateY(-50%);
}
.tp-carousel-prev.tp-nav-pos-outside { left:  -54px; }
.tp-carousel-next.tp-nav-pos-outside { right: -54px; }

/* Mobile: arrows outside → thu vào trong để tránh bị clip */
@media (max-width: 767px) {
  .tp-carousel-prev.tp-nav-pos-outside { left:  4px; }
  .tp-carousel-next.tp-nav-pos-outside { right: 4px; }
  .tp-carousel-prev.tp-nav-pos-top,
  .tp-carousel-next.tp-nav-pos-top {
    top: 0;
  }
  .tp-carousel-prev,
  .tp-carousel-next {
    width: 34px;
    height: 34px;
  }
  .tp-carousel-prev svg,
  .tp-carousel-next svg {
    width: 13px;
    height: 13px;
  }
}

/* ── Arrow Visibility: hover-show (desktop only) ─────────── */
/*
 * .tp-nav-hover arrows bắt đầu ẩn và không chặn click nội dung phía dưới.
 * JS giữ class .is-hovered trong một khoảng ngắn khi chuột rời carousel,
 * đủ để user di chuyển tới arrow outside/top/bottom mà không bị flicker.
 */
.tp-nav-hover .tp-carousel-prev,
.tp-nav-hover .tp-carousel-next {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease,
              background-color 0.22s ease, transform 0.22s ease;
}
/* Hiện khi JS add .is-hovered (áp dụng tất cả positions) */
.tp-nav-hover.is-hovered .tp-carousel-prev,
.tp-nav-hover.is-hovered .tp-carousel-next {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* Mobile: luôn hiển thị kể cả khi hover-show */
@media (max-width: 767px) {
  .tp-nav-hover .tp-carousel-prev,
  .tp-nav-hover .tp-carousel-next {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* ── Dots — base ────────────────────────────────────────────── */
.tp-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
.tp-carousel-dots .tp-dot {
  --tp-dot-size: 8px;
  --tp-dot-active-w: 24px;
  display: block;
  width: var(--tp-dot-size);
  height: var(--tp-dot-size);
  border-radius: 50%;
  background-color: #ccc;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.22s ease, width 0.28s ease,
              border-radius 0.28s ease, opacity 0.22s ease;
  outline: none;
}
.tp-carousel-dots .tp-dot:focus-visible {
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.55);
}
.tp-carousel-dots .tp-dot:hover {
  opacity: 0.75;
}
.tp-carousel-dots .tp-dot.is-active {
  background-color: #222;
}

/* ── Dot Style: circle (default) ────────────────────────────── */
.tp-dots-circle .tp-dot         { border-radius: 50%; }
.tp-dots-circle .tp-dot.is-active { border-radius: 50%; }

/* ── Dot Style: square ──────────────────────────────────────── */
.tp-dots-square .tp-dot         { border-radius: 2px; }
.tp-dots-square .tp-dot.is-active { border-radius: 2px; }

/* ── Dot Style: line ────────────────────────────────────────── */
.tp-dots-line .tp-dot {
  border-radius: 999px;
  height: calc(var(--tp-dot-size) * 0.4);
  min-height: 3px;
}
.tp-dots-line .tp-dot.is-active {
  width: var(--tp-dot-active-w, 24px);
  border-radius: 999px;
}

/* ── Dot Style: line-fat ────────────────────────────────────── */
.tp-dots-line-fat .tp-dot {
  border-radius: 999px;
  height: calc(var(--tp-dot-size) * 0.6);
  min-height: 4px;
}
.tp-dots-line-fat .tp-dot.is-active {
  width: var(--tp-dot-active-w, 24px);
  border-radius: 999px;
}

/* Mobile: dots nhỏ lại */
@media (max-width: 767px) {
  .tp-carousel-dots .tp-dot {
    --tp-dot-size: 7px;
  }
}


.tp-loading-text {
  display: inline-block;
  color: #777;
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .tp-swiper-track,
  .tp-carousel-prev,
  .tp-carousel-next,
  .tp-carousel-dots .tp-dot {
    transition-duration: 0.01ms !important;
  }
}

.tp-post-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Thumbnail ──────────────────────────────────────────────── */
.tp-post-thumbnail {
  position: relative;
  overflow: hidden;
  height: 220px;
}
.tp-post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease, filter 0.4s ease;
}
/* Hover overlay */
.tp-post-thumbnail::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tp-post-item:hover .tp-post-thumbnail::after { opacity: 1; }

/* Hover effects — class nằm trên .tp-post-thumbnail */
.tp-post-item:hover .tp-img-hover-zoom img {
  transform: scale(1.07);
}
.tp-post-item:hover .tp-img-hover-zoom_out img {
  transform: scale(0.95);
}
.tp-post-item:hover .tp-img-hover-blur img {
  filter: blur(3px);
}

/* ── Category Badge ─────────────────────────────────────────── */
.tp-post-category {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tp-post-category a {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: #eee;
  color: #555;
  padding: 3px 9px;
  border-radius: 3px;
  transition: background .2s, color .2s;
}
.tp-post-category a:hover {
  background: #333;
  color: #fff;
}

/* ── Title ──────────────────────────────────────────────────── */
.tp-post-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}
.tp-post-title a { display: block; }

/* ── Meta ───────────────────────────────────────────────────── */
.tp-post-meta {
  font-size: 0.8rem;
  color: #888;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.tp-post-meta a { color: inherit; }
.tp-post-meta a:hover { color: #333; }
.tp-meta-sep { color: #ccc; }

/* ── Excerpt ────────────────────────────────────────────────── */
.tp-post-excerpt {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* ── Read More ──────────────────────────────────────────────── */
.tp-read-more {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 18px;
  background: #222;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: 4px;
  border: 2px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
  align-self: flex-start;
}
.tp-read-more:hover {
  background: transparent;
  color: #222;
  border-color: #222;
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.tp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}
.tp-filter-btn {
  padding: 7px 18px;
  border: 2px solid #ddd;
  background: transparent;
  cursor: pointer;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background .2s, color .2s, border-color .2s;
}
.tp-filter-btn:hover,
.tp-filter-btn.is-active {
  background: #222;
  color: #fff;
  border-color: #222;
}

/* ── Load More ──────────────────────────────────────────────── */
.tp-pagination {
  margin-top: 30px;
  text-align: center;
}
.tp-load-more-wrap {
  display: flex;
  justify-content: center;
}
.tp-load-more {
  display: inline-block;
  padding: 12px 32px;
  background: #222;
  color: #fff;
  border: 2px solid transparent;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.tp-load-more:hover {
  background: transparent;
  color: #222;
  border-color: #222;
}
.tp-load-more.is-loading {
  opacity: .7;
  cursor: not-allowed;
}

/* ── Infinite scroll sentinel ───────────────────────────────── */
.tp-infinite-trigger {
  height: 2px;
  pointer-events: none;
}

/* ── Number pagination ──────────────────────────────────────── */
.tp-pagination-numbers {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.tp-pagination-numbers a,
.tp-pagination-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  text-decoration: none;
  color: #333;
  transition: background .2s, color .2s;
}
.tp-pagination-numbers .current {
  background: #222;
  color: #fff;
  border-color: #222;
}
.tp-pagination-numbers a:hover {
  background: #f5f5f5;
}

/* ── Skeleton loading ───────────────────────────────────────── */
@keyframes tp-shimmer {
  0%   { background-position: -700px 0; }
  100% { background-position: 700px 0; }
}
.tp-posts-container.is-loading .tp-post-item {
  pointer-events: none;
}
.tp-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 700px 100%;
  animation: tp-shimmer 1.4s infinite linear;
  border-radius: 4px;
  height: 16px;
  margin-bottom: 8px;
}


/* ── AJAX status / accessibility ───────────────────────────── */
.tp-posts-status {
  margin-top: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  font-weight: 600;
}
.tp-posts-status[hidden] { display: none !important; }
.tp-posts-status.is-error { text-decoration: none; }

/* ── No posts ───────────────────────────────────────────────── */
.tp-no-posts {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  padding: 40px;
}

/* ── Mobile Improvements ────────────────────────────────────── */
@media (max-width: 767px) {
  /* Filter bar: scroll ngang trên mobile thay vì wrap xấu */
  .tp-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px; /* space cho scrollbar */
    /* Ẩn scrollbar nhưng vẫn scroll được */
    scrollbar-width: none;
  }
  .tp-filter-bar::-webkit-scrollbar { display: none; }
  .tp-filter-btn {
    scroll-snap-align: start;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Pagination numbers: scroll ngang nếu nhiều trang */
  .tp-pagination-numbers {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .tp-pagination-numbers::-webkit-scrollbar { display: none; }

  /* Carousel nav buttons nhỏ hơn trên mobile */
  .tp-carousel-prev,
  .tp-carousel-next {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  /* Read more button full width trên mobile (optional, không bắt buộc) */
  /* .tp-read-more { display: block; text-align: center; } */

  /* Post body padding nhỏ hơn */
  .tp-post-body {
    gap: 6px;
  }

  /* Category badge nhỏ hơn */
  .tp-post-category a {
    font-size: 10px;
    padding: 2px 7px;
  }
}

/* ── Thumbnail width % fix khi list left/right dùng % ──────── */
.tp-post-item.tp-thumb-left  .tp-post-thumbnail,
.tp-post-item.tp-thumb-right .tp-post-thumbnail {
  flex-shrink: 0;
}
/* Khi dùng %, thumbnail cần min-width để không collapse */

/* ── Editor only: live preview hint ────────────────────────── */
.elementor-editor-active .tp-posts-wrapper {
  min-height: 100px;
}
