/* Product Card Component */
.product-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.product-image-container {
  position: relative;
  overflow: hidden;
  padding-top: 100%; /* Creates a square container */
}

.product-card .card-img-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .card-img-top {
  transform: scale(1.05);
}

/* Price display */
.product-price-container {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.product-price {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 1.1rem;
}

/* Product title */
.product-card .product-title {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-card .product-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Product badges */
.product-badge,
.discount-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-badge.new {
  background-color: #50b936;
  color: white;
}

.product-badge.hot {
  background-color: #ff5722;
  color: white;
}

.product-badge.sale {
  background-color: #2196f3;
  color: white;
}

.discount-badge {
  background-color: #ff6b6b;
  color: white;
  left: 10px;
  right: auto;
}

/* Enhanced Product actions (wishlist, quick view) */
.product-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  z-index: 3;
}

.product-card:hover .product-actions {
  opacity: 1;
  transform: translateX(0);
}

.action-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: white;
  border: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.action-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  z-index: -1;
}

.action-button:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.action-button:active::before {
  width: 120px;
  height: 120px;
}

.action-button.active {
  background-color: var(--primary-color);
  color: white;
}

/* Improved Quick View Button */
.quick-view-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.product-card:hover .quick-view-overlay {
  opacity: 1;
  transform: translateY(0);
}

.quick-view-btn {
  border: none;
  background-color: white;
  color: #333;
  font-size: 0.85rem;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.quick-view-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Add to wishlist animation */
.add-to-wishlist i.fas {
  color: #ff6b6b;
}

.add-to-wishlist:hover {
  background-color: #ffebee;
  color: #ff6b6b;
}

@keyframes wishlist-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.add-to-wishlist.adding i {
  animation: wishlist-pulse 0.5s;
}

/* Rating stars */
.rating {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.rating .fas,
.rating .far,
.rating .fa-star-half-alt {
  margin-right: 2px;
  color: #ffc107;
}

/* Card body */
.product-card .card-body {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Add to cart button */
.product-card .add-to-cart-btn {
  margin-top: auto;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.product-card .add-to-cart-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  z-index: 0;
}

.product-card .add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.3);
}

.product-card .add-to-cart-btn:active::after {
  width: 300px;
  height: 300px;
}

.product-card .add-to-cart-btn i,
.product-card .add-to-cart-btn span {
  position: relative;
  z-index: 1;
}

/* Out of stock overlay */
.out-of-stock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.out-of-stock-text {
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

/* List view specific styles */
.list-view .product-card {
  flex-direction: row;
  height: auto;
}

.list-view .product-image-container {
  width: 200px;
  padding-top: 200px; /* Keep square aspect ratio */
}

.list-view .card-body {
  width: calc(100% - 200px);
  padding: 1.5rem;
}

.list-view .product-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.list-view .product-actions {
  top: 10px;
  right: auto;
  left: 10px;
  flex-direction: row;
  transform: translateY(-20px);
}

.list-view .product-card:hover .product-actions {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .list-view .product-card {
    flex-direction: column;
  }

  .list-view .product-image-container {
    width: 100%;
    padding-top: 100%;
  }

  .list-view .card-body {
    width: 100%;
  }
  
  .product-actions {
    opacity: 1;
    transform: translateX(0);
  }
  
  .quick-view-overlay {
    display: none; /* Hide on mobile, use action buttons instead */
  }
  
  .action-button {
    width: 34px;
    height: 34px;
  }
}
