/* ============================================================
   GoGiftings V27 — Cake & Personalised Product Page Layout Fix
   
   ROOT CAUSE:
   The base .gg-unified-product grid is 3 columns:
     [86px gallery-rail] [main-visual] [product-summary]
   
   But it has an extra row child: .flower-promises-row
   which was only given explicit placement for .gg-category-flowers.
   On cake and personalised pages, it becomes an unplaced 4th child
   that collapses the entire grid.
   
   FIX STRATEGY:
   1. Hide .flower-promises-row on non-flower product pages
   2. Define explicit clean 2-column grid for cake & personalised:
      [86px gallery-rail] [main-visual + product-summary side by side]
   3. Ensure variant strip, custom panels, CTAs all render correctly
   4. Fix image sizing and alignment for both categories
   ============================================================ */

/* ─── 1. HIDE flower-promises-row on cake & personalised ──── */
body.cake-product-page-final       .flower-promises-row,
body.cakes-match-flower-product    .flower-promises-row,
body.gg-category-cakes             .flower-promises-row,
body.gg-personalised-product-v23   .flower-promises-row,
body.gg-personalised-v23           .flower-promises-row,
body.gg-category-personalized      .flower-promises-row {
  display: none !important;
}

/* ─── 2. CAKE PRODUCT PAGE — clean 3-col grid ─────────────── */
body.cake-product-page-final .product-page,
body.cakes-match-flower-product .product-page,
body.gg-category-cakes.gg-unified-product .product-page {
  display: grid !important;
  grid-template-columns: 86px minmax(300px, 480px) minmax(270px, 1fr) !important;
  grid-template-rows: auto !important;
  gap: 24px !important;
  align-items: start !important;
}

/* Gallery rail: col 1, spans full height */
body.cake-product-page-final .product-page .gallery-rail,
body.cakes-match-flower-product .product-page .gallery-rail,
body.gg-category-cakes.gg-unified-product .product-page .gallery-rail {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

/* Main image: col 2 */
body.cake-product-page-final .product-page .main-visual,
body.cakes-match-flower-product .product-page .main-visual,
body.gg-category-cakes.gg-unified-product .product-page .main-visual {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

/* Product summary: col 3 */
body.cake-product-page-final .product-page .product-summary,
body.cakes-match-flower-product .product-page .product-summary,
body.gg-category-cakes.gg-unified-product .product-page .product-summary {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

/* ─── 3. PERSONALISED PRODUCT PAGE — same clean 3-col grid ── */
body.gg-personalised-product-v23 .product-page,
body.gg-personalised-v23.gg-unified-product .product-page,
body.gg-category-personalized.gg-unified-product .product-page {
  display: grid !important;
  grid-template-columns: 86px minmax(300px, 480px) minmax(270px, 1fr) !important;
  grid-template-rows: auto !important;
  gap: 24px !important;
  align-items: start !important;
}

body.gg-personalised-product-v23 .product-page .gallery-rail,
body.gg-personalised-v23.gg-unified-product .product-page .gallery-rail,
body.gg-category-personalized.gg-unified-product .product-page .gallery-rail {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

body.gg-personalised-product-v23 .product-page .main-visual,
body.gg-personalised-v23.gg-unified-product .product-page .main-visual,
body.gg-category-personalized.gg-unified-product .product-page .main-visual {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

body.gg-personalised-product-v23 .product-page .product-summary,
body.gg-personalised-v23.gg-unified-product .product-page .product-summary,
body.gg-category-personalized.gg-unified-product .product-page .product-summary {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

/* ─── 4. MAIN VISUAL — square image, clean crop ────────────── */
body.cake-product-page-final .main-visual .visual-wrap,
body.cake-product-page-final .main-visual .image-visual-wrap,
body.cakes-match-flower-product .main-visual .visual-wrap,
body.gg-personalised-product-v23 .main-visual .visual-wrap,
body.gg-personalised-product-v23 .main-visual .image-visual-wrap {
  border-radius: 20px !important;
  overflow: hidden !important;
  aspect-ratio: 1 / 1 !important;
  background: #fff7fb !important;
  border: 1px solid #f0dce8 !important;
}

body.cake-product-page-final .main-visual img,
body.cakes-match-flower-product .main-visual img,
body.gg-personalised-product-v23 .main-visual img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  border-radius: 20px !important;
}

/* ─── 5. GALLERY RAIL — consistent thumbnails ───────────────  */
body.cake-product-page-final .gallery-rail .gallery-thumb,
body.cakes-match-flower-product .gallery-rail .gallery-thumb,
body.gg-personalised-product-v23 .gallery-rail .gallery-thumb {
  width: 74px !important;
  height: 74px !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  border: 2px solid #eedaea !important;
  background: #fff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: border-color .2s !important;
}
body.cake-product-page-final .gallery-rail .gallery-thumb.active,
body.cakes-match-flower-product .gallery-rail .gallery-thumb.active,
body.gg-personalised-product-v23 .gallery-rail .gallery-thumb.active {
  border-color: #f62780 !important;
  box-shadow: 0 0 0 2px rgba(246,39,128,.2) !important;
}
body.cake-product-page-final .gallery-rail .gallery-thumb img,
body.cakes-match-flower-product .gallery-rail .gallery-thumb img,
body.gg-personalised-product-v23 .gallery-rail .gallery-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* ─── 6. PRODUCT SUMMARY — consistent typography & spacing ── */
body.cake-product-page-final .product-summary,
body.cakes-match-flower-product .product-summary,
body.gg-personalised-product-v23 .product-summary {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

/* Title */
body.cake-product-page-final .product-summary h1,
body.cakes-match-flower-product .product-summary h1,
body.gg-personalised-product-v23 .product-summary h1 {
  font-size: clamp(20px, 2.2vw, 28px) !important;
  font-weight: 900 !important;
  color: #1a1625 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

/* Price box */
body.cake-product-page-final .price-box,
body.cake-product-page-final .cake-price-box-final,
body.gg-personalised-product-v23 .gg-v23-price {
  display: flex !important;
  align-items: baseline !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}
body.cake-product-page-final .price-box .amount,
body.cake-product-page-final .gg-v23-price strong {
  font-size: 26px !important;
  font-weight: 900 !important;
  color: #f62780 !important;
}

/* Cake message input box */
body.cake-product-page-final .cake-message-box-final,
body.gg-personalised-product-v23 .gg-v23-personalise-box {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  background: #fff8fc !important;
  border: 1.5px solid rgba(246,39,128,.15) !important;
  border-radius: 16px !important;
  padding: 14px 16px !important;
}
body.cake-product-page-final .cake-message-box-final span,
body.gg-personalised-product-v23 .gg-v23-personalise-box h3 {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #f62780 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  margin: 0 0 6px !important;
}
body.cake-product-page-final .cake-message-box-final input,
body.gg-personalised-product-v23 .gg-v23-personalise-box input,
body.gg-personalised-product-v23 .gg-v23-personalise-box textarea {
  border: 1.5px solid #f0cedd !important;
  border-radius: 12px !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: #2b1a24 !important;
  background: #fff !important;
  outline: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
body.cake-product-page-final .cake-message-box-final input:focus,
body.gg-personalised-product-v23 .gg-v23-personalise-box input:focus {
  border-color: #f62780 !important;
  box-shadow: 0 0 0 3px rgba(246,39,128,.1) !important;
}

/* ─── 7. VARIANT STRIP — cakes & personalised ───────────────  */
body.cake-product-page-final .cake-variant-final,
body.cake-product-page-final .variant-strip,
body.gg-personalised-product-v23 .variant-strip {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
}
body.cake-product-page-final .cake-variant-final .variant-card,
body.cake-product-page-final .variant-card,
body.gg-personalised-product-v23 .variant-card {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px !important;
  border: 1.5px solid #eedaea !important;
  border-radius: 14px !important;
  background: #fff !important;
  cursor: pointer !important;
  text-decoration: none !important;
  transition: border-color .18s, background .18s !important;
}
body.cake-product-page-final .variant-card.active,
body.gg-personalised-product-v23 .variant-card.active {
  border-color: #f62780 !important;
  background: #fff6fa !important;
}
body.cake-product-page-final .variant-card img,
body.gg-personalised-product-v23 .variant-card img {
  width: 44px !important;
  height: 44px !important;
  object-fit: cover !important;
  border-radius: 10px !important;
  flex-shrink: 0 !important;
}
body.cake-product-page-final .variant-card span,
body.gg-personalised-product-v23 .variant-card span {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #1a1625 !important;
  flex: 1 !important;
}
body.cake-product-page-final .variant-card strong,
body.gg-personalised-product-v23 .variant-card strong {
  font-size: 13px !important;
  font-weight: 900 !important;
  color: #f62780 !important;
}

/* ─── 8. CTA BUTTONS — unified height and style ─────────────  */
body.cake-product-page-final .cake-add-final,
body.cake-product-page-final .add-cart-premium-btn,
body.gg-personalised-product-v23 .gg-v23-add,
body.gg-personalised-product-v23 .add-cart-premium-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-height: 52px !important;
  background: linear-gradient(135deg, #f62780, #5a1a93) !important;
  color: #fff !important;
  font-weight: 900 !important;
  font-size: 15px !important;
  border-radius: 16px !important;
  border: 0 !important;
  text-decoration: none !important;
  box-shadow: 0 10px 28px rgba(246,39,128,.22) !important;
  cursor: pointer !important;
  transition: transform .2s, box-shadow .2s !important;
}
body.cake-product-page-final .cake-add-final:hover,
body.gg-personalised-product-v23 .gg-v23-add:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 40px rgba(246,39,128,.30) !important;
}

body.gg-personalised-product-v23 .gg-v23-buy {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 52px !important;
  margin-top: 8px !important;
  background: #fff !important;
  color: #f62780 !important;
  font-weight: 900 !important;
  font-size: 15px !important;
  border-radius: 16px !important;
  border: 2px solid #f62780 !important;
  text-decoration: none !important;
  transition: background .2s, color .2s !important;
}
body.gg-personalised-product-v23 .gg-v23-buy:hover {
  background: #fff0f6 !important;
}

/* ─── 9. PROMISES ROW — cake & personalised version (2×2) ──── */
body.cake-product-page-final .premium-product-promises,
body.cake-product-page-final .cake-promises-final,
body.gg-personalised-product-v23 .gg-v23-promises {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  margin-top: 4px !important;
}
body.cake-product-page-final .premium-product-promises span,
body.cake-product-page-final .cake-promises-final span,
body.gg-personalised-product-v23 .gg-v23-promises span {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #fff7fb !important;
  border: 1px solid rgba(246,39,128,.12) !important;
  border-radius: 12px !important;
  padding: 9px 11px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  color: #3d3040 !important;
}

/* ─── 10. DELIVERY INFO ROW ─────────────────────────────────── */
body.cake-product-page-final .gg-v23-delivery,
body.gg-personalised-product-v23 .gg-v23-delivery {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  background: #f0fff6 !important;
  border: 1px solid rgba(23,154,82,.18) !important;
  border-radius: 14px !important;
  font-size: 13px !important;
  color: #0a5c33 !important;
  font-weight: 700 !important;
}

/* ─── 11. PAYMENTS / BNPL — already hidden by V26, reinforce ── */
body.cake-product-page-final .cake-payments-final,
body.gg-personalised-product-v23 .gg-v23-bnpl,
body.gg-personalised-product-v23 [class*="bnpl"],
body.cake-product-page-final [class*="bnpl"] {
  display: none !important;
}

/* ─── 12. DESCRIPTION TEXT ──────────────────────────────────── */
body.cake-product-page-final .cake-desc-final {
  font-size: 13.5px !important;
  line-height: 1.65 !important;
  color: #5e5267 !important;
  margin: 0 !important;
}

/* ─── 13. REVIEWS ROW — personalised ────────────────────────── */
body.gg-personalised-product-v23 .gg-v23-review-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 13px !important;
}
body.gg-personalised-product-v23 .gg-v23-rating {
  font-weight: 900 !important;
  color: #f59e0b !important;
}

/* ─── 14. TABLET — 2-column (no rail) ───────────────────────── */
@media (max-width: 900px) {
  body.cake-product-page-final .product-page,
  body.cakes-match-flower-product .product-page,
  body.gg-category-cakes.gg-unified-product .product-page,
  body.gg-personalised-product-v23 .product-page,
  body.gg-category-personalized.gg-unified-product .product-page {
    grid-template-columns: 72px 1fr !important;
    gap: 16px !important;
  }
  body.cake-product-page-final .product-page .gallery-rail,
  body.cakes-match-flower-product .product-page .gallery-rail,
  body.gg-personalised-product-v23 .product-page .gallery-rail {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  body.cake-product-page-final .product-page .main-visual,
  body.cakes-match-flower-product .product-page .main-visual,
  body.gg-personalised-product-v23 .product-page .main-visual {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }
  body.cake-product-page-final .product-page .product-summary,
  body.cakes-match-flower-product .product-page .product-summary,
  body.gg-personalised-product-v23 .product-page .product-summary {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }
}

/* ─── 15. MOBILE — single column stack ──────────────────────── */
@media (max-width: 640px) {
  body.cake-product-page-final .product-page,
  body.cakes-match-flower-product .product-page,
  body.gg-category-cakes.gg-unified-product .product-page,
  body.gg-personalised-product-v23 .product-page,
  body.gg-category-personalized.gg-unified-product .product-page {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }
  body.cake-product-page-final .gallery-rail,
  body.gg-personalised-product-v23 .gallery-rail {
    flex-direction: row !important;
    overflow-x: auto !important;
    width: 100% !important;
    gap: 8px !important;
  }
  body.cake-product-page-final .gallery-rail .gallery-thumb,
  body.gg-personalised-product-v23 .gallery-rail .gallery-thumb {
    flex: 0 0 68px !important;
  }
  body.cake-product-page-final .variant-strip,
  body.gg-personalised-product-v23 .variant-strip {
    grid-template-columns: 1fr !important;
  }
  body.cake-product-page-final .premium-product-promises,
  body.cake-product-page-final .cake-promises-final,
  body.gg-personalised-product-v23 .gg-v23-promises {
    grid-template-columns: 1fr !important;
  }
}
