/* ============================================================
   Detail produk SAB — tampilan model Shopee (dimuat paling akhir).
   - Galeri geser tanpa thumbnail + penghitung "1/7"
   - Variasi berupa kotak foto + nama
   - Ukuran huruf ringkas seperti Shopee
   - Halaman tidak bisa "melebar"/digeser ke samping di HP
   ============================================================ */

/* ---- Cegah halaman melebar (baris "=====" panjang di deskripsi) ---- */
body.page-product-detail[data-detail-layout] main.product-detail-page { overflow-x: clip !important; max-width: 100vw; }
body.page-product-detail[data-detail-layout] .sab-pd-desc__body { overflow-wrap: anywhere !important; word-break: break-word; }

/* ---- Galeri ---- */
body.page-product-detail[data-detail-layout] .sab-gal {
  display: block !important; position: relative !important; min-width: 0; width: 100%; height: auto !important; min-height: 0 !important; align-self: start;
  padding: 0 !important; margin: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
}
body.page-product-detail[data-detail-layout] .sab-gal__track {
  display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
  aspect-ratio: 1 / 1; width: 100% !important; max-width: none !important; background: #fff; border-radius: 8px; outline: none;
}
body.page-product-detail[data-detail-layout] .sab-gal__track::-webkit-scrollbar { display: none; }
body.page-product-detail[data-detail-layout] .sab-gal__slide {
  flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center; background: #fff;
}
body.page-product-detail[data-detail-layout] .sab-gal__img {
  all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in;
}
body.page-product-detail[data-detail-layout] .sab-gal__img img,
body.page-product-detail[data-detail-layout] .sab-gal__slide video {
  display: block; width: 100%; height: 100%; object-fit: contain; background: #fff;
}
body.page-product-detail[data-detail-layout] .sab-gal__slide video { background: #000; }
body.page-product-detail[data-detail-layout] .sab-gal__count {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff;
  font-size: 12px; font-weight: 500; line-height: 1.4; pointer-events: none;
}
body.page-product-detail[data-detail-layout] .sab-gal__nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 34px; height: 54px; border: 0; border-radius: 4px; background: rgba(0, 0, 0, .28); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer; display: none;
}
body.page-product-detail[data-detail-layout] .sab-gal__nav.is-prev { left: 0; border-radius: 0 4px 4px 0; }
body.page-product-detail[data-detail-layout] .sab-gal__nav.is-next { right: 0; border-radius: 4px 0 0 4px; }
@media (hover: hover) and (min-width: 761px) {
  body.page-product-detail[data-detail-layout] .sab-gal__nav { display: block; opacity: 0; transition: opacity .15s; }
  body.page-product-detail[data-detail-layout] .sab-gal:hover .sab-gal__nav { opacity: 1; }
}

/* ---- Ukuran huruf (desktop & HP) ---- */
body.page-product-detail[data-detail-layout] .product-detail-copy h1 {
  font-size: 1.25rem !important; font-weight: 500 !important; line-height: 1.35 !important; letter-spacing: 0 !important;
  margin: .2rem 0 0 !important;
}
body.page-product-detail[data-detail-layout] .product-detail-kicker {
  font-size: .72rem !important; letter-spacing: .04em !important;
}
body.page-product-detail[data-detail-layout] .product-detail-summary { display: block !important; padding: .75rem 1rem !important; border: 0 !important; background: #fff5f1 !important; border-radius: 4px; }
body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-label] {
  display: block; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #757575;
}
body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-text] {
  display: flex !important; flex-wrap: wrap; align-items: baseline; gap: 0 .6rem;
  font-size: 1.85rem !important; font-weight: 600 !important; line-height: 1.25 !important; color: #e65516 !important;
}
body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-text] small { font-size: .85rem; font-weight: 400; color: #757575; margin-left: -.45rem; }
body.page-product-detail[data-detail-layout] .product-detail-price-coret {
  order: -1; flex-basis: 100%; font-size: .9rem !important; font-weight: 400 !important; color: #929292 !important;
}

/* ---- Variasi model Shopee: kotak foto + nama ---- */
body.page-product-detail[data-detail-layout] .sab-pd-variants { margin: 0 !important; }
body.page-product-detail[data-detail-layout] .sab-pd-variants__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; margin-bottom: .55rem;
}
body.page-product-detail[data-detail-layout] .sab-pd-variants__head h2 {
  font-size: .82rem !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: none !important; color: #757575 !important;
}
body.page-product-detail[data-detail-layout] .sab-pd-variants__count { font-size: .82rem; color: #757575; }
body.page-product-detail[data-detail-layout] .sab-pd-variants__head h2 + .sab-pd-variants__count::before { content: "· "; }
body.page-product-detail[data-detail-layout] .sab-pd-variants__picked {
  flex-basis: 100%; font-size: .88rem !important; font-weight: 600 !important; color: #222 !important;
}
body.page-product-detail[data-detail-layout] .sab-pd-variants__list {
  display: grid !important; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px !important;
}
body.page-product-detail[data-detail-layout] .sab-pd-variant {
  position: relative; display: flex !important; flex-direction: column; align-items: stretch !important; gap: 0 !important;
  min-height: 0 !important; padding: 0 !important; overflow: hidden;
  border: 1px solid #e0e0e0 !important; border-radius: 4px !important; background: #fff !important; box-shadow: none !important;
  font-size: .75rem !important; font-weight: 400 !important; color: #222 !important; text-align: left;
}
body.page-product-detail[data-detail-layout] .sab-pd-variant img {
  width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; border-radius: 0 !important; object-fit: cover; background: #f5f5f5;
}
body.page-product-detail[data-detail-layout] .sab-pd-variant span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: 5px 6px; line-height: 1.3; min-height: calc(2 * 1.3em + 10px);
}
body.page-product-detail[data-detail-layout] .sab-pd-variant:not(:has(img)) span { min-height: 0; padding: 9px 10px; }
body.page-product-detail[data-detail-layout] .sab-pd-variant:hover { border-color: #e65516 !important; }
body.page-product-detail[data-detail-layout] .sab-pd-variant.is-selected {
  border-color: #e65516 !important; color: #e65516 !important; background: #fff !important; box-shadow: inset 0 0 0 1px #e65516 !important;
}
body.page-product-detail[data-detail-layout] .sab-pd-variant.is-selected::after {
  content: "✓"; position: absolute; right: 0; bottom: 0; width: 16px; height: 14px;
  background: #e65516; color: #fff; font-size: 10px; line-height: 14px; text-align: center; border-radius: 4px 0 0 0;
}
body.page-product-detail[data-detail-layout] .sab-pd-variant.is-soldout { text-decoration: none !important; opacity: .45; }
body.page-product-detail[data-detail-layout] .sab-pd-variant small {
  position: absolute; left: 0; top: 0; padding: 1px 5px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .65rem;
}

/* ---- Deskripsi ---- */
body.page-product-detail[data-detail-layout] .sab-pd-desc__title { font-size: 1rem !important; font-weight: 600 !important; }
body.page-product-detail[data-detail-layout] .sab-pd-desc__body { font-size: .9rem !important; line-height: 1.6 !important; color: #222 !important; }
body.page-product-detail[data-detail-layout] .sab-pd-desc__body p { margin: 0 0 .25rem !important; }

/* ============================ HP ============================ */
@media (max-width: 760px) {
  body.page-product-detail[data-detail-layout] .product-detail-hero { padding: 0 !important; background: #f5f5f5 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-hero > .section-wrap,
  body.page-product-detail[data-detail-layout] .product-detail-grid {
    width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important; gap: 0 !important; background: transparent !important;
  }
  body.page-product-detail[data-detail-layout] .sab-gal__track { border-radius: 0; }

  body.page-product-detail[data-detail-layout] .product-detail-copy { padding: 0 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-copy .product-info-stack { display: flex !important; flex-direction: column; gap: 0 !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > :not(.product-detail-share-modal) {
    background: #fff !important; padding: 12px !important; margin: 0 !important;
  }
  /* Urutan seperti Shopee: variasi → harga → judul → tombol */
  body.page-product-detail[data-detail-layout] .product-info-stack > .sab-pd-variants { order: 1; padding-top: 10px !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > .is-price { order: 2; padding: 0 !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > .sab-pd-po { order: 3; padding-top: 10px !important; padding-bottom: 0 !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > .is-title { order: 4; padding-top: 10px !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > .sab-cart-actions { order: 5; padding-top: 4px !important; border: 0 !important; }
  body.page-product-detail[data-detail-layout] .product-info-stack > .product-detail-share-open-wrap { order: 6; padding-top: 0 !important; margin-bottom: 8px !important; }

  body.page-product-detail[data-detail-layout] .product-detail-summary { border-radius: 0; padding: 10px 12px !important; }
  body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-text] { font-size: 1.5rem !important; }
  body.page-product-detail[data-detail-layout] .product-detail-copy h1 { font-size: 1rem !important; line-height: 1.4 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-kicker { font-size: .68rem !important; margin-bottom: .2rem; }

  /* Variasi di HP: satu baris kotak yang bisa digeser, seperti "7 Variasi Tersedia" di Shopee */
  body.page-product-detail[data-detail-layout] .sab-pd-variants__list {
    display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    margin: 0 -12px !important; padding: 0 12px 2px !important; scroll-padding-left: 12px;
  }
  body.page-product-detail[data-detail-layout] .sab-pd-variants__list::-webkit-scrollbar { display: none; }
  body.page-product-detail[data-detail-layout] .sab-pd-variant { flex: 0 0 84px; width: 84px; scroll-snap-align: start; }
  body.page-product-detail[data-detail-layout] .sab-pd-variant:not(:has(img)) { flex-basis: auto; width: auto; max-width: 160px; }

  body.page-product-detail[data-detail-layout] .sab-pd-desc { padding: 0 !important; margin-top: 8px !important; background: #fff !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-desc .section-wrap { padding: 14px 12px 18px !important; width: 100% !important; max-width: none !important; }

  /* Tombol beli berdampingan, ringkas */
  body.page-product-detail[data-detail-layout] .sab-cart-actions { display: flex !important; flex-direction: row !important; gap: 8px !important; }
  body.page-product-detail[data-detail-layout] .sab-cart-actions > button { flex: 1 1 0 !important; min-width: 0 !important; height: 42px !important; min-height: 42px !important; margin: 0 !important; padding: 0 8px !important; box-shadow: none !important; }
  body.page-product-detail[data-detail-layout] .sab-cart-actions .product-detail-buy-label { font-size: .8rem !important; letter-spacing: 0 !important; white-space: nowrap; }
  body.page-product-detail[data-detail-layout] .sab-cart-actions .sab-cart-add { background: #fff1ec !important; color: #e65516 !important; border: 1px solid #e65516 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-share-open-btn { min-height: 0 !important; padding: 6px 12px !important; font-size: .75rem !important; }
  body.page-product-detail[data-detail-layout] .product-detail-share-open-btn svg { width: 14px !important; height: 14px !important; }
}

/* ---- HP: huruf lebih kecil seperti aplikasi Shopee ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 760px) {
  body.page-product-detail[data-detail-layout] .product-detail-kicker { font-size: 10px !important; }
  body.page-product-detail[data-detail-layout] .product-detail-copy h1 { font-size: 14px !important; line-height: 1.4 !important; font-weight: 400 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-label] { font-size: 11px; }
  body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-text] { font-size: 20px !important; }
  body.page-product-detail[data-detail-layout] .product-detail-summary [data-sab-price-text] small { font-size: 12px; }
  body.page-product-detail[data-detail-layout] .product-detail-price-coret { font-size: 12px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-po__badge,
  body.page-product-detail[data-detail-layout] .sab-pd-po__text { font-size: 12px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-variants__head h2,
  body.page-product-detail[data-detail-layout] .sab-pd-variants__count { font-size: 12px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-variants__picked { font-size: 13px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-variant span { font-size: 11px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-variants__msg,
  body.page-product-detail[data-detail-layout] .sab-pd-variants__stock { font-size: 12px !important; }
  body.page-product-detail[data-detail-layout] .sab-cart-actions .product-detail-buy-label { font-size: 13px !important; font-weight: 600 !important; }
  body.page-product-detail[data-detail-layout] .product-detail-share-open-btn { font-size: 12px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-desc__title { font-size: 14px !important; margin-bottom: 8px !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-desc__body { font-size: 13px !important; line-height: 1.55 !important; }
  body.page-product-detail[data-detail-layout] .sab-pd-desc__body * { font-size: inherit !important; line-height: inherit !important; }
}
