/* Product detail UI contract
   - Naming neutro (ks-*)
   - Regole scoped
*/

.ks-product-page .ks-product-gallery-main {
  border-radius: 6px;
  overflow: hidden;
  background: #f4f4f4;
  aspect-ratio: 1 / 1;
}

.ks-product-page .ks-product-main-section {
  padding-top: 0;
  padding-bottom: 0;
}

.ks-product-page .ks-product-gallery-main .swiper-wrapper,
.ks-product-page .ks-product-gallery-main .swiper-slide,
.ks-product-page .ks-product-gallery-main .item {
  height: 100%;
}

.ks-product-page .ks-product-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ks-product-page .ks-product-gallery-main .swiper-button-prev,
.ks-product-page .ks-product-gallery-main .swiper-button-next {
  /* lasciamo al tema le icone; qui solo UX */
  opacity: 0.95;
}

.ks-product-page .ks-product-gallery-thumbs .swiper-slide {
  opacity: 0.7;
  cursor: pointer;
}

.ks-product-page .ks-product-gallery-thumbs .swiper-slide-thumb-active {
  opacity: 1;
}

.ks-product-thumb {
  width: 100%;
  height: 84px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  display: block;
}

/* Buy box sticky su desktop */
@media (min-width: 992px) {
  .ks-product-buy {
    position: sticky;
    top: 90px;
  }
}

/* Prezzo: fallback robusto (non dipende dai nomi classe del VB) */
.ks-product-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.ks-product-price .price,
.ks-product-price .new-price,
.ks-product-price ins {
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
}

.ks-product-price .old-price,
.ks-product-price del,
.ks-product-price s,
.ks-product-price strike {
  opacity: 0.65;
  text-decoration: line-through;
}

.ks-product-meta li + li {
  margin-top: 0.5rem;
}

/* Quantità */
.ks-qty-stepper {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.ks-qty-stepper .ks-qty-btn {
  width: 44px;
}

.ks-qty-stepper .ks-qty-input {
  flex: 1;
  min-width: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

/* Descrizione lunga: evita overflow immagini/tabelle */
.ks-product-description img,
.ks-product-description table {
  max-width: 100%;
}

.ks-product-description {
  overflow-wrap: anywhere;
}

.ks-product-description table {
  display: block;
  overflow-x: auto;
}

/* Card correlati */
.ks-product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ks-product-page .tf-product-info-list {
  align-items: flex-start;
}

.ks-product-page .tf-product-info-content {
  flex: 1 1 auto;
  min-width: 0;
}

.ks-product-page .ks-product-buy {
  flex: 0 0 min(340px, 100%);
  max-width: 340px;
  background: #fff;
}

.ks-product-page .product-info-name {
  overflow-wrap: anywhere;
}

.ks-product-page .product-info-rate-wrap,
.ks-product-page .product-fearture-list {
  flex-wrap: wrap;
}

.ks-product-page .product-box-btn .tf-btn,
.ks-product-page .product-box-btn input.tf-btn {
  width: 100%;
}

.ks-product-page .wg-quantity {
  max-width: 180px;
}

.ks-product-page .wg-quantity input {
  text-align: center;
}

.ks-product-relation-section {
  padding-top: 32px;
  padding-bottom: 26px;
}

.ks-product-relation-section .flat-title {
  margin-bottom: 18px;
}

.ks-product-relation-section .tf-grid-layout {
  column-gap: 18px;
  row-gap: 26px;
}

.ks-product-relation-section .card-product {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ks-product-relation-section .card-product-wrapper,
.ks-product-relation-section .product-img {
  aspect-ratio: 1 / 1;
  background: #f4f4f4;
  border-radius: 4px;
}

.ks-product-relation-section .card-product-info {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.ks-product-relation-section .box-title {
  display: grid;
  gap: 8px;
}

.ks-product-relation-section .name-product {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.ks-product-relation-section .box-infor-detail {
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ks-product-relation-section .list-infor-fearture {
  display: grid;
  gap: 4px;
}

.ks-product-relation-section .list-infor-fearture li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ks-product-relation-section .list-infor-fearture p {
  margin: 0;
}

.ks-product-relation-section .card-product-btn {
  padding-top: 12px;
  margin-top: auto;
}

.ks-product-page .product-detail .body-text-3 span {
  display: block;
}

@media (max-width: 1199.98px) {
  .ks-product-page .tf-product-info-list {
    flex-direction: column;
  }

  .ks-product-page .ks-product-buy {
    width: 100%;
    max-width: none;
    position: static;
  }
}

@media (max-width: 767.98px) {
  .ks-product-page .tf-sp-2,
  .ks-product-page .tf-sp-4,
  .ks-product-relation-section {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .ks-product-page .tf-product-media-wrap {
    position: static !important;
    margin-bottom: 18px;
  }

  .ks-product-page .ks-product-gallery-main {
    border-radius: 8px;
  }

  .ks-product-thumb {
    height: 64px;
    border-radius: 8px;
  }

  .ks-product-page .product-info-name {
    font-size: 24px;
    line-height: 1.18;
  }

  .ks-product-price .price,
  .ks-product-price .new-price,
  .ks-product-price ins {
    font-size: 1.35rem;
  }

  .ks-product-page .infor-center,
  .ks-product-page .infor-bottom {
    gap: 14px;
  }

  .ks-product-page .ks-product-buy {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 14px;
  }

  .ks-product-page .product-box-btn {
    grid-template-columns: 1fr;
  }

  .ks-product-page .flat-title-tab .menu-tab-line {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .ks-product-relation-section .tf-grid-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 20px;
  }

  .ks-product-relation-section .tf-section-heading .heading {
    font-size: 20px;
    line-height: 1.2;
  }
}

@media (max-width: 420px) {
  .ks-product-relation-section .tf-grid-layout {
    grid-template-columns: 1fr;
  }

  .ks-product-relation-section .card-product {
    max-width: 330px;
    margin-inline: auto;
  }
}
