/* =============================================================================
   หน้าสินค้าที่ลูกค้าเห็นตอนสแกน QR (public/product.html) — แนวเดียวกับหน้าแรก (landing.css)
   โหลดหลัง <style> เดิมในหน้าและ ui-base.css จึงทับกฎเดิมได้
   ========================================================================== */
body {
  background: #f7f8fa !important;
  padding: 16px !important;
  color: #1d2128;
}
.container {
  max-width: 560px !important;
  padding: 0 0 8px !important;
  border-radius: 24px !important;
  border: 1px solid #e7e9ee;
  box-shadow: 0 18px 50px rgba(29, 33, 40, .08) !important;
  overflow: hidden;
}
.container h1, .container h3 { text-wrap: balance; }

/* หัว: บริษัทเจ้าของสินค้า */
.pp-brand {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  background: #fff8f0; border-bottom: 1px solid #fbe3c8;
}
.pp-brand-logo {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  background: #1d2128; color: #fff; font-weight: 800; font-size: 19px; overflow: hidden;
}
.pp-brand-logo.has-img { background: #fff; border: 1px solid #e7e9ee; }
.pp-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.pp-brand-logo svg { width: 22px; height: 22px; }
.pp-brand-text { flex: 1; min-width: 0; line-height: 1.3; }
.pp-brand-text b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.pp-brand-text small { display: block; font-size: 12.5px; color: #6b7280; }
.pp-verified {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  background: #e7f6ee; color: #15803d; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pp-verified svg { width: 14px; height: 14px; }
.pp-verified[hidden] { display: none; }

/* เนื้อหา */
.content-container, .skeleton-container { padding: 20px 20px 4px; }
#productImageContainer { margin-bottom: 18px !important; }
.product-image {
  max-height: 300px !important; border-radius: 18px !important; box-shadow: none !important;
  border: 1px solid #e7e9ee !important; background: #f7f8fa !important; padding: 10px; box-sizing: border-box;
}
.product-image:hover { transform: none !important; }

.pp-title { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.3; color: #1d2128; text-align: left; }
.pp-sn {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px;
  font-size: 13px; color: #6b7280;
}
.pp-sn span:first-child { padding: 1px 8px; border-radius: 6px; background: #f1f3f6; font-weight: 700; font-size: 11.5px; }
.pp-sn .value, #internalSerialNumber {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; color: #1d2128;
  max-width: none !important; text-align: left !important; margin: 0 !important;
}

/* แถบสถานะประกัน */
.pp-status {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; padding: 12px 14px;
  border-radius: 14px; font-weight: 700; font-size: 15px; line-height: 1.4;
}
.pp-status[hidden] { display: none; }
.pp-status svg { width: 22px; height: 22px; flex-shrink: 0; }
.pp-status.is-ok { background: #e7f6ee; color: #15803d; }
.pp-status.is-soon { background: #fff4e5; color: #b45309; }
.pp-status.is-exp { background: #fdecea; color: #b42318; }
.pp-status.is-none { background: #f1f3f6; color: #4b5260; font-weight: 600; }

/* วันที่ประกัน + ข้อมูลสินค้า */
.pp-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pp-tiles .info-row, .pp-meta .info-row {
  display: flex !important; flex-direction: column !important; align-items: flex-start !important;
  gap: 2px; padding: 10px 12px !important; margin: 0 !important; border: 0 !important;
  background: #f7f8fa; border-radius: 12px;
}
.pp-tile-wide { grid-column: 1 / -1; }
.pp-tiles .label, .pp-meta .label { font-size: 12px !important; color: #4b5260 !important; font-weight: 600 !important; }
.pp-tiles .value, .pp-meta .value {
  font-size: 15px !important; font-weight: 700 !important; color: #1d2128 !important;
  text-align: left !important; max-width: none !important; margin: 0 !important; font-style: normal !important;
}
.pp-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }

/* ปุ่มโทร */
.pp-support { margin-bottom: 14px; }
.pp-call {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid #d6dae1; color: #1d2128; text-decoration: none; font-weight: 700; font-size: 15px;
}
.pp-call:hover { border-color: #1d2128; }
.pp-call svg { width: 20px; height: 20px; color: #e8740c; }
.pp-call small { display: block; font-weight: 500; color: #6b7280; font-size: 13px; }

/* บริการหลังการขาย (กล่องเดิม) ให้เข้าชุด */
.service-box { border-radius: 18px !important; }
.service-box-btn { border-radius: 12px !important; }

/* หัวข้อส่วน */
.pp-h3 {
  display: flex; align-items: center; gap: 8px; margin: 26px 0 12px !important; padding: 0 !important;
  border: 0 !important; color: #1d2128 !important; font-size: 18px !important; font-weight: 800 !important; text-align: left !important;
}
.pp-h3 svg { width: 20px; height: 20px; color: #e8740c; }

/* เอกสาร PDF */
#pdfLinks { display: flex !important; flex-direction: column; gap: 8px !important; justify-content: stretch !important; }
.pdf-button {
  display: flex !important; align-items: center; gap: 12px; width: 100%; box-sizing: border-box;
  padding: 12px 14px !important; border-radius: 14px !important; background: #fff !important; color: #1d2128 !important;
  border: 1px solid #e7e9ee !important; box-shadow: none !important; text-decoration: none; font-weight: 400 !important;
}
.pdf-button:hover { border-color: #f5c999 !important; background: #fff8f0 !important; box-shadow: none !important; }
.pdf-button > svg:first-child { width: 22px; height: 22px; color: #e8740c; flex-shrink: 0; }
.pdf-text { flex: 1; min-width: 0; text-align: left; }
.pdf-text b { display: block; font-size: 15px; }
.pdf-text small { display: block; font-size: 12.5px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-go { width: 18px; height: 18px; color: #9aa1ad; }
.pp-empty { color: #5b6270; text-align: center; margin: 4px 0; font-size: 14px; }

.video-wrapper { border-radius: 16px !important; margin: 0 auto 8px !important; box-shadow: none !important; border: 1px solid #e7e9ee; }
.video-wrapper.vertical { max-width: 340px; }
.video-wrapper video { display: block; width: 100%; height: 100%; background: #111; object-fit: contain; }

/* วิดีโอหลายคลิป: ชื่อคลิป + ลิงก์เปิดที่เว็บต้นทาง (เผื่อเจ้าของคลิปปิดการฝัง) */
.pp-videos { display: flex !important; flex-direction: column; gap: 18px; }
.pp-video-title { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: #1d2128; text-align: left; }
.pp-video-open { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: #a85300; text-decoration: underline; text-underline-offset: 3px; }
.pp-video .video-wrapper.vertical + .pp-video-open { display: flex; justify-content: center; }

/* รูปสินค้าหลายรูป: ปัดซ้าย/ขวา + จุดบอกตำแหน่ง */
.pp-gallery { margin-bottom: 18px !important; }
.pp-gallery-track { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.pp-gallery-track::-webkit-scrollbar { display: none; }
.pp-gallery-track .product-image { flex: 0 0 100%; width: 100%; height: 300px; scroll-snap-align: center; }
.pp-gallery-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.pp-gallery-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: #d4d8de; cursor: pointer; transition: width .2s ease, background-color .2s ease; }
.pp-gallery-dots button[aria-current="true"] { width: 22px; background: #b95900; }
.pp-gallery-dots button:focus-visible { outline: 2px solid #a85300; outline-offset: 2px; }

/* รายละเอียด / สเปก */
.pp-about[hidden] { display: none; }
.pp-desc { margin: 0 0 12px; font-size: 15px; line-height: 1.65; color: #1d2128; white-space: pre-line; text-align: left; overflow-wrap: anywhere; }
.pp-specs { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; margin: 0; border: 1px solid #e7e9ee; border-radius: 14px; overflow: hidden; text-align: left; }
.pp-specs[hidden] { display: none; }
.pp-specs dt, .pp-specs dd { margin: 0; padding: 10px 12px; border-top: 1px solid #eef0f3; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.pp-specs dt { background: #f7f8fa; color: #4b5260; font-weight: 600; }
.pp-specs dd { color: #1d2128; }
.pp-specs dt:first-of-type, .pp-specs dt:first-of-type + dd { border-top: 0; }

/* ท้าย: เครดิต SmartQTag (ลิงก์ไปหน้าแรก) */
.pp-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: 24px -20px 0; padding: 14px 20px; border-top: 1px solid #eef0f3; color: #5b6270; font-size: 12.5px;
}
.pp-foot-brand { font-weight: 800; font-size: 15px; color: #2b2d42; text-decoration: none; }
.pp-foot-brand .q, .pp-foot-brand .tag { color: #ff8800; }

@media (max-width: 480px) {
  body { padding: 0 !important; }
  .container { border-radius: 0 !important; border: 0; box-shadow: none !important; min-height: 100vh; }
  .pp-title { font-size: 22px; }
}

/* แถวที่ JS ซ่อน (ไม่มีวันประกัน) ต้องหายจริง — กฎ display:flex !important ด้านบนจะทับ style ในบรรทัด */
.pp-tiles .info-row[style*="none"], .pp-meta .info-row[style*="none"] { display: none !important; }
.pp-tiles:not(:has(.info-row:not([style*="none"]))) { display: none; }
.pp-meta { margin-top: 12px; }

/* แจ้งปัญหา (ไม่พบสินค้า / Serial / ร้านหมดอายุ / โหลดไม่สำเร็จ) */
.pp-problem { margin: 32px auto; width: calc(100% - 32px); box-sizing: border-box; max-width: 440px; padding: 28px 22px; border: 1px solid #e7e9ee; border-radius: 16px; background: #fff; text-align: center; }
.pp-problem-i { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #fff4e6; color: #b95900; }
.pp-problem-i svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pp-problem h1 { margin: 14px 0 8px; font-size: 22px; font-weight: 800; color: #1d2128; line-height: 1.35; }
.pp-problem p { margin: 0; color: #4b5260; line-height: 1.7; font-size: 15.5px; }
.pp-problem-act { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.pp-problem-btn { min-height: 46px; border: 0; border-radius: 12px; background: #b95900; color: #fff; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }
.pp-problem-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; color: #b95900; font-weight: 700; text-decoration: none; }
