/* =================================================================
   product-page.css — Rhythm Dev Single Product Page
   Sections:
     1.  WC gallery essentials (replaces disabled WC CSS)
     2.  Two-column layout
     3.  Glass zoom lens
     4.  Typography / Task-6 minimalist redesign
     5.  Colour swatches
     6.  Quantity +/− buttons
     7.  Add-to-cart button states
     8.  Sticky add-to-cart bar
     9.  Toast notifications (stackable)
    10.  Tabs / meta / related (cleanup)
    11.  Responsive (< 768 px)
   ================================================================= */


/* ── 1. WC GALLERY ESSENTIALS ──────────────────────────────────
   WC styles are disabled globally; provide the minimum needed for
   the flexslider-based gallery to work correctly.
   ─────────────────────────────────────────────────────────────── */

.woocommerce-product-gallery {
  position: relative;
  width: 100%;
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger {
  display: none; /* hide default magnifier icon */
}

.woocommerce-product-gallery__wrapper {
  display: block;
  overflow: hidden;
  border-radius: 12px;
}

/* All slides hidden by default; flexslider shows active via JS */
.woocommerce-product-gallery__image {
  display: none;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #EEECEA;
}

/* First slide visible before JS boots */
.woocommerce-product-gallery__image:first-child,
.woocommerce-product-gallery__image.flex-active-slide {
  display: block;
}

.woocommerce-product-gallery__image a {
  display: block;
}

.woocommerce-product-gallery__image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

/* Sale flash */
.woocommerce span.onsale {
  background: #0A0A0A;
  color: #F7F6F4;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  min-height: auto;
  line-height: 1.4;
}

/* Thumbnail strip */
.flex-control-nav.flex-control-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0.625rem 0 0;
}

.flex-control-nav.flex-control-thumbs li {
  flex: 0 0 calc(25% - 0.375rem);
}

.flex-control-nav.flex-control-thumbs img {
  width: 100%;
  display: block;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease;
  aspect-ratio: 1;
  object-fit: cover;
}

.flex-control-nav.flex-control-thumbs .flex-active img,
.flex-control-nav.flex-control-thumbs img:hover {
  opacity: 1;
  outline: 2px solid #0A0A0A;
  outline-offset: 2px;
}


/* ── 2. TWO-COLUMN LAYOUT ──────────────────────────────────────
   rp-layout: flexbox, 60 / 40 split, 32px gap.
   Stack to single column below 768 px (see § 11).
   ─────────────────────────────────────────────────────────────── */

.rp-product {
  padding-top: 0;
}

.rp-layout {
  display: flex;
  gap: 3.5rem;
  align-items: flex-start;
}

.rp-gallery-col {
  flex: 0 0 60%;
  max-width: 60%;
  position: sticky;
  top: calc(68px + 1.5rem); /* below fixed nav */
}

.rp-summary-col {
  flex: 1;
  min-width: 0;
}


/* ── 3. GLASS ZOOM LENS ────────────────────────────────────────
   Translated from magnifier-lens.tsx (React → vanilla JS/CSS).
   Lens is appended inside .woocommerce-product-gallery__image.
   mask-image creates the circular window; rp-zoom-ring is the
   glass highlight overlay.
   ─────────────────────────────────────────────────────────────── */

.rp-zoom-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.rp-zoom-wrap.is-active {
  opacity: 1;
}

.rp-zoom-zoomed {
  position: absolute;
  inset: 0;
}

.rp-zoom-zoomed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Glass ring — matches the React component's boxShadow + radialGradient */
.rp-zoom-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.40),
    0 4px 16px rgba(0, 0, 0, 0.20),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  background: radial-gradient(
    circle at center,
    transparent       60%,
    rgba(255,255,255,0.10) 70%,
    rgba(255,255,255,0.20) 80%,
    transparent       100%
  );
}

/* Cursor crosshair only while hovering the gallery image */
.woocommerce-product-gallery__image:has(.rp-zoom-wrap.is-active) a,
.woocommerce-product-gallery__image:has(.rp-zoom-wrap.is-active) img {
  cursor: none;
}


/* ── 4. TYPOGRAPHY / TASK-6 MINIMALIST REDESIGN ────────────────
   title 28 px / 500 | price 22 px | meta 13 px muted
   8 px radius on buttons & inputs | 32 px section gaps
   Single 1 px rule between price and ATC
   ─────────────────────────────────────────────────────────────── */

.rp-summary-col .product_title {
  font-size: 1.75rem;       /* 28 px */
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.625rem;
  color: #0A0A0A;
}

.rp-summary-col .woocommerce-product-rating {
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: #767674;
}

.rp-summary-col .price {
  display: block;
  font-size: 1.375rem;      /* 22 px */
  font-weight: 700;
  color: #0A0A0A;
  letter-spacing: -0.01em;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #E4E3E0; /* single divider between price and ATC */
}

.rp-summary-col .price del {
  color: #767674;
  font-weight: 400;
  font-size: 1rem;
  margin-right: 0.375rem;
}

.rp-summary-col .price ins {
  text-decoration: none;
  color: #0A0A0A;
}

.rp-summary-col .woocommerce-product-details__short-description {
  font-size: 0.9375rem;
  color: #767674;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.rp-summary-col .product_meta {
  font-size: 0.8125rem;     /* 13 px */
  color: #767674;
  margin-top: 2rem;
  line-height: 1.8;
}

.rp-summary-col .product_meta a {
  color: #0A0A0A;
  text-decoration: none;
}

.rp-summary-col .product_meta a:hover {
  text-decoration: underline;
}

/* Remove WC table borders + grey backgrounds globally on product pages */
.single-product .woocommerce-tabs table,
.single-product .woocommerce-tabs th,
.single-product .woocommerce-tabs td {
  border: none !important;
  background: transparent !important;
}


/* ── 5. COLOUR SWATCHES ────────────────────────────────────────
   Translated from product-card.tsx (React → vanilla JS/CSS).
   rp-swatch--color: circular, background = hex value.
   rp-swatch--label: pill with text.
   Active: ring via box-shadow (matches spring-transition ring in TSX).
   Unavailable: diagonal slash via pseudo-element.
   ─────────────────────────────────────────────────────────────── */

.rp-swatch-select {
  display: none !important; /* hidden; JS syncs value on swatch click */
}

.reset_variations {
  display: inline-block;
  font-size: 0.75rem;
  color: #767674;
  text-decoration: none;
  margin-top: 0.5rem;
  transition: color 0.2s ease;
}

.reset_variations:hover { color: #0A0A0A; }

.rp-variations {
  margin-bottom: 1.5rem;
}

.rp-variation-row {
  margin-bottom: 1.5rem;
}

.rp-variation-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.rp-variation-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0A0A0A;
}

.rp-variation-selected-val {
  font-size: 0.8125rem;
  color: #767674;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.rp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Colour circle swatch */
.rp-swatch--color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  position: relative;
  transition:
    box-shadow 0.2s ease,
    transform  0.15s ease;
  background: #EEECEA; /* JS will set the real color */
  padding: 0;
  flex-shrink: 0;
}

.rp-swatch--color:hover {
  transform: scale(1.08);
}

/* Active ring — matches the motion.div border ring in colors.md */
.rp-swatch--color.is-selected {
  box-shadow:
    0 0 0 2px #F7F6F4,
    0 0 0 4px #0A0A0A;
}

/* Label pill swatch */
.rp-swatch--label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.875rem;
  border-radius: 8px;
  border: 1.5px solid #E4E3E0;
  background: #FFFFFF;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0A0A0A;
  transition:
    border-color 0.2s ease,
    background   0.2s ease;
}

.rp-swatch--label:hover {
  border-color: #0A0A0A;
}

.rp-swatch--label.is-selected {
  background: #0A0A0A;
  border-color: #0A0A0A;
  color: #F7F6F4;
}

/* Unavailable — diagonal slash */
.rp-swatch.is-unavailable {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

.rp-swatch.is-unavailable::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    transparent 45%,
    rgba(0, 0, 0, 0.55) 45%,
    rgba(0, 0, 0, 0.55) 55%,
    transparent 55%
  );
  pointer-events: none;
}


/* ── 6. QUANTITY +/− BUTTONS ───────────────────────────────────
   JS injects .rp-qty-btn buttons; CSS arranges them inline.
   ─────────────────────────────────────────────────────────────── */

.rp-summary-col .quantity,
.single_variation_wrap .quantity {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #E4E3E0;
  border-radius: 8px;
  overflow: hidden;
  background: #FFFFFF;
}

.rp-qty-btn {
  background: none;
  border: none;
  padding: 0 0.875rem;
  height: 42px;
  font-size: 1.125rem;
  font-weight: 400;
  color: #0A0A0A;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease;
  font-family: inherit;
}

.rp-qty-btn:hover { background: #F7F6F4; }
.rp-qty-btn:active { background: #E4E3E0; }

.quantity input.qty {
  width: 3rem;
  height: 42px;
  border: none;
  border-left: 1.5px solid #E4E3E0;
  border-right: 1.5px solid #E4E3E0;
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #0A0A0A;
  font-family: inherit;
  -moz-appearance: textfield;
  background: transparent;
  padding: 0;
}

.quantity input.qty::-webkit-inner-spin-button,
.quantity input.qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.quantity input.qty:focus {
  outline: none;
  background: #FAFAF9;
}


/* ── 7. ADD-TO-CART BUTTON STATES ──────────────────────────────
   Scoped to single product pages. Extends the global WC button styles.
   Loading spinner | Success green (reused from style.css pattern).
   ─────────────────────────────────────────────────────────────── */

.single-product .single_add_to_cart_button {
  border-radius: 8px !important;  /* Task 6: 8px radius */
  padding: 0.875rem 2.5rem !important;
  font-size: 0.875rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  margin-top: 1.25rem;
  transition:
    background 0.3s ease-in-out,
    color      0.3s ease-in-out,
    transform  0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* cart form + button row */
.single-product .cart {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0;
}

/* Loading spinner */
@keyframes rp-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.single-product .single_add_to_cart_button.rp-loading {
  color: transparent !important;
  pointer-events: none !important;
  position: relative;
  overflow: hidden;
}

.single-product .single_add_to_cart_button.rp-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(247, 246, 244, 0.35);
  border-top-color: #F7F6F4;
  border-radius: 50%;
  animation: rp-spin 0.65s linear infinite;
  transform: translate(-50%, -50%);
}


/* ── 8. STICKY ADD-TO-CART BAR ─────────────────────────────────
   Fixed to bottom; JS adds .is-visible via IntersectionObserver
   watching the main cart form.
   ─────────────────────────────────────────────────────────────── */

.rp-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: rgba(247, 246, 244, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #E4E3E0;
  padding: 0.75rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  pointer-events: none;
}

.rp-sticky-bar.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}

.rp-sticky-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.rp-sticky-bar-product {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  flex: 1;
}

.rp-sticky-bar-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #EEECEA;
}

.rp-sticky-bar-meta {
  min-width: 0;
}

.rp-sticky-bar-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0A0A0A;
  margin: 0 0 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-sticky-bar-price {
  font-size: 0.875rem;
  color: #767674;
  margin: 0;
  font-weight: 500;
}

.rp-sticky-bar-btn {
  flex-shrink: 0;
  background: #0A0A0A;
  color: #F7F6F4;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.2s ease,
    transform  0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rp-sticky-bar-btn:hover {
  background: #2A2A28;
  transform: translateY(-1px);
}


/* ── 9. TOAST NOTIFICATIONS (stackable) ────────────────────────
   #rp-toast-container: fixed column at bottom-right.
   Each .rp-toast slides up + fades in.
   Multiple toasts stack vertically.
   ─────────────────────────────────────────────────────────────── */

#rp-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-width: calc(100vw - 3rem);
  pointer-events: none;
}

.rp-toast {
  width: 300px;
  background: #FFFFFF;
  border: 1.5px solid #E4E3E0;
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(10, 10, 10, 0.10),
    0 2px 8px  rgba(10, 10, 10, 0.06);
  padding: 1rem;
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity   0.3s ease-in-out,
    transform 0.3s ease-in-out;
  pointer-events: auto;
  font-family: 'Plus Jakarta Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.rp-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.rp-toast-img-wrap {
  flex-shrink: 0;
}

.rp-toast-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #EEECEA;
}

.rp-toast-body {
  flex: 1;
  min-width: 0;
}

.rp-toast-status {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #16a34a;
  margin: 0 0 0.2rem;
}

.rp-toast-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0A0A0A;
  margin: 0 0 0.625rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-toast-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rp-toast-btn-cart,
.rp-toast-btn-shop {
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.rp-toast-btn-cart {
  color: #0A0A0A;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rp-toast-btn-shop {
  color: #767674;
}

.rp-toast-btn-cart:hover,
.rp-toast-btn-shop:hover { opacity: 0.7; }

.rp-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.125rem;
  line-height: 1;
  color: #767674;
  cursor: pointer;
  padding: 0;
  margin-top: -2px;
  transition: color 0.2s ease;
}

.rp-toast-close:hover { color: #0A0A0A; }


/* ── 10. TABS / RELATED PRODUCTS CLEANUP ───────────────────────
   Remove WC default table borders, grey backgrounds, dividers.
   ─────────────────────────────────────────────────────────────── */

.single-product .woocommerce-tabs {
  margin-top: 3rem;
}

.single-product .woocommerce-tabs ul.tabs {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  gap: 0;
  border-bottom: 1px solid #E4E3E0;
}

.single-product .woocommerce-tabs ul.tabs li {
  border: none;
  background: none;
  margin: 0;
}

.single-product .woocommerce-tabs ul.tabs li a {
  font-size: 0.875rem;
  font-weight: 600;
  color: #767674;
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  display: block;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.single-product .woocommerce-tabs ul.tabs li.active a,
.single-product .woocommerce-tabs ul.tabs li a:hover {
  color: #0A0A0A;
  border-bottom-color: #0A0A0A;
}

.single-product .woocommerce-tabs .panel {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: #2A2A28;
}

.single-product .woocommerce-tabs .woocommerce-product-attributes {
  width: 100%;
  border-collapse: collapse;
}

.single-product .woocommerce-tabs .woocommerce-product-attributes th,
.single-product .woocommerce-tabs .woocommerce-product-attributes td {
  padding: 0.625rem 0;
  font-size: 0.875rem;
  border: none;
  background: none;
  border-bottom: 1px solid #E4E3E0;
}

.single-product .woocommerce-tabs .woocommerce-product-attributes th {
  font-weight: 600;
  color: #0A0A0A;
  width: 40%;
}

.single-product .related.products {
  margin-top: 3.5rem;
}

.single-product .related.products h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}


/* ── 11. RESPONSIVE — stack below 768 px ───────────────────────── */

@media (max-width: 767px) {

  .rp-layout {
    flex-direction: column;
    gap: 1.5rem;
  }

  .rp-gallery-col {
    flex: none;
    max-width: 100%;
    width: 100%;
    position: static; /* un-sticky on mobile */
  }

  .rp-summary-col {
    width: 100%;
  }

  .woocommerce-product-gallery__image img {
    aspect-ratio: 4 / 3;
  }

  .flex-control-nav.flex-control-thumbs li {
    flex: 0 0 calc(20% - 0.4rem);
  }

  .rp-sticky-bar-product {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .rp-sticky-bar-name {
    font-size: 0.8125rem;
  }

  .rp-sticky-bar-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.75rem;
  }

  #rp-toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: 100%;
  }

  .rp-toast {
    width: 100%;
  }
}
