
.pps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.pps-header h2 {
  font-size: 52px;
  color: #453795;
  margin-bottom: 20px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
}

.pps-nav {
  display: flex;
  gap: 10px;
}

.pps-prev,
.pps-next {
  background: #f4f4f4;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  user-select: none;
}

/* KEY: Ensure swiper takes height */
.swiper.pps-swiper {
  height: auto;
}

.swiper-wrapper {
  display: flex;
  align-items: stretch;
}

.swiper-slide {
  display: flex;
  height: auto;
}

.pps-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.pps-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
}

/* ===== Adjusted image + card sizing (made image a bit bigger) ===== */

/* Ensure the card is a positioning context and hides overflow */
.pps-card {
  position: relative !important;
  overflow: hidden !important;
  /* збільшено мінімальну висоту, щоб картка краще вміщала більші зображення */
  min-height: 380px;
  background: #fff;
  border-radius: 20px;
  box-sizing: border-box;
}

/* The image wrapper should strictly limit the visual area */
/* Зроблено більший max-height — з 360px -> 420px */
/* Replace Product Cards — PPS Style
   Fixed: ensure image grows with card (explicit px height set by JS)
*/

/* Загальні стилі (скорочено / важливе оновлено) */
.pps-card {
  position: relative !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 560px; /* основна висота картки, змінюйте при потребі */
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 26px rgba(0,0,0,0.08);
  transition: transform .25s ease, box-shadow .25s ease;
  box-sizing: border-box;
}

/* Hover */
.pps-card:hover { transform: translateY(-6px); box-shadow: 0 10px 40px rgba(0,0,0,0.10); }

/* IMAGE WRAPPER: убрали %-висоти, будемо виставляти height в px через JS */
.pps-img-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  /* Flex: allow content below to follow image; wrapper height controlled by JS */
  flex: 0 0 auto;
  height: auto; /* JS поставить px */
  overflow: hidden !important;
  display: block !important;
  box-sizing: border-box !important;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  background: linear-gradient(180deg,#fafafa 0%, #ffffff 100%);
  position: relative; /* safety */
  z-index: 0;
}

/* Image fills wrapper */
.pps-img {
  display:block !important;
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  object-position:center center !important;
  box-sizing:border-box !important;
  transition: transform .35s ease, opacity .28s ease;
  z-index: 0;
}

/* Ensure content is above image, not overlapping */
.pps-card-content {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0; /* important for flex children scrolling */
  padding: 12px 14px !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  background: transparent;
}

/* other compact styles (colors, name, price etc.) */
.pps-colors { display:flex; gap:8px; align-items:center; margin-bottom:6px; flex-wrap:wrap; }
.pps-color { width:18px; height:18px; border-radius:50%; cursor:pointer; border:1px solid rgba(0,0,0,0.12); transition: transform .14s ease; }
.pps-color.active { box-shadow:0 0 0 2px rgba(0,0,0,0.06); transform: translateY(-1px); }

.pps-name { font-size:15px; font-weight:600; color:#222; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pps-extra-info { font-size:13px; color:#666; max-height:56px; overflow:hidden; opacity:0; transform:translateY(-6px); transition: all .35s ease; }
.pps-card:hover .pps-extra-info, .pps-card:focus-within .pps-extra-info { opacity:1; transform:none; }

.pps-footer { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:8px; padding-top:6px; }
.pps-price { font-size:15px; font-weight:700; color:#2c2479; }
.pps-cart-btn { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; }
.pps-order-btn { display:block; width:100%; padding:9px 10px; background:#00aaff; color:#fff; border-radius:8px; text-decoration:none; font-weight:700; }

/* Responsive: We'll adjust target image ratio via JS, but apply sensible min-height changes */
@media (max-width: 1024px) { .pps-card { min-height: 460px; } }
@media (max-width: 768px) { .pps-card { min-height: 420px; } }
@media (max-width: 480px) { .pps-card { min-height: 360px; } }

/* Safety: ensure theme images don't escape */
.pps-card img { max-width:100% !important; display:block !important; border-top-left-radius:20px; border-top-right-radius:20px; }

/* Optional utility classes — JS can toggle these on body or on .pps-card to change ratios */
.pps-img-ratio-large  { --pps-img-ratio: 0.75; } /* 75% */
.pps-img-ratio-medium { --pps-img-ratio: 0.65; } /* 65% */
.pps-img-ratio-small  { --pps-img-ratio: 0.55; } /* 55% */

/* On very small screens slightly reduce image max-height */
@media (max-width: 768px) {
  .pps-img-wrapper {
    max-height: 360px !important; /* was 420 on desktop */
  }
  .pps-card { min-height: 340px; }
}

@media (max-width: 480px) {
  .pps-img-wrapper {
    max-height: 300px !important; /* was 240 previously — slightly increased for balance */
  }
  .pps-card { min-height: 300px; }
}


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

.pps-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.pps-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.pps-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #ccc;
}

.pps-name {
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  color: #333;
  margin-bottom: 6px;
}

.pps-price {
  font-size: 16px;
  font-weight: 600;
  color: #2c2479;
  text-align: left;
}

.pps-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  gap: 12px;
}

/* Плавне висування додаткової інформації та кнопки */
.pps-extra-info,
.pps-order-btn-wrapper {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-10px);
  transition: all 1s ease-out; /* плавніше */
  width: 100%;
  box-sizing: border-box;
}

/* Поява при ховері */
.pps-card:hover .pps-extra-info,
.pps-card:hover .pps-order-btn-wrapper {
  opacity: 1;
  max-height: 200px; /* достатньо для контенту */
  transform: translateY(0);
}

/* Відступ для кнопки "Замовити" зверху */
.pps-order-btn-wrapper {
  margin-top: 5px;
}

.pps-order-btn {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: center;
  background: #00aaff;
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.3s;
}

.pps-cart-btn {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 44px !important;
  height: 44px !important;
  background: #fff !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
  cursor: pointer !important;
  padding: 0 !important;
}

.pps-cart-btn svg {
  width: 24px !important;
  height: 24px !important;
  stroke: #00aaff !important;
  fill: none !important;
  pointer-events: none !important;
  margin: 0 !important;
  vertical-align: middle !important;
  display: block !important;
}

.pps-extra-info {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.pps-name-wrapper:hover .pps-extra-info {
  display: block;
}

.pps-checkmark-icon svg {
  transform: translateX(12px);
  display: block;
}

/* 📱 Мобільна адаптація заголовка */
@media (max-width: 1024px) {
  .pps-header h2 {
    font-size: 40px;
  }
}

@media (max-width: 768px) {
  .pps-header h2 {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .pps-header h2 {
    font-size: 26px;
  }
}


.pps-color {
    display:inline-block;
    width:20px;
    height:20px;
    border-radius:50%;
    cursor:pointer;
    border:0.5px solid #000;
    transition:0.2s;
    margin-right:5px;
}
.pps-color.active {
    border:2px solid #000;
}




/* ===== Image containment fixes (prevent image overflow when replacing different card types) ===== */

/* Ensure the card is a positioning context and hides overflow */
.pps-card {
  position: relative !important;
  overflow: hidden !important;
  /* ensure a sensible min-height so images have space but don't overflow */
  min-height: 320px;
}

/* The image wrapper should strictly limit the visual area */
.pps-img-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 360px !important; /* safeguard: won't grow beyond this */
  overflow: hidden !important;
  display: block !important;
  box-sizing: border-box !important;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

/* Image sizing: prefer filling the wrapper but never overflow */
.pps-img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  box-sizing: border-box !important;
}

/* Extra protective rules for themes that place images outside expected wrappers */
.pps-card img {
  max-width: 100% !important;
  max-height: 100% !important;
  height: auto !important;
  object-fit: cover !important;
}

/* For list items where our card sits alongside theme markup - hide theme images inside that root */
.pps-card.closest-theme-root, li.product .pps-card, .product .pps-card {
  /* no-op selector to show intent; specific rules below */
}

/* If a theme still injects its own image outside our wrapper, force it to be contained */
li.product img, .product img, .woocommerce ul.products li img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
  display: block !important;
}

/* Make sure rounded corners clip image on older browsers */
.pps-img-wrapper img, .pps-img {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

/* Accessibility: ensure keyboard focus also reveals extra info (touch-friendly fallback) */
.pps-card:focus-within .pps-extra-info,
.pps-card:focus-within .pps-order-btn-wrapper {
  opacity: 1;
  max-height: 240px;
  transform: translateY(0);
}

/* On very small screens slightly reduce image max-height */
@media (max-width: 480px) {
  .pps-img-wrapper {
    max-height: 240px !important;
  }
  .pps-card { min-height: 300px; }
}

/* CSS fallback: ховає дублікати заголовків, залишаючи перший помічений */
.pps-card .pps-title-unique { display: block !important; }
.pps-card .pps-title, .pps-card .product-title, .pps-card h2.woocommerce-loop-product__title {
    /* видимість керується JS; за замовчуванням покажемо, але JS додасть pps-title-unique до першого */
    display: block;
}
.pps-card .pps-title:not(.pps-title-unique),
.pps-card .product-title:not(.pps-title-unique),
.pps-card h2.woocommerce-loop-product__title:not(.pps-title-unique) {
    display: none !important;
}

/* Ховає блок із заголовком/ціною (всі екземпляри) */
.astra-shop-summary-wrap {
  display: none !important;
}
