/* ============================================================================
   assets/product.css — v12 product page (lib/views/product_view.php)
   Mobile-first; ≥ 900 px becomes two columns (photos left, details right).
   Uses the tokens from assets/app.css (loaded first). Prefix: pd-
   ============================================================================ */
/* live.php's inline :root has the older orange tokens → restore the Sakmina palette for the page */
body.pm { --brand: #12A150; --brand-dk: #0B7A3B; --brand-lt: #E8F7EE; --ink: #1B2420; --muted: #5A665F; --line: #E1E7E3; --live: #D92D20; }
body.pm { background: var(--bg); color: var(--ink); padding-bottom: calc(68px + env(safe-area-inset-bottom)); height: auto; }
html:has(body.pm) { background: var(--bg); height: auto; }
body.pm a { color: var(--brand-dk); }
.pd { position: relative; }
.pd-wrap { max-width: 1200px; margin: 0 auto; }

/* ---- top bar ---- */
.pd-top { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; transition: background .2s, box-shadow .2s; }
.pd-top .pd-ib { position: relative; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.38); color: #fff !important; border: 0; cursor: pointer; flex: none; transition: background .2s, color .2s; }
.pd-top .pd-ib:hover { background: rgba(0,0,0,.55); }
.pd-top-t { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .2s; }
.pd-top.solid { background: #fff; box-shadow: 0 1px 8px rgba(16,40,28,.12); }
.pd-top.solid .pd-ib { background: transparent; color: var(--brand-dk) !important; }
.pd-top.solid .pd-ib:hover { background: var(--brand-lt); }
.pd-top.solid .pd-top-t { opacity: 1; }
.pd-top .gm-badge { top: -2px; right: -2px; }

/* ---- gallery ---- */
.pd-gal { position: relative; background: #fff; }
.pd-slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 1 / 1; background: var(--brand-lt); }
.pd-slides::-webkit-scrollbar { display: none; }
.pd-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; scroll-snap-stop: always; position: relative; cursor: zoom-in; }
.pd-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-noimg { display: flex; align-items: center; justify-content: center; cursor: default; opacity: .6; }
.pd-count { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pd-thumbs ~ .pd-count, .pd-gal:has(.pd-thumbs) .pd-count { bottom: 88px; }
.pd-arrow { display: none; position: absolute; top: 40%; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--ink);
  font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.pd-arrow.prev { left: 10px; } .pd-arrow.next { right: 10px; }
@media (hover: hover) { .pd-gal:hover .pd-arrow { display: inline-flex; align-items: center; justify-content: center; } }
.pd-gal-tag { position: absolute; left: 0; top: calc(env(safe-area-inset-top) + 60px); display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px;
  font-size: 13px; font-weight: 700; color: #fff !important; border-radius: 0 999px 999px 0; }
.pd-gal-tag.flash { background: linear-gradient(90deg, var(--sale), #F2762E); }
.pd-gal-tag.flash svg { fill: #FFE27A; stroke: #FFE27A; }
.pd-gal-tag.live { background: var(--live); }
.pd-gal-tag.live i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: gm-blink 1.2s infinite; }
.pd-thumbs { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; background: #fff; }
.pd-thumbs button { flex: none; width: 60px; height: 60px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--brand-lt); cursor: pointer; }
.pd-thumbs button.on { border-color: var(--brand); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* ---- info ---- */
.pd-info { background: #fff; padding: 0 0 4px; }
.pd-flash { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px 14px; color: #fff;
  background: linear-gradient(90deg, #E8462F, #F2762E 60%, #F59E2E); }
.pd-flash-t { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; }
.pd-flash-t svg { fill: #FFE27A; stroke: #FFE27A; }
.pd-flash-c { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pd-clock b { display: inline-block; min-width: 26px; text-align: center; background: #1B2420; color: #fff; border-radius: 5px; padding: 2px 4px; font-size: 14px; }
.pd-flash-bar { grid-column: 1 / -1; position: relative; height: 16px; border-radius: 999px; background: rgba(255,255,255,.35); overflow: hidden; }
.pd-flash-bar i { position: absolute; inset: 0 auto 0 0; background: #FFE27A; border-radius: 999px; }
.pd-flash-bar em { position: relative; display: block; text-align: center; font-style: normal; font-size: 11px; font-weight: 700; line-height: 16px; color: #7A2E00; }
.pd-pricebox { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.pd-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.pd-price b { font-size: 28px; color: var(--sale); line-height: 1.1; letter-spacing: -.01em; }
.pd-price s { color: var(--muted); font-size: 15px; }
.pd-off { background: #FDECEA; color: var(--sale); font-weight: 700; font-size: 13px; padding: 1px 8px; border-radius: 6px; }
.pd-like { display: inline-flex; flex-direction: column; align-items: center; gap: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12px; min-width: 44px; min-height: 44px; }
.pd-like svg { fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
.pd-like.on { color: var(--sale); } .pd-like.on svg { fill: var(--sale); stroke: var(--sale); }
.pd-like.pop svg { animation: gm-pop .45s ease; }
.pd-tiers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 14px 0; padding: 8px 10px; border-radius: 10px; background: var(--brand-lt); color: var(--brand-dk); font-size: 13px; }
.pd-tiers span { background: #fff; border-radius: 6px; padding: 1px 8px; }
.pd-name { font-size: 18px; font-weight: 600; line-height: 1.35; padding: 8px 14px 4px; }
.pd-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 2px 14px 12px; font-size: 14px; color: var(--muted); }
.pd-stats a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink) !important; }
.pd-stats a span { color: var(--muted); }
.pd-stock { font-weight: 600; color: var(--brand-dk); }
.pd-stock.low { color: #B54708; } .pd-stock.out { color: var(--sale); }
.pd-stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.pd-star { display: inline-block; --f: 0%;
  background: linear-gradient(90deg, #F2A900 var(--f), #D5DCD8 var(--f));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* rows (variations / delivery / guarantees / vouchers) */
.pd-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: #fff;
  color: var(--ink) !important; text-align: left; font: inherit; }
button.pd-row, a.pd-row { cursor: pointer; transition: background .15s; }
button.pd-row:hover, a.pd-row:hover { background: #FAFCFB; }
.pd-row-ic { flex: none; width: 24px; color: var(--brand-dk); padding-top: 1px; }
.pd-row-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.pd-chev { flex: none; color: var(--muted); font-size: 20px; line-height: 1; }
.pd-var { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.pd-var b { font-weight: 600; margin-right: 2px; }
.pd-var i { font-style: normal; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; line-height: 24px; font-size: 13px; background: #fff; }
.pd-var i.out { color: #A7B0AB; text-decoration: line-through; }
.pd-chg { flex: none; font-size: 14px; font-weight: 600; padding: 2px 0; }
.pd-green { color: #0E7C6B; } .pd-bad { color: var(--sale); } .pd-ink { color: var(--ink); }
.pd-guar-l { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
.pd-guar-l span { display: inline-flex; align-items: center; gap: 4px; }
.pd-guar-l span::before { content: '✓'; color: var(--brand); font-weight: 700; }
.pd-vouch-l { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.pd-voucher { font: inherit; font-size: 13px; border: 1px dashed var(--sale); color: var(--sale); background: #FFF5F3; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.pd-voucher:hover { background: #FDECEA; }

/* ---- sections ---- */
.pd-sec { background: #fff; margin-top: 8px; padding: 14px; }
.pd-sec-flat { background: transparent; padding: 14px 12px; }
.pd-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pd-sec-h h2 { font-size: 17px; }
.pd-sec-h a { font-size: 14px; font-weight: 600; }
.pd-empty { margin: 0; font-size: 14px; }
.pd-rsum { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; }
.pd-rbig { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 92px; }
.pd-rbig b { font-size: 34px; line-height: 1; color: var(--ink); }
.pd-rbig > span { display: none; }
.pd-rbig small { color: var(--muted); font-size: 12px; }
.pd-rbars { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.pd-rbars div { display: grid; grid-template-columns: 24px 1fr 28px; align-items: center; gap: 6px; }
.pd-rbars i { height: 6px; border-radius: 999px; background: #E9EEEB; overflow: hidden; }
.pd-rbars em { display: block; height: 100%; background: #F2A900; border-radius: 999px; }
.pd-chipbtn { display: inline-block; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin-bottom: 6px; color: var(--ink) !important; }
.pd-rev { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.pd-rev-h { display: flex; align-items: center; gap: 10px; }
.pd-rev-h > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.pd-rev-h time { font-size: 12px; }
.pd-ava { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-lt); color: var(--brand-dk); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.pd-rev p { margin: 8px 0 4px; font-size: 14px; line-height: 1.55; }
.pd-rev-imgs { display: flex; gap: 6px; margin-top: 6px; }
.pd-rev-imgs button { padding: 0; border: 0; border-radius: 8px; overflow: hidden; width: 72px; height: 72px; cursor: zoom-in; background: var(--brand-lt); }
.pd-rev-imgs img { width: 100%; height: 100%; object-fit: cover; }

.pd-shop { display: flex; align-items: center; gap: 12px; }
.pd-shop-ava { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--brand-dk); color: #fff; font-size: 22px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pd-shop-ava em { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); background: var(--live); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 4px; }
.pd-shop-n { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-shop-n small { font-size: 12px; }
.pd-btn-o { flex: none; border: 1.5px solid var(--brand-dk); color: var(--brand-dk) !important; border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.pd-btn-o:hover { background: var(--brand-lt); }
.pd-shop-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; text-align: center; font-size: 12px; color: var(--muted); }
.pd-shop-stats b { display: block; color: var(--sale); font-size: 16px; }

.pd-specs { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 0; margin: 0; font-size: 14px; }
.pd-specs dt, .pd-specs dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pd-specs dt { color: var(--muted); }
.pd-desc { font-size: 15px; line-height: 1.65; white-space: normal; overflow-wrap: anywhere; }
.pd-desc.clip { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.pd-more { display: block; margin: 8px auto 0; border: 0; background: none; color: var(--brand-dk); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 12px; }

.pd-hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; scrollbar-width: thin; }
.pd-hscroll > .pc { scroll-snap-align: start; }
@media (min-width: 600px) { .pd-hscroll { grid-auto-columns: 28%; } }
@media (min-width: 900px) { .pd-hscroll { grid-auto-columns: 18%; } }

/* ---- sticky action bar ---- */
.pd-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex; align-items: stretch; height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; box-shadow: 0 -2px 12px rgba(16,40,28,.12); }
.pd-bar-ic { flex: 0 0 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 11px; color: var(--brand-dk) !important; border-right: 1px solid var(--line); }
.pd-bar-ic:hover { background: var(--brand-lt); }
.pd-bar-cart, .pd-bar-buy { flex: 1; border: 0; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.pd-bar-cart { background: var(--brand-lt); color: var(--brand-dk); font-size: 12px; font-weight: 600; }
.pd-bar-cart:hover { background: #D6F0E0; }
.pd-bar-buy { background: var(--sale); color: #fff; font-weight: 700; font-size: 16px; line-height: 1.15; }
.pd-bar-buy small { font-size: 12px; font-weight: 600; opacity: .92; }
.pd-bar-buy:hover { filter: brightness(.95); }
.pd-bar button:disabled { background: #E4E8E6; color: #8C9690; cursor: not-allowed; filter: none; }
.pd-bar button:active:not(:disabled) { transform: scale(.98); }

/* ---- lightbox ---- */
.pd-lb { position: fixed; inset: 0; z-index: 300; background: #000; display: flex; flex-direction: column; }
.pd-lb[hidden] { display: none; }
.pd-lb-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pd-lb-track::-webkit-scrollbar { display: none; }
.pd-lb-item { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-x pinch-zoom; }
.pd-lb-item img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .25s ease; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.pd-lb-item.zoom { overflow: auto; touch-action: auto; }
.pd-lb-item.zoom img { transform: scale(2.2); cursor: zoom-out; }
.pd-lb-x { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.16); color: #fff; font-size: 20px; cursor: pointer; }
.pd-lb-n { position: absolute; top: calc(env(safe-area-inset-top) + 20px); left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; z-index: 2; }
.pd-lb-tip { margin: 0; padding: 10px 0 calc(env(safe-area-inset-bottom) + 14px); text-align: center; color: rgba(255,255,255,.6); font-size: 12px; }

/* Buy sheet above the sticky bar; "Add to cart" mode shows only the option picker */
body.pm .sheet-bg { z-index: 200; }
.sheet.cart-mode .buy-only { display: none !important; }
.sheet:not(.cart-mode) .gm-cartfull { display: none !important; }
.sheet.cart-mode .gm-cartfull { margin-top: 4px; background: var(--gm-dk, #0B7A3B) !important; color: #fff !important; border: 0 !important; }
.sheet .sh-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #F1F4F2; font-size: 18px; cursor: pointer; color: var(--ink); }
.sheet { position: relative; }

/* ---- desktop: two columns ---- */
@media (min-width: 900px) {
  body.pm { padding-bottom: 24px; }
  .pd-top { position: sticky; background: #fff; box-shadow: 0 1px 8px rgba(16,40,28,.1); }
  .pd-top .pd-ib { background: transparent; color: var(--brand-dk) !important; }
  .pd-top .pd-top-t { opacity: 1; }
  .pd-wrap { padding: 16px 16px 0; }
  .pd-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--sh); }
  .pd-gal { border-radius: 12px; overflow: hidden; align-self: start; position: sticky; top: 76px; }
  .pd-gal-tag { top: 14px; }
  .pd-flash { border-radius: 10px; }
  .pd-pricebox { background: #FAFAFA; border-radius: 10px; margin-top: 10px; padding: 14px; }
  .pd-name { font-size: 22px; padding: 12px 0 4px; order: -1; }
  .pd-info { display: flex; flex-direction: column; }
  .pd-info > .pd-flash { order: -2; }
  .pd-stats, .pd-pricebox, .pd-tiers { margin-left: 0; margin-right: 0; }
  .pd-stats { padding-left: 0; }
  .pd-row { padding-left: 0; padding-right: 0; }
  .pd-sec { border-radius: 14px; margin-top: 16px; padding: 18px; box-shadow: var(--sh); }
  .pd-sec-flat { box-shadow: none; padding: 16px 0; }
  .pd-bar { position: static; height: auto; padding: 0; margin-top: 14px; background: none; box-shadow: none; gap: 10px; }
  .pd-grid .pd-bar { display: flex; }
  .pd-bar-ic { display: none; }
  .pd-bar-cart, .pd-bar-buy { flex: 0 1 220px; min-height: 52px; border-radius: 10px; }
  .pd-bar-cart { border: 1.5px solid var(--brand-dk); flex-direction: row; gap: 8px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .pd-slides, .pd-lb-track { scroll-behavior: auto; } .pd-lb-item img { transition: none; } }

/* v13: real "sold in the last 24 h" signal */
.pd-hot { display: inline-flex; align-items: center; gap: 4px; background: #FFF1E6; color: #B54708; font-weight: 700; font-size: 13px; padding: 1px 10px; border-radius: 999px; animation: pd-glow 2.4s ease-in-out infinite; }
@keyframes pd-glow { 50% { box-shadow: 0 0 0 4px rgba(232, 70, 47, .12); } }
@media (prefers-reduced-motion: reduce) { .pd-hot { animation: none; } }
