/* =====================================================================
   Post card / listing grid / result toolbar (หน้า browse + การ์ดทุกแบบใน post_card.php)
   ===================================================================== */
:root {
  --tt-ink: #1f2937;
  --tt-muted: #6b7280;
  --tt-line: #e5e7eb;
  --tt-soft: #f5f6f8;
  --tt-gold: #c9971c;  /* --tt-brand มาจาก css/theme.css */
  --tt-gold-soft: #fff7e0;
  --tt-radius: 12px;
}

/* ---------- grid ---------- */
.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  max-width: 1320px;
  margin: 12px auto 8px;
  padding: 0 12px;
}
.tt-grid > .tt-empty { grid-column: 1 / -1; }

/* ---------- card ---------- */
.tt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--tt-line);
  border-radius: var(--tt-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  transition: box-shadow .18s ease, transform .18s ease;
}
.tt-card:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
  transform: translateY(-2px);
}
.tt-card--vip {
  border-color: var(--tt-gold);
  box-shadow: 0 0 0 1px var(--tt-gold), 0 1px 3px rgba(15, 23, 42, .06);
}
.tt-card--vip:hover { box-shadow: 0 0 0 1px var(--tt-gold), 0 10px 24px rgba(15, 23, 42, .12); }

.tt-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--tt-soft);
  overflow: hidden;
}
.tt-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.tt-card:hover .tt-card__media img { transform: scale(1.03); }

.tt-card__tags {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 8px 4px;
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
  font-weight: 700;
}

.tt-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 10px;
  color: var(--tt-ink);
}
.tt-card__price {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  font-family: 'Noto Sans Thai', sans-serif;
}
.tt-card__noprice { font-size: .9rem; font-weight: 400; color: var(--tt-muted); }

.tt-ppu {
  display: inline-block;
  align-self: flex-start;
  font-size: .78rem;
  font-weight: 600;
  color: #0f766e;
  background: #ecfdf5;
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
}

.tt-card__title {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--tt-ink);
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em; /* จองไว้ 2 บรรทัด ให้การ์ดแถวเดียวกันสูงเท่ากัน */
}
.tt-card a:hover .tt-card__title { color: var(--tt-brand); text-decoration: underline; }

.tt-card__specs { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-card__specs span {
  font-size: .75rem;
  color: var(--tt-ink);
  background: var(--tt-soft);
  border: 1px solid var(--tt-line);
  border-radius: 999px;
  padding: 1px 8px;
}
.tt-card__specs i { color: var(--tt-brand-600); margin-right: 2px; }

.tt-card__loc {
  margin-top: auto;
  font-size: .8rem;
  color: var(--tt-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-card__loc i { color: var(--tt-brand-600); }

.tt-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--tt-line);
  background: #fafafa;
  font-size: .78rem;
  color: var(--tt-muted);
}
.tt-card__seller {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tt-muted);
}
.tt-card__seller:hover { color: var(--tt-brand); }
.tt-card__age { white-space: nowrap; }

/* ---------- PREMIUM badge (ใช้ทุก layout แทนรูป img/premium.png) ---------- */
.tt-badge-vip {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #3b2a00;
  background: linear-gradient(135deg, #ffe08a, #e0ab2a);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.tt-vip-ring { box-shadow: 0 0 0 2px var(--tt-gold), 7px 7px 14px #bdbdbd !important; }

/* ---------- toolbar + summary ---------- */
.tt-toolbar-wrap { max-width: 1320px; margin: 0 auto; width: 100%; }
.tt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 12px;
  padding: 4px 4px 4px 14px;
  background: var(--tt-soft);
  border-radius: var(--tt-radius);
}
.tt-toolbar__summary { min-width: 0; flex: 1; }
.tt-toolbar__summary .tt-summary { padding: 6px 0; }

.tt-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 14px 0;
  color: var(--tt-ink);
}
.tt-summary__count { font-size: 1rem; white-space: nowrap; }
.tt-summary__count b { color: var(--tt-brand); font-size: 1.1rem; }
.tt-summary__chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: .85rem;
  color: var(--tt-brand);
  background: var(--tt-brand-50);
  border: 1px solid var(--tt-brand-100);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.tt-chip .fa-times { font-size: .75rem; opacity: .7; }
.tt-chip:hover { background: var(--tt-brand-100); color: var(--tt-brand); }
.tt-chip:hover .fa-times { opacity: 1; }
.tt-chip--clear { background: transparent; border-color: transparent; color: var(--tt-muted); text-decoration: underline; }
.tt-chip--clear:hover { background: transparent; color: #b91c1c; }

/* ---------- empty state ---------- */
.tt-empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--tt-muted);
}
.tt-empty > i { font-size: 2.6rem; color: #cbd5e1; margin-bottom: 12px; }
.tt-empty__title { font-size: 1.15rem; font-weight: 700; color: var(--tt-ink); }
.tt-empty__hint { margin-top: 4px; }
