/* ==========================================================================
   Synergreens — product detail page ("PDP"). Elevates the legacy Porto-theme
   .summary/.entry-summary product panel into a premium, Lazada/Amazon-style
   layout: slim breadcrumb, framed gallery with a discount ribbon, a richer
   info panel (eyebrow, stock/urgency, discount pill, trust badges), and a
   3-tab pill system (Product Details / Recommendation / Reviews) with a
   sliding indicator + layered "parallax" reveal on every panel switch.

   Scoped entirely under .sg-pdp. The sidebar and "Recommendation" product
   cards intentionally reuse the exact .sg-shop-sidebar__* / .sg-shop-card__*
   BEM hooks + CSS variables from sg-shop-catalog.css (view_product.php loads
   that file too and adds the shared .sg-shop-page wrapper class), so the
   category list and recommended-product cards are pixel-identical to /shop
   — not just "similar looking" — with zero duplicated CSS.
   ========================================================================== */

.sg-pdp {
  --sg-pdp-royal: var(--sg-sc-royal, #04878b);
  --sg-pdp-royal-deep: var(--sg-sc-royal-deep, #01393a);
  --sg-pdp-royal-soft: var(--sg-sc-royal-soft, #e7f4f4);
  --sg-pdp-ink: var(--sg-sc-ink, #0f2a2b);
  --sg-pdp-muted: var(--sg-sc-muted, #5c6584);
  --sg-pdp-line: var(--sg-sc-line, rgba(4, 135, 139, 0.12));
  --sg-pdp-radius: var(--sg-sc-radius, 18px);
  font-family: "Poppins", sans-serif;
}

/* ==========================================================================
   1) BREADCRUMB
   ========================================================================== */
.sg-pdp-crumbs {
  padding: 18px 0 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--sg-pdp-line);
}
.sg-pdp-crumbs__nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sg-pdp-muted);
}
.sg-pdp-crumbs__nav a {
  color: var(--sg-pdp-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.sg-pdp-crumbs__nav a:hover {
  color: var(--sg-pdp-royal);
}
.sg-pdp-crumbs__nav i {
  font-size: 9px;
  opacity: 0.6;
}
.sg-pdp-crumbs__current {
  color: var(--sg-pdp-ink);
  font-weight: 700;
  overflow: hidden;
  max-width: 320px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sg-pdp > .container {
  padding-top: 30px;
  padding-bottom: 10px;
}

/* ==========================================================================
   2) TOP PANEL — gallery + info
   ========================================================================== */
.sg-pdp-panel {
  background: #ffffff;
  border: 1px solid var(--sg-pdp-line);
  border-radius: var(--sg-pdp-radius);
  padding: 28px 28px 32px;
  box-shadow: 0 20px 45px -28px rgba(1, 42, 44, 0.35);
  margin-bottom: 28px;
}
@media (max-width: 575.98px) {
  .sg-pdp-panel {
    padding: 18px 16px 22px;
    border-radius: 14px;
  }
}

/* ---------- Gallery ------------------------------------------------------ */
.sg-pdp-gallery {
  position: relative;
}
.sg-pdp-gallery .thumb-gallery-detail {
  border-radius: calc(var(--sg-pdp-radius) - 4px);
  overflow: hidden;
  background: var(--sg-pdp-royal-soft);
}
.sg-pdp-gallery .thumb-gallery-detail img {
  border-radius: calc(var(--sg-pdp-radius) - 4px);
  object-fit: contain;
  aspect-ratio: 1 / 1;
}
.sg-pdp-gallery .thumb-gallery-thumbs .cur-pointer {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.sg-pdp-gallery .thumb-gallery-thumbs .owl-item.current .cur-pointer,
.sg-pdp-gallery .thumb-gallery-thumbs .cur-pointer:hover {
  border-color: var(--sg-pdp-royal);
  transform: translateY(-2px);
}
.sg-pdp-gallery__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 8px 10px 6px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff5f6d 0%, #d3273f 55%, #a5122a 100%);
  color: #ffffff;
  line-height: 1;
  box-shadow: 0 10px 20px -8px rgba(165, 18, 42, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.sg-pdp-gallery__badge-value {
  position: relative;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.sg-pdp-gallery__badge-label {
  position: relative;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ---------- Info panel ---------------------------------------------------- */
.sg-pdp-info__eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--sg-pdp-royal);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.sg-pdp-info__title {
  color: var(--sg-pdp-ink) !important;
  line-height: 1.25 !important;
}

.sg-pdp-info__meta {
  gap: 12px;
  margin-top: 14px !important;
  flex-wrap: wrap;
}
.sg-pdp-info__meta .review-num a {
  font-size: 12.5px;
}
.sg-pdp-info__stock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sg-pdp-info__stock.is-in-stock {
  background: #e7f7ec;
  color: #1d8a4a;
}
.sg-pdp-info__stock.is-out-of-stock {
  background: #fdeceb;
  color: #c23b32;
}
.sg-pdp-info__urgency {
  font-size: 11.5px;
  font-weight: 700;
  color: #d3273f;
  animation: sgPdpUrgencyPulse 1.8s ease-in-out infinite;
}
@keyframes sgPdpUrgencyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.sg-pdp-info__price {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.sg-pdp-info__price .sale {
  font-size: 30px !important;
  font-weight: 800 !important;
  color: var(--sg-pdp-ink) !important;
}
.sg-pdp-info__price .amount {
  font-size: 17px;
  color: #9aa2b8;
  text-decoration: line-through;
}
.sg-pdp-info__discount-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(145deg, #ff5f6d 0%, #d3273f 100%);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.sg-pdp-info__desc {
  color: var(--sg-pdp-muted) !important;
}
.sg-pdp-info__sku {
  margin-bottom: 18px !important;
}

/* Trust badges — same three claims already used on the /shop hero, kept
   identical here on purpose so the promises never disagree page to page. */
.sg-pdp-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0 0 22px;
  padding: 14px 16px;
  list-style: none;
  background: var(--sg-pdp-royal-soft);
  border-radius: 12px;
}
.sg-pdp-trust li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sg-pdp-royal-deep);
}
.sg-pdp-trust i {
  color: var(--sg-pdp-royal);
  font-size: 13px;
}

.sg-pdp-cart {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px !important;
}
.sg-pdp-cart hr {
  display: none;
}
.sg-pdp-cart__qty {
  flex: 0 0 auto;
}
.sg-pdp-cart__cta {
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  background: linear-gradient(135deg, var(--sg-pdp-royal) 0%, var(--sg-pdp-royal-deep) 100%) !important;
  border: none !important;
  padding: 14px 22px !important;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  box-shadow: 0 16px 30px -14px rgba(26, 52, 128, 0.55);
  transition: box-shadow 0.3s ease, transform 0.3s ease, filter 0.2s ease;
}
.sg-pdp-cart__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px -12px rgba(26, 52, 128, 0.65);
  filter: brightness(1.05);
  color: #ffffff;
}
.sg-pdp-cart__cta.disabled {
  opacity: 0.55;
  filter: grayscale(0.3);
  box-shadow: none;
  cursor: not-allowed;
}

.sg-pdp-actions {
  gap: 14px;
  padding-top: 6px;
  border-top: 1px solid var(--sg-pdp-line);
}
.sg-pdp-wishlist {
  transition: color 0.2s ease;
}
.sg-pdp-wishlist:hover {
  color: var(--sg-pdp-royal) !important;
}
.sg-pdp-wishlist:hover i {
  transform: scale(1.15);
}
.sg-pdp-wishlist i {
  transition: transform 0.2s ease;
}

/* ==========================================================================
   3) TABS — pill nav + sliding indicator + parallax panel reveal
   ========================================================================== */
.sg-pdp-tabs {
  background: #ffffff;
  border: 1px solid var(--sg-pdp-line);
  border-radius: var(--sg-pdp-radius);
  padding: 10px;
  box-shadow: 0 20px 45px -28px rgba(1, 42, 44, 0.35);
  margin-bottom: 40px;
}

.sg-pdp-tabs__nav {
  position: relative;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--sg-pdp-royal-soft);
  border-radius: 999px;
  /* Safety net, not the primary layout: each pill below is flex:1 1 auto
     with min-width:max-content, so it grows to fill the row on wide
     screens but is never allowed to shrink narrower than its own icon +
     label (that's what actually prevents "Recommendation" — a single
     14-character word that cannot line-wrap — from ever being clipped or
     ellipsized). If three full-size pills genuinely don't fit (very
     narrow phones), the row simply scrolls horizontally instead, the
     same swipeable-tab-strip pattern iOS/Android apps already use once a
     segmented control has more content than screen width. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sg-pdp-tabs__nav::-webkit-scrollbar {
  display: none;
}
.sg-pdp-tabs__pill {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: none;
  background: transparent;
  border-radius: 999px;
  color: var(--sg-pdp-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.35s ease;
}
.sg-pdp-tabs__pill i {
  font-size: 13px;
  opacity: 0.85;
}
.sg-pdp-tabs__pill.is-active {
  color: #ffffff;
}
.sg-pdp-tabs__pill:not(.is-active):hover {
  color: var(--sg-pdp-royal-deep);
}
/* The sliding pill itself — JS measures the active button's offsetLeft /
   offsetWidth and transforms this element to match, so it glides between
   tabs instead of snapping. */
.sg-pdp-tabs__indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  height: calc(100% - 12px);
  width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sg-pdp-royal) 0%, var(--sg-pdp-royal-deep) 100%);
  box-shadow: 0 12px 24px -10px rgba(26, 52, 128, 0.55);
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), width 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.sg-pdp-tabs__panels {
  position: relative;
  padding: 34px 22px 10px;
}
@media (max-width: 575.98px) {
  .sg-pdp-tabs__panels {
    padding: 26px 6px 6px;
  }
}

.sg-pdp-tabs__panel {
  position: relative;
  display: none;
  overflow: hidden;
  min-height: 160px;
}
.sg-pdp-tabs__panel.is-active {
  display: block;
}

/* Decorative watermark icon — the "background" layer of the parallax
   effect. It starts offset + scaled + invisible, and eases in to a large,
   barely-there corner glyph slower than the foreground content settles,
   so the panel reads with a genuine sense of depth on every tab switch
   rather than a flat cross-fade. */
.sg-pdp-tabs__panel-bg {
  position: absolute;
  top: -30px;
  right: -20px;
  z-index: 0;
  font-size: 190px;
  line-height: 1;
  color: var(--sg-pdp-royal);
  opacity: 0;
  transform: translate3d(70px, -40px, 0) scale(1.2) rotate(8deg);
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.1s ease;
  pointer-events: none;
}
.sg-pdp-tabs__panel.is-active .sg-pdp-tabs__panel-bg {
  opacity: 0.05;
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
}
/* The "entering" class holds the pre-transition offset state on the very
   first frame after display:block is applied; sg-product-view.js removes
   it one frame later so the browser animates from here → .is-active,
   rather than the two classes ever being present with no transition. */
.sg-pdp-tabs__panel.is-entering .sg-pdp-tabs__panel-bg {
  opacity: 0;
  transform: translate3d(70px, -40px, 0) scale(1.2) rotate(8deg);
}

.sg-pdp-tabs__panel-content {
  position: relative;
  z-index: 1;
  transform: translateY(26px);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}
.sg-pdp-tabs__panel.is-active .sg-pdp-tabs__panel-content {
  transform: translateY(0);
  opacity: 1;
}
.sg-pdp-tabs__panel.is-entering .sg-pdp-tabs__panel-content {
  transform: translateY(26px);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .sg-pdp-tabs__indicator,
  .sg-pdp-tabs__panel-bg,
  .sg-pdp-tabs__panel-content {
    transition: none !important;
  }
}

.sg-pdp-tabs__panel-lead {
  margin-bottom: 18px;
  color: var(--sg-pdp-muted);
  font-size: 14px;
}

/* Rich-text admin content (misc_desc) — gentle resets only; the field is
   pasted-from-elsewhere HTML with heavy inline styling, so this avoids
   fighting the admin's own formatting beyond making it fit the panel. */
.sg-pdp-richtext {
  color: var(--sg-pdp-ink);
  font-size: 14.5px;
  line-height: 1.75;
}
.sg-pdp-richtext img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
.sg-pdp-richtext table {
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

.sg-pdp-reco-grid {
  margin: 0 -10px;
}

/* ==========================================================================
   4) EMPTY STATES (Recommendation fallback, Reviews)
   ========================================================================== */
.sg-pdp-empty {
  padding: 50px 20px;
  text-align: center;
}
.sg-pdp-empty i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--sg-pdp-royal-soft);
  color: var(--sg-pdp-royal);
  font-size: 26px;
}
.sg-pdp-empty h4 {
  margin-bottom: 8px;
  color: var(--sg-pdp-ink);
  font-weight: 700;
}
.sg-pdp-empty p {
  max-width: 380px;
  margin: 0 auto 20px;
  color: var(--sg-pdp-muted);
  font-size: 13.5px;
}
.sg-pdp-empty .btn {
  border-radius: 999px !important;
  padding: 11px 28px !important;
  background: linear-gradient(135deg, var(--sg-pdp-royal) 0%, var(--sg-pdp-royal-deep) 100%) !important;
  border: none !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 991.98px) {
  .sg-pdp > .container > .row > div.col-lg-3 {
    display: none !important;
  }
  .sg-pdp > .container > .row > div.col-lg-9 {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
  }
}
@media (max-width: 767.98px) {
  .sg-pdp-crumbs__current {
    max-width: 180px;
  }
  .sg-pdp-info__price .sale {
    font-size: 24px !important;
  }
  /* Below 768px there isn't room for icon + "Recommendation" (14
     unbreakable characters) + icon + "Product Details" + icon +
     "Reviews" on one line even after shrinking the font — the nav's own
     min-width:max-content guarantee (so labels are never clipped or
     ellipsized) meant the row just overflowed instead, with "Reviews"
     spilling silently off the right edge. Dropping the decorative icons
     here removes exactly the width they and their gap cost (icons stay
     for >=768px, where there's plenty of room) and the fluid clamp()
     keeps the remaining text-only labels comfortably sized across the
     rest of this range: ~10px at the narrowest shipping phone width
     (320px) up to a 13px ceiling reached by ~390px and held through
     767.98px, verified with zero overflow at 320/375/390/767px. */
  .sg-pdp-tabs__pill i {
    display: none;
  }
  .sg-pdp-tabs__pill {
    font-size: clamp(10px, calc(4.29vw - 3.7px), 13px);
    padding: 12px 8px;
    gap: 0;
  }
  .sg-pdp-tabs__nav {
    gap: 4px;
  }
}
@media (max-width: 575.98px) {
  .sg-pdp-cart {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-pdp-cart__qty {
    align-self: flex-start;
  }
  /* .sg-pdp-cart__cta's flex:1 1 220px (set above for the desktop *row*
     layout, where 220px is a sane minimum *width*) becomes a minimum
     *height* once the container above switches to flex-direction:column
     — flex-basis/grow/shrink always resolve against the main axis, which
     rotates with the container. Nothing constrains vertical space on a
     page (unlike width), so the button was rendering ~220px tall instead
     of a normal button height. Reset to natural, content-based sizing. */
  .sg-pdp-cart__cta {
    flex: 0 0 auto;
  }
  .sg-pdp-tabs__panel-bg {
    font-size: 120px;
  }
}
