/**
 * Product Item Block Styles
 */

/* Main Product Item container */
.product-item {
  list-style: none;
  flex: 0 0 calc(20% - 7.5px);
  padding: 0;
}

.product-item-card {
  background-color: var(--white);
  height: -webkit-fill-available;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-smort);
  overflow: hidden;
  transition: all 0.3s ease;

  span.onsale {
    display: none;
  }

  & > a {
    display: flex;
    justify-content: center;
    width: 100%;
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
  }

  img {
    position: absolute;

    padding: 1rem;
    padding-bottom: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition:
      opacity 0.4s ease,
      transform 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
  }
}

.product-item-card img.product-item-image-hover {
  opacity: 0;
  transform: scale(1.025);
}

@media (hover: hover) and (pointer: fine) {
  .product-item-card:has(.product-item-image-hover)
    > a:hover
    img.product-item-image-hover,
  .product-item-card:has(.product-item-image-hover)
    > a:focus-visible
    img.product-item-image-hover {
    opacity: 1;
    transform: scale(1);
  }

  .product-item-card:has(.product-item-image-hover)
    > a:hover
    img:not(.product-item-image-hover),
  .product-item-card:has(.product-item-image-hover)
    > a:focus-visible
    img:not(.product-item-image-hover) {
    opacity: 0;
    transform: scale(1.025);
  }
}

.product-item-sale-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 3;
  padding: 0.3rem 0.65rem;
  background: var(--primary);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  @media (max-width: 480px) {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }
}

.product-item-discount-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 3;
  padding: 0.3rem 0.65rem;
  background: var(--accent);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  @media (max-width: 480px) {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Product Info Container */
.product-item-info {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: 0;
  margin-top: 1rem;
  padding-bottom: 0.4rem;
}

/* Product Title */
.product-item-title-container {
  margin-bottom: var(--space-2);
}

.product-item-title-container > * {
  font-size: var(--text-base) !important;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;

  @media (max-width: 480px) {
    font-size: var(--text-sm) !important;
  }
}

/* Lämplig för att använda */
.product-item-suitable-for {
  font-size: var(--text-sm);
  color: var(--text);
  opacity: 0.7;
  margin-bottom: var(--space-2);
}

/* Stock Status */
.product-item-stock-status {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  margin-bottom: var(--space-2);
  padding: 0.2rem 0.55rem;
}

.product-item-stock-status .stock-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.product-item-stock-status.stock-green .stock-dot {
  background-color: var(--success);
}

.product-item-stock-status.stock-yellow .stock-dot {
  background-color: var(--warning);
}

.product-item-stock-status.stock-red .stock-dot {
  background-color: var(--error);
}

.product-item-stock-status .stock-text {
  color: color-mix(in srgb, var(--text) 92%, #000 8%);
  font-weight: 600;
}

/* Product Item Actions */
.product-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* Knapparna låg tidigare i en (felaktigt nästlad) produktlänk som gjorde raden 31px hög.
   Nu när länken är borta toppjusteras de, så hjärtat hamnar i linje med lagerstatusen som förut. */
.product-item-info .product-item-actions {
  align-self: flex-start;
}

/* Orange Circle Button */
.product-item-circle-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  transition: all 0.3s ease;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 38%, transparent);
  display: none;
}

.product-item-circle-button:hover {
  background: var(--primary-hover);
  transform: translateX(2px);
}

.product-item-circle-button svg {
  width: 20px;
  height: 20px;
  stroke: var(--white);
  stroke-width: 2.5;
}
/* Horizontal Layout */
.product-item.horizontal {
  padding: 0;
  .product-item-card {
    flex-direction: row;
    width: 100%;
    & > a {
      min-height: 160px;
    }
  }
  .product-item-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    padding-left: var(--space-4);
  }
}

/* Responsive styles */
@media (width <= 1024px) {
  .product-item {
    flex: 0 0 calc(25% - 7px);
  }
}
@media (width <= 768px) {
  .product-item {
    flex: 0 0 calc(40% - 7px);
  }
}
@media (width <= 480px) {
  .product-item {
    flex: 0 0 calc(50% - 7px);
  }
}

/* Price wrapper */
.product-item-price-wrapper {
  margin-bottom: var(--space-2);
}

.product-item-price {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.product-item-from-label {
  font-size: 0.8em;
  font-weight: 600;
}

.product-item-price del {
  color: color-mix(in srgb, var(--text) 60%, #999 40%);
  font-size: 0.95rem;
  font-weight: 600;
}

.product-item-price ins {
  text-decoration: none;
  color: var(--primary);
}

.product-item-login-for-price {
  font-size: var(--text-sm);
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s;
}

.product-item-login-for-price:hover {
  color: var(--primary-dark);
}
