/* =====================================================================
   หน้ารายละเอียดประกาศ (post.php + box_contactpost / box_socialshare / getpost_relate)
   ใช้ตัวแปรสีจาก css/theme.css (--tt-brand ...) และ css/postcard.css (--tt-ink, --tt-line ...)
   ===================================================================== */
.pp-page { padding: 12px 12px 8px; }

/* ---------- breadcrumb ---------- */
.pp-crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0 0 10px;
  padding: 0;
  font-size: .85rem;
}
.pp-crumbs li { display: inline-flex; align-items: center; gap: 6px; color: var(--tt-muted); }
.pp-crumbs li > i { font-size: .55rem; color: #9ca3af; }
.pp-crumbs a { color: var(--tt-muted); text-decoration: none; }
.pp-crumbs a:hover { color: var(--tt-brand); text-decoration: underline; }
.pp-crumbs li:last-child a { color: var(--tt-ink); font-weight: 600; }

/* ---------- layout: เนื้อหา | sidebar ---------- */
.pp-layout { display: flex; flex-direction: column; gap: 16px; }
.pp-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.pp-side { min-width: 0; }

.pp-card {
  background: #fff;
  border: 1px solid var(--tt-line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}

/* ---------- gallery ---------- */
.pp-gallery {
  background: #fff;
  border: 1px solid var(--tt-line);
  border-radius: 16px;
  overflow: hidden;
}
.pp-gallery__main {
  position: relative;
  height: 460px;
  background: #1f2937;
  cursor: zoom-in;
  overflow: hidden;
  outline: none;
}
.pp-gallery__main:focus-visible { box-shadow: inset 0 0 0 3px var(--tt-olive); }
.pp-gallery__blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(25px) brightness(.7);
  transform: scale(1.15);
}
.pp-gallery__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pp-gallery__badges {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pp-gallery__badges .badge { margin: 0 !important; font-size: .8rem; padding: .45em .75em; }
.tt-badge-vip.tt-badge-vip--inline { position: static; font-size: .75rem; padding: 4px 9px; }

.pp-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px; height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.pp-gallery__nav:hover { background: rgba(0, 0, 0, .72); }
.pp-gallery__nav--prev { left: 12px; }
.pp-gallery__nav--next { right: 12px; }
.pp-gallery__count {
  position: absolute;
  right: 10px; bottom: 10px;
  z-index: 3;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: .8rem;
}
.pp-gallery__zoom {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  opacity: 0;
  transition: opacity .2s;
}
.pp-gallery__main:hover .pp-gallery__zoom { opacity: 1; }
@media (hover: none) { .pp-gallery__zoom { display: none; } }

.pp-gallery__strip {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.pp-gallery__thumb {
  flex: 0 0 auto;
  width: 84px; height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tt-soft);
  opacity: .7;
  transition: opacity .2s, border-color .2s;
}
.pp-gallery__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pp-gallery__thumb:hover { opacity: 1; }
.pp-gallery__thumb.is-active { border-color: var(--tt-brand); opacity: 1; }

/* ---------- หัวข้อ / ราคา / ข้อมูลหลัก ---------- */
.pp-title {
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--tt-ink);
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.pp-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--tt-muted); }
.pp-meta i { color: var(--tt-brand-600); margin-right: 2px; }

.pp-price { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--tt-line); }
.pp-price__label { font-size: .8rem; color: var(--tt-muted); }
.pp-price__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.pp-price__value {
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}
.pp-price__value.text-dark { color: var(--tt-brand) !important; } /* ราคาขายใช้สีแบรนด์ (ขายฝาก/เช่า คงสีเดิม) */
.pp-price__ask { font-size: 1rem; color: var(--tt-muted); padding: 4px 0; }
.pp-price .tt-ppu { font-size: .85rem; padding: 2px 10px; }

.pp-specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.pp-spec {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--tt-soft);
  border-radius: 12px;
}
.pp-spec > i {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--tt-brand-50);
  color: var(--tt-brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pp-spec small { display: block; font-size: .72rem; color: var(--tt-muted); }
.pp-spec b { display: block; font-size: .92rem; font-weight: 700; color: var(--tt-ink); line-height: 1.35; overflow-wrap: anywhere; }

.pp-mapbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 16px;
  border: 1.5px solid var(--tt-brand);
  border-radius: 10px;
  color: var(--tt-brand);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.pp-mapbtn:hover { background: var(--tt-brand); color: #fff; }
.pp-mapbtn__ext { font-size: .7rem; opacity: .7; }

/* ---------- แชร์ ---------- */
.pp-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-share__label { font-size: .85rem; color: var(--tt-muted); margin-right: 2px; }
.pp-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--tt-line);
  border-radius: 999px;
  background: #fff;
  color: var(--tt-ink);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter .2s, background .2s, border-color .2s, color .2s;
}
.pp-share__btn:hover { border-color: var(--tt-brand-100); background: var(--tt-brand-50); color: var(--tt-brand); }
.pp-share__btn[hidden] { display: none; }
.pp-share__btn--line,
.pp-share__btn--fb,
.pp-share__btn--x { color: #fff; }
.pp-share__btn--line { background: #06c755; border-color: #06c755; }
.pp-share__btn--fb   { background: #1877f2; border-color: #1877f2; }
.pp-share__btn--x    { background: #111; border-color: #111; padding: 0 13px; }
.pp-share__btn--line:hover,
.pp-share__btn--fb:hover,
.pp-share__btn--x:hover { color: #fff; filter: brightness(.92); }
.pp-share__btn--line:hover { background: #06c755; border-color: #06c755; }
.pp-share__btn--fb:hover   { background: #1877f2; border-color: #1877f2; }
.pp-share__btn--x:hover    { background: #111; border-color: #111; }

/* ---------- รายละเอียด ---------- */
.pp-h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tt-ink);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tt-line);
}
.pp-desc__body { font-size: 1rem; line-height: 1.85; color: #374151; overflow-wrap: anywhere; }
.pp-desc__body.is-collapsed {
  max-height: 520px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 75%, transparent);
          mask-image: linear-gradient(#000 75%, transparent);
}
.pp-desc__more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--tt-line);
  border-radius: 10px;
  background: #fff;
  color: var(--tt-brand);
  font-weight: 700;
}
.pp-desc__more[hidden] { display: none; }
.pp-tel { color: var(--tt-brand-600); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }

/* ---------- ปุ่มติดต่อ (ใช้ทั้งกล่องผู้ขายและแถบล่างจอ) ---------- */
.pp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: filter .2s, background .2s, border-color .2s, color .2s;
}
.pp-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-btn--call { background: var(--tt-accent-grad); color: #1c1c1c; box-shadow: 0 4px 12px rgba(243, 115, 53, .28); }
.pp-btn--call:hover { color: #1c1c1c; filter: brightness(1.05); }
.pp-btn--line { background: #06c755; color: #fff; }
.pp-btn--line:hover { color: #fff; filter: brightness(.94); }
.pp-btn--ghost { background: #fff; border-color: var(--tt-line); color: var(--tt-ink); font-weight: 600; font-size: .88rem; }
.pp-btn--ghost:hover { border-color: var(--tt-brand-100); background: var(--tt-brand-50); color: var(--tt-brand); }

/* ---------- กล่องผู้ลงประกาศ ---------- */
.pp-seller { padding: 0; overflow: hidden; margin-bottom: 16px; }
.pp-seller__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--tt-brand) 0%, var(--tt-brand-600) 100%);
  color: #fff;
}
.pp-seller__avatar img {
  display: block;
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, .85);
  background: #fff;
}
.pp-seller__who { min-width: 0; }
.pp-seller__label,
.pp-seller__since { font-size: .74rem; color: rgba(255, 255, 255, .75); }
.pp-seller__name {
  display: block;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-seller__name:hover { color: #fff; text-decoration: underline; }
.pp-seller__actions { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.pp-seller__note { font-size: .78rem; color: var(--tt-muted); line-height: 1.5; }
.pp-seller__social { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px; font-size: .85rem; color: var(--tt-ink); }
.pp-seller__social i { width: 18px; text-align: center; color: var(--tt-brand-600); }
.pp-seller__social span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-seller__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--tt-line);
  font-size: .88rem;
  font-weight: 600;
  color: var(--tt-brand);
  text-decoration: none;
}
.pp-seller__all:hover { background: var(--tt-brand-50); color: var(--tt-brand); }

/* ---------- ประกาศใกล้เคียง ---------- */
.pp-related { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--tt-line); }
.pp-related__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 12px;
}
.pp-related__title { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--tt-ink); }
.pp-related__title span { color: var(--tt-muted); font-weight: 600; }
.pp-related__more { white-space: nowrap; font-size: .9rem; font-weight: 600; color: var(--tt-brand-600); text-decoration: none; }
.pp-related__more:hover { color: var(--tt-brand); text-decoration: underline; }

/* ---------- ดูรูปเต็มจอ ---------- */
.pp-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1060;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .92);
}
.pp-lightbox.is-open { display: flex; }
.pp-lb__wrap { display: flex; align-items: center; justify-content: center; max-width: 92vw; max-height: 88vh; }
.pp-lb__wrap img { display: block; max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 4px; user-select: none; }
.pp-lb__btn {
  position: fixed;
  z-index: 2;
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.pp-lb__btn:hover { background: rgba(255, 255, 255, .3); }
.pp-lb__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.pp-lb__next { right: 16px; top: 50%; transform: translateY(-50%); }
.pp-lb__close { top: 16px; right: 16px; }
.pp-lb__count {
  position: fixed;
  top: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: .9rem;
}

/* ---------- toast "คัดลอกแล้ว" ---------- */
.pp-toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 1070;
  transform: translate(-50%, 20px);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.pp-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- แถบติดต่อล่างจอ: มือถือเท่านั้น ---------- */
.pp-contactbar { display: none; }

/* ===================== คอม / แท็บเล็ต ===================== */
@media (min-width: 768px) {
  .pp-page { padding: 16px 24px 8px; }
  .pp-layout { flex-direction: row; align-items: stretch; gap: 24px; }
  .pp-main { flex: 1 1 auto; }
  .pp-side { flex: 0 0 300px; }
  .pp-side__sticky { position: sticky; top: 12px; }
}
@media (min-width: 1200px) {
  .pp-side { flex-basis: 320px; }
}

/* ===================== มือถือ ===================== */
@media (max-width: 767px) {
  .pp-crumbs ol { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .pp-crumbs ol::-webkit-scrollbar { display: none; }
  .pp-card { padding: 14px; border-radius: 14px; }
  .pp-gallery { border-radius: 14px; }
  .pp-gallery__main { height: 280px; }
  .pp-gallery__nav { width: 34px; height: 34px; }
  .pp-gallery__thumb { width: 64px; height: 48px; }
  .pp-title { font-size: 1.15rem; }
  .pp-price__value { font-size: 1.6rem; }
  .pp-specs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pp-spec { padding: 8px 10px; gap: 8px; }
  .pp-spec > i { flex-basis: 30px; height: 30px; border-radius: 8px; font-size: .85rem; }
  .pp-share__label,
  .pp-share__txt { display: none; }
  .pp-related__title { font-size: 1.05rem; }
  .pp-lb__btn { width: 40px; height: 40px; font-size: 16px; }
  .pp-lb__prev { left: 8px; }
  .pp-lb__next { right: 8px; }

  .pp-contactbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 18; /* ใต้ header (19) / เมนู (20) / lightbox */
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--tt-line);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
  }
  .pp-contactbar__price { flex: 1; min-width: 0; line-height: 1.25; }
  .pp-contactbar__price b,
  .pp-contactbar__price small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pp-contactbar__price b { font-size: 1.05rem; color: var(--tt-brand); }
  .pp-contactbar__price small { font-size: .72rem; color: var(--tt-muted); }
  .pp-contactbar .pp-btn { flex: 0 0 auto; min-width: 88px; }
  body.pp-has-bar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.pp-has-bar .pp-toast { bottom: 84px; }
}
