/**
 * Stefan DS Plugin - Product Grid Styles
 */

.stefan-ds-product-grid {
  display: grid;
  /* Auto-responsive columns for PC and tablet with a new min-width */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.stefan-ds-product-grid-item {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden; /* Ensures image corners don't poke out */
  display: flex;
  flex-direction: column;
  background-color: #fff;
}

.stefan-ds-product-grid-item a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.stefan-ds-product-grid-item .grid-item-image {
  width: 100%;
  aspect-ratio: 1 / 1; /* Creates consistent square images */
  object-fit: cover;
  display: block;
}

.stefan-ds-product-grid-item .grid-item-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f0f0f1;
}

.stefan-ds-product-grid-item .grid-item-content {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.stefan-ds-product-grid-item .grid-item-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  flex-grow: 1; /* Pushes price to the bottom */
}

/* Reusing existing price styles but adjusting for the grid context */
.stefan-ds-product-grid-item .stefan-ds-prices-wrap {
  flex-wrap: wrap; /* Allow prices to wrap on small cards */
  gap: 5px;
  align-items: baseline;
}

.stefan-ds-product-grid-item .stefan-ds-sale-price,
.stefan-ds-product-grid-item .stefan-ds-regular-price {
  font-size: 18px;
}

.stefan-ds-product-grid-item .stefan-ds-original-price {
  font-size: 14px;
}

/* Mobile styles: 2 columns */
@media all and (max-width: 767px) {
  .stefan-ds-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; /* Slightly reduce gap for smaller screens */
  }

  .stefan-ds-product-grid-item .grid-item-content {
    padding: 8px 8px 4px;
  }

  .stefan-ds-product-grid-item .grid-item-title {
    padding-bottom: 6px;
    margin: 0; /* No margin on the title */
  }

  .stefan-ds-product-grid-item .stefan-ds-prices-wrap {
    gap: 0; /* Remove gap for prices */
  }

  /* Add space between original and sale price using margin instead of gap */
  .stefan-ds-product-grid-item .stefan-ds-original-price {
    margin-right: 5px;
  }
}
