/* Enhanced Product Card Styles */
.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(255, 107, 107, 0.15);
}

.product-image-container {
  position: relative;
  width: 100%;
  height: 260px; /* Fixed height to match the image */
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #f8f8f8; /* Light background for images that haven't loaded */
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 260px; /* Fixed height for consistent product images */
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px 20px 0 0;
}

.product-card:hover .product-image {
  transform: scale(1.1);
}

.product-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.5));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
  opacity: 1;
}

.product-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: linear-gradient(
    45deg,
    var(--color-primary-dark),
    var(--color-accent)
  );
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
  z-index: 1;
  transform: translateY(-5px);
  opacity: 0;
  animation: badgeSlideIn 0.5s ease forwards;
}

@keyframes badgeSlideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.product-info {
  padding: 1.5rem;
  background: white;
  position: relative;
}

.product-name {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
  font-weight: 600;
  transition: color 0.3s ease;
}

.product-card:hover .product-name {
  color: var(--color-primary);
}

.product-description {
  color: var(--color-text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  font-family: var(--font-heading);
}

.add-to-cart-btn {
  background: linear-gradient(
    45deg,
    var(--color-primary-dark),
    var(--color-accent)
  );
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.add-to-cart-btn i {
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.add-to-cart-btn:hover i {
  transform: translateX(3px);
}

/* Product Card Loading State */
.product-card.loading {
  pointer-events: none;
}

.product-card.loading .product-image,
.product-card.loading .product-name,
.product-card.loading .product-description,
.product-card.loading .product-price {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  color: transparent;
}

/* Search Bar Styles */
.search-container {
  width: 100%;
  max-width: 600px;
  margin: 2rem auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid rgba(255, 107, 107, 0.1);
  border-radius: 30px;
  font-size: 1rem;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.15);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: var(--color-text-light);
}

.search-clear-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0.5rem;
  display: none;
}

.search-clear-btn:hover {
  color: var(--color-primary);
}

/* Grid Layout Enhancements */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2.5rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start; /* Ensures all cards start from the same height */
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .product-card {
    max-width: 100%;
  }
}
