/* Hide WC-generated DOM elements that conflict with our custom layout */
.odonata-variations-wrapper > form,
.storefront-sticky-add-to-cart,
.woocommerce-product-gallery,
.woocommerce-tabs,
.related.products,
.up-sells,
.woocommerce-breadcrumb,
.product_meta {
  display: none !important;
}

/* Active pill — matches React: border-primary bg-primary/5 text-primary */
.odonata-pill.active {
  background-color: hsl(var(--primary) / 0.05);
  color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.odonata-accordion-item > summary {
  list-style: none;
}
.odonata-accordion-item > summary::-webkit-details-marker,
.odonata-accordion-item > summary::marker {
  display: none;
  content: "";
}
.odonata-accordion-item[open] > summary .odonata-accordion-chevron {
  transform: rotate(180deg);
}

/* YITH Wishlist Button — Single Product Page */
/* Show as inline text link matching React: flex items-center gap-1.5 text-sm text-muted-foreground */
body.single-product .yith-wcwl-add-to-wishlist {
  margin: 0;
  padding: 0;
  display: inline-flex;
}

body.single-product .yith-wcwl-add-to-wishlist-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--odonata-muted-foreground);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
  width: auto;
  height: auto;
  border-radius: 0;
}

body.single-product .yith-wcwl-add-to-wishlist-button:hover {
  color: var(--odonata-foreground);
  background: transparent;
}

body.single-product .yith-wcwl-add-to-wishlist-button__label {
  display: inline;
}

body.single-product .yith-wcwl-icon {
  width: 1rem;
  height: 1rem;
  color: inherit;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5px;
}

body.single-product .yith-wcwl-add-to-wishlist-button--added .yith-wcwl-icon,
body.single-product .yith-wcwl-add-to-wishlist-button--exists .yith-wcwl-icon {
  color: var(--odonata-destructive);
  fill: var(--odonata-destructive);
}

/* Thumbnail scrollbar hide (rail is height-capped to the main image + scrolls internally) */
.odonata-thumb-track::-webkit-scrollbar,
.odonata-thumb-rail::-webkit-scrollbar {
  display: none;
}
.odonata-thumb-rail {
  scrollbar-width: none;
}

/* Force square corners on product gallery (override parent storefront / WC core) */
body.single-product .odonata-thumb,
body.single-product .odonata-thumb img,
body.single-product .odonata-thumb-rail,
body.single-product .odonata-image-carousel,
body.single-product .odonata-image-carousel img {
  border-radius: 0 !important;
}

.odonata-featured-banner {
  max-width: 480px;
}

.odonata-product-grid {
  display: grid;
  /* minmax(0,1fr), NOT 1fr: a bare 1fr track is min-width:auto, so the gallery
     carousel's intrinsic width blows the column past the viewport and clips the
     color-option pills off the right edge on mobile. minmax(0,...) lets the track
     shrink below content. Do NOT simplify back to 1fr — it reintroduces the overflow. */
  grid-template-columns: minmax(0, 1fr);
}
/* Mobile read order (client spec): photo → swatches → title → certificate logos.
   'gallery' first, then 'info'. The title is the first child of 'info', but the
   swatch strip (pulled up via max-md:order-[-1]) floats above it, so the mobile
   read order inside 'info' is swatches → title → short-desc (cert badges live at
   the top of the short description). Image height is intentionally NOT capped. */
.odonata-product-grid.odonata-grid-with-fbt {
  grid-template-areas: "gallery" "info" "accordion" "fbt";
}
.odonata-product-grid.odonata-grid-no-fbt {
  grid-template-areas: "gallery" "info" "accordion";
}

@media (min-width: 768px) {
  .odonata-product-grid {
    /* Column also holds a 72px thumb rail + gap, so column% ≠ image%.
       50fr ≈ 590px main image at 1440 (smaller per client; was 58fr ≈ 686px). */
    grid-template-columns: 50fr 50fr;
  }
  .odonata-product-grid.odonata-grid-with-fbt {
    grid-template-areas:
      "gallery info"
      "accordion accordion"
      "fbt fbt";
  }
  .odonata-product-grid.odonata-grid-no-fbt {
    grid-template-areas:
      "gallery info"
      "accordion accordion";
  }
  /* Gallery spans 2 rows on desktop; pin it to the top so the image keeps its
     natural aspect height instead of stretching to match a tall info column. */
  .odonata-product-grid [style*="grid-area: gallery"] {
    align-self: start;
  }
}

/* Short description: paragraphs containing only images (badge row) → flex inline */
.odo-short-desc p:has(img) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
}
.odo-short-desc p:has(img) img {
  display: block;
  margin: 0;
  max-height: 60px;
  width: auto;
}
.odo-short-desc p:has(img) a {
  display: inline-flex;
  align-items: center;
}
.odo-short-desc p:has(img) strong {
  display: contents;
}

/* Sale price: ins = red sale price, del = muted strikethrough original */
.summary .price ins {
  background: transparent;
  text-decoration: none;
  color: hsl(var(--destructive));
}
.summary .price del {
  color: hsl(var(--muted-foreground));
  opacity: 1;
}

/* Review Bottom Sheet — spring-like animation */
#odonata-review-overlay {
  opacity: 0;
  transition: opacity 0.3s ease;
}

#odonata-review-sheet {
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.odonata-review-pill.is-active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* slide display:flex is load-bearing: it lets the card h-full fill the stretched
   slide so mt-auto pins every buy button to one baseline. Without it, cards
   missing the conditional rating row sit shorter and the button floats up. */
.odonata-recs-swiper .swiper-wrapper {
  align-items: stretch;
}
.odonata-recs-swiper .swiper-slide {
  height: auto;
  display: flex;
}
.odonata-recs-swiper .swiper-slide > * {
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Back-in-stock notifier (CWG plugin form) — restyle the plugin's
   bootstrap-panel markup to match the theme (plugin CSS not loaded). */
.cwginstock-subscribe-form {
  display: block;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius, 0.5rem);
  background-color: hsl(var(--muted) / 0.4);
  padding: 1rem 1.25rem 1.25rem;
}
.odonata-stock-status .cwginstock-subscribe-form { margin-top: 0.25rem; }
.odonata-stock-status > p.stock { margin: 0 0 0.5rem; font-size: 0.875rem; color: hsl(var(--muted-foreground)); }
.cwginstock-panel-heading h4 {
  font-weight: 600;
  font-size: 1rem;
  color: hsl(var(--foreground));
  margin: 0 0 0.75rem;
}
.cwginstock-subscribe-form .form-group { margin-bottom: 0.75rem; }
.cwginstock-subscribe-form .form-group:last-of-type { margin-bottom: 0; }
.cwginstock-subscribe-form input[type="text"],
.cwginstock-subscribe-form input[type="email"],
.cwginstock-subscribe-form input[type="tel"] {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  text-align: left !important; /* plugin inlines text-align:center */
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}
.cwginstock-subscribe-form input[type="text"]:focus,
.cwginstock-subscribe-form input[type="email"]:focus {
  outline: 2px solid hsl(var(--primary) / 0.4);
  outline-offset: 0;
  border-color: hsl(var(--primary));
}
.cwginstock-subscribe-form .cwgstock_button {
  width: 100%;
  height: 3rem;
  border: 0;
  border-radius: 0.5rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cwginstock-subscribe-form .cwgstock_button:hover { opacity: 0.9; }
.cwginstock-subscribe-form .cwgstock_output { font-size: 0.875rem; margin-top: 0.5rem; color: hsl(var(--foreground)); }
.cwginstock-subscribe-form .cwgstock_output:empty { display: none; }

/* Popup-mode trigger button (variations) — injected via availability_html into
   .odonata-stock-status; opens the CWG sweetalert popup with the subscribe form. */
.odonata-stock-status .cwg_popup_submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 0.5rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.odonata-stock-status .cwg_popup_submit:hover { opacity: 0.9; }
