/* --- CollectionPage.css --- */
.collection-page {
  background: #ffffff;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow-x: clip;
  padding: 24px 0;
}

.collection-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 var(--so-page-gutter, 12px);
}

.collection-breadcrumb {
  font-size: 13px;
  color: #444;
  margin-bottom: 12px;
}

.collection-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.collection-title {
  font-size: var(--so-h1-size, clamp(24px, 2.6vw, 36px));
  line-height: 1.12;
  margin: 0;
}

.collection-summary {
  margin: 0;
  max-width: 880px;
  color: #555;
  line-height: 1.55;
}

.collection-count {
  margin: 14px 0 16px;
  font-size: 13px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.collection-grid {
  min-height: 520px;
}

.collection-long-description {
  margin: 28px auto 0;
  max-width: 860px;
  color: #555;
  line-height: 1.65;
}

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

@media (max-width: 768px) {
  .collection-count {
    margin: 10px 0 14px;
  }
}

/* gutters are centralized in `--so-page-gutter` (see public/css/base/main.css) */

/* --- 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;
}

/* --- Pagination.css --- */
.pagination-nav {
  width: 100%;
  margin: 20px 0;
}

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination-container li {
  margin: 0;
  box-shadow: none;
}

.pagination-container li a {
  min-width: 38px;
  height: 38px;
  background: #fff;
  color: #222;
  font-size: 1.08em;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.17s, color 0.17s;
  border: 1px solid #ddd;
  border-radius: 0;
}

.pagination-container li a:focus-visible {
  outline: 2px solid #007bff;
  z-index: 2;
}

.pagination-container li a:hover:not([aria-disabled='true']) {
  background: #f4f7fa;
}

.pagination-container li.active a {
  background: #111;
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

.pagination-container li.disabled a {
  background: #f3f3f3;
  color: #ccc;
  cursor: not-allowed;
  opacity: 0.64;
}

@media (max-width: 500px) {
  .pagination-container {
    gap: 3px;
  }
  .pagination-container li a {
    min-width: 30px;
    height: 30px;
    font-size: 1em;
  }
}

/* --- 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;
}

/* --- 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;
  }
}

