/* --- ProductDetail.css --- */
.product-page {
  width: 100%;
  margin: 0;
  overflow-x: clip;
  padding: 0 var(--so-page-gutter, 12px);
  background: #ffffff;
}

.product-detail {
  padding: 0;
}

.product-detail-breadcrumbs {
  margin-bottom: 0;
}

.product-detail--rich {
  background: #fff;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.product-detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.product-detail-gallery-column {
  min-width: 0;
  display: flex;
  justify-content: center;
}

.product-detail-gallery-column .gallery-root {
  width: 100%;
  max-width: 520px;
}

.product-detail-info-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-detail-brand {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #111;
  text-decoration: none;
  opacity: 0.78;
}

.product-detail-brand:hover {
  opacity: 1;
}

.product-detail-heading h1 {
  margin: 6px 0 0;
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.12;
}

.product-detail-price {
  font-size: 20px;
  font-weight: 700;
}
.product-detail-store {
  display: inline-block;
  font-size: 12px;
  color: #777;
}
.product-detail-prices {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.product-detail-price-old {
  text-decoration: line-through;
  color: #888;
}
.product-detail-price-badge {
  background: #f5f5f5;
  padding: 2px 8px;
  font-size: 12px;
}
.product-detail-shipping {
  font-size: 13px;
  color: #333;
}
.product-detail-variants ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-detail-variants li {
  font-size: 14px;
  border-bottom: 1px dashed #ddd;
  padding-bottom: 8px;
}
.product-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-detail-wishlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.product-detail-wishlist-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-detail-wishlist-text {
  display: inline-flex;
  align-items: center;
}

.product-detail-wishlist:hover .product-detail-wishlist-icon,
.product-detail-wishlist:focus-visible .product-detail-wishlist-icon {
  opacity: 1;
}

.product-detail-wishlist:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-detail-wishlist[data-wishlist-active="true"] {
  background: #111;
  color: #fff;
}

.product-detail-wishlist[data-wishlist-active="true"] .product-detail-wishlist-icon {
  filter: invert(1);
  opacity: 1;
}

.product-detail-offers-summary {
  display: inline-flex;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #174aa3;
  text-decoration: none;
}

.product-detail-offers-summary:hover {
  text-decoration: underline;
}

.product-detail-extra {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.product-detail-sizes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.product-size-badge {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid #dcdcdc;
}

@media (max-width: 900px) {
  .product-detail-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .product-detail--rich {
    padding: 0;
  }
}

@supports not (overflow: clip) {
  .product-page {
    overflow-x: hidden;
  }
}

/* --- ProductDetailImageGallery.css --- */
.gallery-root {
  display: grid;
  gap: 10px;
}
.gallery-main {
  position: relative;
  background: #fff;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
  overflow: hidden;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.gallery-nav--prev {
  left: 10px;
}
.gallery-nav--next {
  right: 10px;
}

.gallery-nav:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.98);
}

.gallery-main [data-gallery-image] {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #fff;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0;
  outline: 0;
}

.gallery-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  color: #6b7280;
  background: #f3f4f6;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.gallery-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #111;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
}

.gallery-thumbs-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto; /* center when the thumbs fit, left-align when they overflow */
}

.gallery-thumbs .thumb {
  border: 1px solid #dcdcdc;
  background: #fff;
  padding: 0;
  flex: 0 0 auto;
}
.gallery-thumbs .thumb.is-active {
  border-color: #111;
}
.gallery-thumbs .thumb img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  display: block;
  background: #fff;
}

@media (max-width: 520px) {
  .gallery-nav {
    width: 40px;
    height: 40px;
  }
  .gallery-nav--prev {
    left: 8px;
  }
  .gallery-nav--next {
    right: 8px;
  }
  .gallery-thumbs .thumb img {
    width: 62px;
    height: 62px;
  }
}

/* --- ProductOffers.css --- */
.product-offers-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 18px;
}

.offers-title {
  font-size: 1rem;
  color: #171717;
  text-align: left;
  margin-bottom: 2px;
  font-weight: 600;
}

.product-offers-table {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.offer-row {
  display: flex;
  flex-direction: column;
  background: #f1f3f4;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  padding: 5px 5px 5px 5px;
  font-size: 0.87rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  gap: 6px;
}

.offer-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.offer-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #293149;
  font-size: 1em;
  margin-bottom: 2px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.offer-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.offer-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.offer-store {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offer-center {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: center;
  margin-bottom: 10px;
  width: 100%;
}

.offer-prezzo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.offer-discounted {
  color: #cf2121;
  font-weight: 700;
  order: 1;
}

.offer-original {
  text-decoration: line-through;
  color: #7b7b7b;
  font-size: 0.97em;
  order: 2;
}

.offer-final {
  color: #222;
  font-weight: 700;
  font-size: 1.09em;
}

.offer-disp {
  color: #219150;
  font-weight: 500;
  font-size: 0.98em;
}

.offer-disp.non-disponibile {
  color: #cf2121;
}

/* ------------------------------ Popup ------------------------------ */

.offers-popup {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  padding: 12px;
}

.offers-popup.is-open {
  display: grid;
}

.offers-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.offers-popup-panel {
  position: relative;
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.offers-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.offers-popup-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #111;
}

.offers-popup-close {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.offers-popup-close:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.offers-popup-body {
  padding: 12px;
  overflow: auto;
}

.offers-popup-body .product-offers-container {
  margin-top: 0;
}

@media (min-width: 801px) {
  .product-offers-table {
    gap: 0.65rem;
  }
  .offer-row-main {
    flex-direction: row;
    align-items: center;
    gap: 0;
    width: 100%;
    display: flex;
  }
  .offer-top {
    margin-bottom: 0;
    min-width: 180px;
    max-width: 240px;
    text-align: left;
    font-size: 1em;
    display: flex;
    align-items: center;
    flex: 1 1 24%;
  }
  .offer-center {
    margin-bottom: 0;
    gap: 24px;
    min-width: 220px;
    display: flex;
    align-items: center;
    flex: 1 1 46%;
  }
  .offer-prezzo {
    min-width: 120px;
    flex: 1 1 50%;
  }
  .offer-disp {
    min-width: 120px;
    flex: 1 1 40%;
    text-align: left;
  }
  .offer-bottom {
    margin-top: 0;
    width: auto;
    justify-content: flex-end;
    align-items: center;
    flex: 1 1 22%;
  }
  .offer-bottom a,
  .offer-bottom button,
  .offer-bottom span {
    width: 100%;
    min-width: 130px;
    font-size: 1em;
    padding: 9px 18px;
  }
}

/* --- ProductInformation.css --- */
/* Ported from CRA ProductInformation.css (SSR version) */

.product-information {
  margin-top: 10px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
}

.product-information-header {
  margin-bottom: 6px;
}

.product-information-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.product-information-subtitle {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: #6b7280;
}

.product-information-body {
  display: flex;
  flex-direction: column;
}

details.product-information-section {
  border-top: 1px solid #e5e7eb;
  background-color: transparent;
}

details.product-information-section:last-of-type {
  border-bottom: none;
}

.product-information-section-header {
  width: 100%;
  padding: 6px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.product-information-section-header::-webkit-details-marker {
  display: none;
}

.product-information-section-header:hover {
  background-color: #f9fafb;
}

.product-information-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.product-information-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.product-information-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

details.product-information-section[open] .product-information-chevron {
  transform: rotate(180deg);
}

.product-information-section-content {
  padding-top: 4px;
  padding-bottom: 8px;
  border-top: 1px solid #f3f4f6;
}

.product-information-section-description {
  margin: 4px 0 6px 0;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
}

.product-information-meta-update {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: #9ca3af;
}

.product-information-meta-update::before {
  content: attr(data-text);
}

.product-information-attribute-grid {
  display: grid;
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 4px;
  margin: 0;
}

.product-information-attribute-row {
  display: contents;
}

.product-information-attribute-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  padding-top: 3px;
}

.product-information-attribute-values {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.product-information-attribute-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
}

details.product-information-section[open] .product-information-attribute-pill {
  animation: product-information-pill-in 0.18s ease-out;
}

@keyframes product-information-pill-in {
  from {
    transform: translateY(2px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .product-information {
    margin-top: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .product-information-attribute-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
  }

  .product-information-attribute-label {
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-information-section-header,
  .product-information-chevron,
  .product-information-attribute-pill {
    transition: none !important;
    animation: none !important;
  }
}

/* --- ProductSizesSummary.css --- */
/* ProductSizesSummary (SSR) */

.sizes-summary {
  width: 100%;
  padding: 14px 0;
  color: #111;
}

.sizes-summary-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #111;
}

.sizes-summary-count {
  font-weight: 700;
  letter-spacing: 0;
  color: rgba(17, 17, 17, 0.62);
}

.sizes-chip-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.sizes-chip-item {
  display: inline-flex;
}

.sizes-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 44px;
  padding: 6px 12px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  background: #ffffff;
  color: #111;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sizes-chip:hover {
  background: rgba(17, 17, 17, 0.06);
  border-color: rgba(17, 17, 17, 0.28);
}

.sizes-chip:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.55);
  outline-offset: 2px;
}

.sizes-chip:active {
  transform: translateY(1px);
}

.sizes-chip[aria-disabled='true'] {
  cursor: default;
  opacity: 0.55;
}

/* Progressive disclosure via <details>/<summary> (no JS). */
.sizes-more {
  margin-top: 10px;
}

.sizes-more > summary {
  list-style: none;
}

.sizes-more > summary::-webkit-details-marker {
  display: none;
}

.sizes-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  background: rgba(17, 17, 17, 0.03);
  color: #111;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sizes-more-toggle:hover {
  background: rgba(17, 17, 17, 0.06);
  border-color: rgba(17, 17, 17, 0.28);
}

.sizes-more-toggle:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.55);
  outline-offset: 2px;
}

.sizes-more-hide {
  display: none;
}

.sizes-more[open] .sizes-more-show {
  display: none;
}

.sizes-more[open] .sizes-more-hide {
  display: inline;
}

.sizes-more-icon {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-left: 2px;
}

.sizes-more[open] .sizes-more-icon {
  transform: rotate(-135deg);
}

.sizes-chip-list-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(17, 17, 17, 0.12);
}

@media (min-width: 768px) {
  .sizes-chip-list {
    gap: 10px;
  }

  .sizes-chip {
    min-height: 36px;
    padding: 7px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sizes-chip,
  .sizes-more-toggle,
  .sizes-more-icon {
    transition: none;
  }
}

/* --- ProductDescription.css --- */
.product-description {
  font-size: 14px;
  line-height: 1.6;
  margin-top: 10px;
}

/* --- ProductShipping.css --- */
/* Ported from CRA ProductShipping.css (SSR version) */

.product-shipping {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  color: #4b5563;
}

.product-shipping-value {
  font-weight: 400;
}

.product-shipping-value.is-free {
  font-weight: 500;
  color: #166534;
}

.product-shipping--compact {
  margin-top: 2px;
  font-size: 11px;
}

.product-shipping--compact .product-shipping-value {
  font-weight: 400;
}

/* --- Grid.css --- */
.product-grid {
  display: grid;
  /* Desktop wide: 6 columns, then scale down by breakpoint. */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

@media (max-width: 1800px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1500px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Mobile/tablet small: keep 2 columns and compact gap. */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Listing page: hard override for responsive scale (2 -> 7 columns). */
.listing-page-grid .listing-product-grid,
.listing-page-grid .product-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}

@media (min-width: 900px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1200px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1440px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1680px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1920px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}

/* Allow grid items to shrink even with long unbreakable strings inside. */
.product-grid > * {
  min-width: 0;
}
.state {
  text-align: center;
  color: #666;
}

/* --- Item.css --- */
.product-item {
  /* Keep every card the same size in grid + carousels */
  --so-card-h: 500px;
  --so-card-media-h: 320px;
  width: 100%;
  min-width: 0;
  background-color: #fff;
  border-radius: 0;
  border: 1px solid #ededed;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Use min-height to avoid clipping details (esp. price) if content grows. */
  min-height: var(--so-card-h);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.12);
}

@media (max-width: 1200px) {
  .product-item {
    --so-card-h: 470px;
    --so-card-media-h: 290px;
  }
}

@media (max-width: 768px) {
  .product-item {
    /* Mobile 2-col grid needs a bit more vertical room for title/store + price. */
    --so-card-h: 410px;
    --so-card-media-h: 230px;
  }
}
.product-item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
}
.product-item-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: inherit;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}
.product-item-media {
  position: relative;
  overflow: hidden;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
  height: var(--so-card-media-h);
  flex: 0 0 var(--so-card-media-h);
  min-width: 0;
}

/* Listing cards: use all available media area without cropping the image. */
.product-item-media .product-card-image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}
.product-item-image--placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #777;
  background: #f0f0f0;
}
.product-item .badge.badge-top-left {
  left: 10px;
}
.product-item .badge.badge-top-right {
  right: 10px;
}
.product-item .badge.badge-top-right.badge-avoid-wishlist {
  right: 54px;
}
.product-item .badge.badge-bottom-left {
  left: 10px;
}
.product-item .badge.badge-bottom-right {
  right: 10px;
}
.product-item .badge {
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-item-details-link {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
}

.product-item-share-button {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.product-item-share-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-share-button:hover .product-item-share-icon,
.product-item-share-button:focus-visible .product-item-share-icon {
  opacity: 1;
}

.product-item-share-button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-item-wishlist-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.product-item-wishlist-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-wishlist-button:hover .product-item-wishlist-icon,
.product-item-wishlist-button:focus-visible .product-item-wishlist-icon {
  opacity: 1;
}

.product-item-wishlist-button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-item-wishlist-button[data-wishlist-active="true"] {
  /* Keep the button surface unchanged: only the heart icon changes when active. */
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(17, 17, 17, 0.12);
}

.product-item-wishlist-button[data-wishlist-active="true"] .product-item-wishlist-icon {
  /* Tint the SVG <img> to red when active (heart-fill.svg is swapped by JS). */
  filter: brightness(0) saturate(100%) invert(17%) sepia(92%) saturate(5855%)
    hue-rotate(352deg) brightness(98%) contrast(112%);
  opacity: 1;
}

.product-item-details-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-details-link:hover .product-item-details-icon,
.product-item-details-link:focus-visible .product-item-details-icon {
  opacity: 1;
}

.product-item-details-link:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}
.product-item-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 10px 12px;
  margin-top: auto;
  /* Ensure the price row is visible (brand/title/store/sizes/shipping/price). */
  min-height: 170px;
  flex: 1;
  overflow: visible;
  min-width: 0;
}

/* Keep the price pinned to the bottom of the card body. */
.product-item-body .price-container {
  margin-top: auto;
  padding-top: 4px;
}

/* Allow inner links/buttons in the BODY to be clickable above the overlay link. */
.product-item-body a,
.product-item-body button {
  position: relative;
  z-index: 3;
}

@media (max-width: 768px) {
  .product-item-body {
    padding: 8px 8px 10px;
    min-height: 152px;
  }
}
.product-item-brand {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin: 0;
}
.product-item-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  /* Prevent long titles from pushing the price out of view on fixed-height cards. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  /* NOTE: `line-clamp` is not widely supported yet; keep vendor prefix for WebKit. */
  line-clamp: 2;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.product-item-store {
  font-size: 12px;
  color: #777;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-item-sizes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.product-size-badge,
.product-size-more {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #e0e0e0;
}
.product-item-shipping {
  font-size: 12px;
  color: #333;
}
.product-item-price {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.product-item-price .old {
  text-decoration: line-through;
  color: #888;
}
.product-item-actions {
  margin-top: 6px;
}

/* --- Badge.css --- */
.badge {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  background-color: #e60023;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* Tipologie di Badge */
/* Keep contrast >= 4.5:1 (WCAG AA) for small text. */
.badge-discount { background-color: #b00020; } /* white text on dark red */
.badge-new { background-color: #0b7a22; } /* white text on dark green */
.badge-bestseller { background-color: #f59e0b; color: #111827; }
.badge-limited { background-color: #6d28d9; }
.badge-exclusive { background-color: #1e3a8a; }
.badge-official { background-color: #0b7a22; }
.badge-hot { background-color: #b45309; }
.badge-default { background-color: #4b5563; }

.badge-primary { background: #e8edff; color: #1d4ed8; border-color: #cbdafe; }
.badge-success { background: #e8f7e8; color: #167a1c; border-color: #bfe6c1; }
.badge-warning { background: #fcac00; color: #030303; border-color: #fde68a; }
.badge-info { background: #ecfeff; color: #0369a1; border-color: #bae6fd; }
.badge-count { background: #efefef; color: #111827; border-color: #e5e7eb; }

/* Posizioni */
.badge-top-left { top: 10px; left: 0; border-radius: 0 5px 5px 0; }
.badge-bottom-left { bottom: 10px; left: 0; border-radius: 0 5px 5px 0; }
.badge-top-right { top: 10px; right: 0; border-radius: 5px 0 0 5px; }
.badge-bottom-right { bottom: 10px; right: 0; border-radius: 5px 0 0 5px; }
.badge-center { top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 8px; }

/* --- BrandLabel.css --- */
.brand-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
  width: 100%;
  min-height: 28px;
  text-align: left;
  min-width: 0;
}

.brand-label--center {
  justify-content: center;
  text-align: center;
}

.brand-label--left {
  justify-content: flex-start;
  text-align: left;
}

.brand-label--right {
  justify-content: flex-end;
  text-align: right;
}

.brand-label-link,
.brand-label .brand-label-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  justify-content: flex-start;
  min-height: 28px;
  width: 100%;
  overflow: hidden;
  min-width: 0;
}

.brand-label-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 50px;
}

.brand-label-logo {
  height: 22px;     /* compatto: perfetto per card/griglie */
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.brand-label-text {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* helper accessibilità */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* --- MerchantStore.css --- */
.merchant-store {
  margin-top: 14px;
  border: 1px solid #e6e6e6;
  background: #fff;
  padding: 14px;
}

.merchant-store-head {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.merchant-store-logo {
  width: 54px;
  height: 54px;
  border: 1px solid #eee;
  background: #fafafa;
  display: grid;
  place-items: center;
}

.merchant-store-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.merchant-store-name {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.merchant-store-stats {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.merchant-store-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .merchant-store-head {
    grid-template-columns: 1fr;
  }
  .merchant-store-logo {
    width: 72px;
    height: 72px;
  }
}

/* --- PriceDisplay.css --- */
/* ===============================
   PriceDisplay - Stili Generali
   =============================== */
.price-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  font-size: 13px;
  /* Allow wrapping on narrow cards (mobile 2-col grid) so the price never disappears/clips. */
  flex-wrap: wrap;
  white-space: normal;
}
  
  /* Prezzo originale barrato */
  .original-price {
    color: #000000;
    text-decoration: line-through;
    white-space: nowrap;
  }
  
  /* Prezzo scontato evidenziato */
  .discounted-price {
    color: #e60023; /* 🔥 Rosso evidenziato */
    white-space: nowrap;
    font-weight: 700;
  }
  
  /* Prezzo finale senza sconto */
  .final-price {
    color: #000;
    white-space: nowrap;
    font-weight: 700;
  }
  
  /* ===============================
     Varianti di Dimensione
     =============================== */
.price-small {
  font-size: 12px;
}

.price-medium {
  font-size: 14px;
}

.price-large {
  font-size: 16px;
}
  
  /* ===============================
     Responsive Design
     =============================== */
  @media (max-width: 768px) {
    .price-medium {
      font-size: 14px;
    }
    .price-large {
      font-size: 18px;
    }
  }

/* --- ProductTitle.css --- */
.product-title {
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
  /* Reserve one line without Safari/rounding clipping issues. */
  min-height: 1.3em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .product-title {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .product-title {
    font-size: 12px;
  }
}

/* --- ShippingLabel.css --- */
.shipping-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.2;
  color: #6b7280;
  width: 100%;
  min-height: 16px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shipping-label.is-free {
  color: #16a34a;
  font-weight: 600;
}

/* --- SizePreview.css --- */
.size-preview {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin: 2px 0;
  line-height: 1;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.size-preview::-webkit-scrollbar { display: none; }

/* chip taglia */
.size-badge,
.size-more {
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 2px;
  background: #efecec;
  color: #333;
}

/* "+N" */
.size-more {
  color: #555;
}

/* stato vuoto */
.size-preview.is-empty {
  color: #777;
  gap: 3px;
}

.size-empty-text {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* icona (centrata e “pulita”) */
.size-icon {
  display: block;      /* evita baseline text */
  line-height: 0;
}

/* --- StoreLabel.css --- */
.store-label {
  display: block;
  width: 100%;
  font-size: 12px;
  color: #5d5d5d;
  text-align: left;
  letter-spacing: 0.03em;
  font-weight: lighter;
  text-transform: uppercase;
  min-height: 18px;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- ProductCardImage.css --- */
.product-card-image {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.3s;
  margin: 0;
  background-color: #fdfdfd;
  background-image: linear-gradient(90deg, #f6f7f8 0px, #edeef1 40px, #f6f7f8 80px);
  background-size: 600px;
  animation: shimmer 1.2s infinite linear;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #fff;
}

.product-card-image .product-details-overlay {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease-out, opacity 0.2s ease;
  z-index: 3;
}

.product-card-image .product-details-overlay.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

@media screen and (max-width: 480px) {
  .product-card-image img {
    object-fit: contain;
  }
}

@keyframes shimmer {
  0% {
    background-position: -300px 0;
  }
  100% {
    background-position: 300px 0;
  }
}

/* --- Carousel.css --- */
.carousel {
  position: relative;
  width: 100%;
  --carousel-items: 6;
  --carousel-gap: 12px;
}

@media (min-width: 1920px) {
  .carousel {
    --carousel-items: 7;
  }
}

.carousel-viewport {
  position: relative;
}

.carousel-track {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  gap: var(--carousel-gap);
  /* Give cards room for shadows and hover translate without clipping. */
  padding: 12px 8px 22px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
  display: flex;
  min-width: 0;
  flex: 0 0 calc(
    (100% - (var(--carousel-gap) * (var(--carousel-items) - 1))) / var(--carousel-items)
  );
  scroll-snap-align: start;
}
.carousel-slide { scroll-snap-stop: always; }
.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 10;
  color: rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  border-radius: 999px;
}

.carousel-control:hover {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.55);
  transform: translateY(-50%) scale(1.03);
}

.carousel-control:active {
  transform: translateY(-50%) scale(0.98);
}

.carousel-control:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.28);
  outline-offset: 2px;
}

.carousel-control:disabled {
  opacity: 0.22;
  cursor: default;
  background: transparent;
  transform: translateY(-50%);
}

.carousel-control.next {
  right: 10px;
}

.carousel-control.prev {
  left: 10px;
}

.carousel-control-icon {
  display: block;
}

.pagination-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.carousel-page-btn {
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background-color: rgba(17, 17, 17, 0.08);
  color: rgba(17, 17, 17, 0.75);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.carousel-page-btn:hover {
  background-color: rgba(17, 17, 17, 0.16);
  transform: translateY(-1px);
}

.carousel-page-btn.active,
.carousel-page-btn.is-active {
  background-color: #111;
  color: #fff;
}

.carousel-page-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.28);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .carousel-control {
    width: 40px;
    height: 40px;
  }
}

/* --- RecommendedProducts.css --- */
.recommended-products {
  width: 100%;
  box-sizing: border-box;
}

.recommended-products-title {
  text-align: center;
  margin: 0;
}

/* --- RelatedProducts.css --- */
.related-products {
  width: 100%;
  box-sizing: border-box;
}

.related-products-title {
  text-align: center;
  margin: 0;
}

/* --- RecentlyViewedProducts.css --- */
.recently-viewed-products {
  width: 100%;
  box-sizing: border-box;
}

.recently-viewed-title {
  text-align: center;
  margin: 0;
}

