/* ════════════════════════════════
   detail.css — Product detail page
   ════════════════════════════════ */

/* Layer 0: พื้นหลังทั้งหน้า สีเข้ม — เห็นรอบ card */
#detailPage {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  visibility: hidden; pointer-events: none;
  opacity: 0; transform: translateX(30px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
  padding: 60px 14px 30px;
  box-sizing: border-box;
}
#detailPage.show {
  visibility: visible; pointer-events: auto;
  opacity: 1; transform: translateX(0);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear 0s;
}
#homePage { transition: opacity .2s ease; }

/* ── Layer 1: card กรอบโค้งครอบทุกอย่าง ── */
.detail-outer-card {
  background: var(--bg2);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  margin-bottom: 20px;
}

/* ลบ bg-layer ที่ไม่ใช้แล้ว */
.detail-bg-layer { display: none; }

/* Image fade */
#dMainImg img { transition: opacity .22s ease; }
#dMainImg img.fading { opacity: 0; }

/* ── Breadcrumb — อยู่บนสุดของ card ── */
.detail-crumb {
  font-size: .72rem; color: rgba(255,255,255,0.4);
  display: flex; align-items: center; gap: 5px;
  padding: 16px 18px 10px; flex-wrap: wrap;
}
.detail-crumb a {
  color: rgba(255,255,255,0.4); text-decoration: none;
  transition: color .15s;
}
.detail-crumb a:hover { color: var(--or); }

/* ── รูปภาพ ── */
.detail-img-wrap { padding: 0 16px; background: transparent; }
.detail-main-img {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border-radius: 16px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.detail-main-img img {
  width: 100%; height: auto;
  display: block; border-radius: 16px;
  object-fit: contain;
}
.detail-main-img svg { width: 72px; height: 72px; opacity: .15; }

/* ── Thumbnail strip ── */
.thumb-strip {
  display: flex; gap: 8px; padding: 10px 16px;
  overflow-x: auto; scrollbar-width: none; background: transparent;
}
.thumb {
  width: 62px; height: 46px; border-radius: 9px; overflow: hidden;
  border: 2px solid transparent; flex-shrink: 0; cursor: pointer;
  background: rgba(255,255,255,0.08); transition: border-color .18s;
  display: flex; align-items: center; justify-content: center;
}
.thumb.active { border-color: var(--or); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Share strip ── */
.share-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 18px 14px; background: transparent;
}
.share-row-label {
  font-size: .76rem; font-weight: 700;
  color: rgba(255,255,255,0.5);
  margin-right: 2px; white-space: nowrap;
}
.share-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
  transition: transform .15s, opacity .15s; flex-shrink: 0;
}
.share-btn:active { transform: scale(.9); opacity: .8; }
.share-btn.wa   { background: #25D366; }
.share-btn.msg  { background: linear-gradient(135deg,#0084FF,#A033FF); }
.share-btn.fb   { background: #1877F2; }
.share-btn.copy { background: rgba(255,255,255,0.12); }

/* ── เนื้อหา detail ── */
.detail-card {
  background: transparent;
  padding: 20px 18px 0;
}

.detail-id-badge { display: none; }
.detail-title { font-weight: 900; font-size: 1.3rem; color: #fff; margin-bottom: 6px; line-height: 1.3; }
.detail-meta  { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.dmeta {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,107,26,0.15); border-radius: 20px;
  padding: 5px 12px; font-size: .76rem; color: var(--or); font-weight: 600;
}

.detail-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 50px;
  font-size: .76rem; font-weight: 700; margin-bottom: 14px;
}
.detail-status-pill.avail { background: rgba(22,163,74,0.15); color: #4ade80; border: 1.5px solid rgba(22,163,74,0.35); }
.detail-status-pill.sold  { background: rgba(192,57,43,0.15); color: #f87171; border: 1.5px solid rgba(192,57,43,0.3); }

.detail-price-box {
  background: rgba(255,107,26,0.08); border: 1.5px solid rgba(255,107,26,0.25);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
}
.dp-lbl  { font-size: .72rem; color: rgba(255,255,255,0.45); margin-bottom: 4px; }
.dp-val  { font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 1.9rem; color: var(--or); line-height: 1; }
.dp-unit { font-size: .82rem; color: var(--orl); margin-left: 4px; font-weight: 600; }
.dp-old  { font-size: .76rem; color: rgba(255,255,255,0.3); text-decoration: line-through; margin-top: 3px; }

.detail-section-title {
  font-size: .74rem; font-weight: 700; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px; display: flex; align-items: center; gap: 5px;
}
.detail-table {
  background: rgba(255,255,255,0.05); border-radius: 12px;
  overflow: hidden; border: 1px solid rgba(255,255,255,0.08); margin-bottom: 14px;
}
.drow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; font-size: .82rem; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.drow:last-child { border-bottom: none; }
.drow .dk { color: rgba(255,255,255,0.45); }
.drow .dv { font-weight: 700; color: #fff; }

/* ── Footer ปุ่มซื้อ — อยู่ติดขอบล่าง card ── */
.detail-footer {
  padding: 12px 18px 20px;
  background: linear-gradient(to top, var(--bg2) 80%, transparent);
}
.buy-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; max-width: 540px; margin: 0 auto;
  background: linear-gradient(135deg, #25D366, #1EAD52);
  color: #fff; border: none; border-radius: 50px; padding: 15px 24px;
  font-size: 1rem; font-weight: 900; cursor: pointer;
  box-shadow: 0 5px 20px rgba(37,211,102,0.3);
  transition: transform .18s, box-shadow .18s; text-decoration: none;
}
.buy-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(37,211,102,0.4); }
.buy-btn.disabled {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.3);
  box-shadow: none; cursor: not-allowed;
}
.buy-btn.disabled:hover { transform: none; }

@media (min-width: 768px) {
  #detailPage { padding: 80px 24px 40px; }
  .detail-img-wrap { padding: 0 24px; }
  .detail-card     { padding: 22px 24px 0; }
}

/* ══════════════════════════════════
   Detail Header — แถบส้มด้านบน
══════════════════════════════════ */
.detail-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  background: linear-gradient(135deg, #E84F00, #FF7A2F);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  height: 58px;
  box-shadow: 0 2px 12px rgba(232,79,0,0.4);
}

/* โลโก้ — เหมือนหน้าโฮม: สี่เหลี่ยม */
.detail-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
}
.detail-header-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}
.detail-header-icon img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.detail-header-text {
  display: flex; flex-direction: column;
}
.detail-header-name {
  font-size: .88rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
}
.detail-header-sub {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: .05em;
}

/* ปุ่มติดต่อ — พื้นขาว, ไอคอนเขียว, ตัวหนังสือส้ม */
.detail-header-contact {
  background: #fff;
  border: none;
  border-radius: 30px;
  padding: 8px 18px;
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s;
}
.detail-header-contact svg { color: #16A34A; stroke: #16A34A; }
.detail-header-contact span { color: #E84F00; }
.detail-header-contact:hover { opacity: .85; }

/* ปรับ detailPage padding ให้เว้นที่ header */
#detailPage {
  padding-top: 74px !important;
}
