/* ═══════════════════════════════════════════════════════════════════════════
   BOOK DETAIL — Hero image, content sheet, sticky CTA
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hide default Blocksy/WC single product wrapper spacing ── */
.single-product .site-main > .product {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}

/* Hide Blocksy default WC product gallery (we use our own hero) */
.single-product .woocommerce-product-gallery {
  display: none;
}

/* Reset entry-summary layout — our hooks render inside it */
.single-product .entry-summary {
  float: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Hide default WC elements inside entry-summary that we've replaced */
.single-product .entry-summary .product_title.entry-title,
.single-product .entry-summary .woocommerce-product-rating,
.single-product .entry-summary .woocommerce-product-details__short-description,
.single-product .entry-summary p.price,
.single-product .entry-summary form.cart,
.single-product .entry-summary .product_meta {
  display: none !important;
}

/* ── Body padding for sticky CTA + bottom nav ── */
body.single-product {
  padding-bottom: calc(72px + 64px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1024px) {
  body.single-product {
    padding-bottom: 0;
  }
}

/* ── Hero Image ── */
.kx-product-hero {
  position: relative;
  width: 100%;
  min-height: 45vh;
  overflow: hidden;
  background-color: var(--kx-image-placeholder);
}

.kx-product-hero__img {
  width: 100%;
  height: 100%;
  min-height: 45vh;
  object-fit: cover;
  display: block;
}

/* Back button */
.kx-product-hero__back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kx-text-primary);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}

.kx-product-hero__back:active {
  transform: scale(0.95);
}

/* Bookmark on hero */
.kx-product-hero__bookmark {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Image Gallery ── */
.kx-product-gallery {
  position: relative;
  width: 100%;
  height: 45vh;
  overflow: hidden;
}

.kx-product-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kx-product-gallery__dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.kx-product-gallery__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 200ms ease;
}

.kx-product-gallery__dot--active {
  background-color: #FFFFFF;
}

/* ── Content Sheet ── */
.kx-product-sheet {
  background-color: var(--kx-surface);
  border-radius: var(--kx-radius-sheet) var(--kx-radius-sheet) 0 0;
  margin-top: -20px;
  position: relative;
  z-index: 1;
  padding: 24px var(--kx-page-padding) 40px;
}

/* ── Title & Author ── */
.kx-product__title {
  font-family: var(--kx-font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--kx-text-primary);
  margin: 0;
}

.kx-product__author {
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-title);
  font-weight: 400;
  color: var(--kx-text-secondary);
  margin: 4px 0 0;
}

/* ── Condition ── */
.kx-product__condition {
  margin-top: 12px;
}

.kx-product__condition .kx-condition-badge {
  font-size: var(--kx-fs-label);
  padding: 6px 14px;
}

/* ── Price ── */
.kx-product__price {
  font-family: var(--kx-font-body);
  font-size: 20px;
  font-weight: 700;
  color: var(--kx-accent);
  margin-top: 12px;
}

.kx-product__price .woocommerce-Price-amount,
.kx-product__price .amount {
  color: var(--kx-accent);
  font-weight: 700;
  font-size: 20px;
}

/* ── Description ── */
.kx-product__description {
  margin-top: 16px;
  border-top: 1px solid var(--kx-border);
  padding-top: 16px;
}

.kx-product__description-text {
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-body);
  line-height: 1.6;
  color: var(--kx-text-primary);
}

.kx-product__description-text--clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kx-product__description-toggle {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-label);
  font-weight: 600;
  color: var(--kx-accent);
  cursor: pointer;
}

/* ── Seller Info ── */
.kx-product__seller {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  background-color: var(--kx-bg);
  border-radius: var(--kx-radius-input);
}

.kx-product__seller-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background-color: var(--kx-accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--kx-font-body);
  font-weight: 600;
  font-size: 16px;
}

.kx-product__seller-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.kx-product__seller-name {
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-body);
  font-weight: 600;
  color: var(--kx-text-primary);
}

.kx-product__seller-city {
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-caption);
  color: var(--kx-text-secondary);
}

.kx-product__seller-rating {
  font-family: var(--kx-font-body);
  font-size: var(--kx-fs-label);
  color: var(--kx-star);
  white-space: nowrap;
}

/* ── Sticky CTA Bar ── */
.kx-sticky-cta {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  padding: 12px var(--kx-page-padding);
  background-color: var(--kx-surface);
  border-top: 1px solid var(--kx-border);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.kx-sticky-cta__price {
  font-family: var(--kx-font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--kx-accent);
  white-space: nowrap;
}

.kx-sticky-cta__price .woocommerce-Price-amount,
.kx-sticky-cta__price .amount {
  color: var(--kx-accent);
  font-weight: 700;
  font-size: 18px;
}

.kx-sticky-cta__button {
  flex: 1;
  text-align: center;
  height: 48px;
}

/* ── Desktop: Two-column layout ── */
@media (min-width: 1024px) {
  .single-product .site-main > .product {
    display: flex;
    flex-wrap: wrap;
    max-width: var(--kx-content-max-width) !important;
    margin: 0 auto !important;
    padding: 24px 40px !important;
    gap: 40px;
  }

  .kx-product-hero {
    flex: 0 0 50%;
    max-width: 50%;
    min-height: auto;
    height: auto;
    border-radius: var(--kx-radius-card);
    overflow: hidden;
  }

  .kx-product-hero__img,
  .kx-product-gallery {
    min-height: 500px;
    height: auto;
  }

  .kx-product-sheet {
    flex: 1;
    min-width: 0;
    margin-top: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
  }

  .kx-sticky-cta {
    position: static;
    padding: 24px 0 0;
    border-top: 1px solid var(--kx-border);
    margin-top: 24px;
  }

  body.single-product {
    padding-bottom: 0;
  }
}
