/**
 * Modern Product Card Component
 * Glass-like design with rounded corners and smooth animations
 */

.product-card-modern {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  will-change: transform, box-shadow;
  transform: translateZ(0);
  max-width: 100%;
}

.product-card-modern:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Image Wrapper */
.product-card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 aspect ratio */
  overflow: hidden;
  background: #f8f9fa;
  border-radius: 15px 15px 0 0;
  flex-shrink: 0;
}

.product-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.product-card-modern:hover .product-card-image {
  transform: scale(1.1);
}

/* Badges */
.product-discount-badge {
  width: 100px !important;
  height: 30px !important;
}
.product-discount-badge,
.product-featured-badge {
  position: absolute;
  width: 50px;
  height: 30px;
  top: 12px;
  right: 12px;
  text-align: center;
  background: #cca35d;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 700;
  z-index: 2;
  animation: pulse 2s infinite;
}

.product-featured-badge {
  top: 5rem;
  bottom: 12px;
  right: auto;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Content */
.product-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.product-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #2d3436;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.product-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}

.product-card-title a:hover {
  color: #cca35d;
}

.product-card-tag {
  display: inline-block;
  background: rgba(204, 163, 93, 0.1);
  color: #cca35d;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  width: fit-content;
}

/* Pricing */
.product-card-pricing {
  margin-top: auto;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.product-price-current {
  font-size: 20px;
  font-weight: 700;
  color: #2d3436;
  direction: ltr;
  text-align: left;
  font-family: "Vazirmatn", sans-serif;
}

.product-price-original {
  font-size: 14px;
  color: #95a5a6;
  text-decoration: line-through;
  direction: ltr;
  text-align: left;
  font-family: "Vazirmatn", sans-serif;
}

/* Actions */
.product-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.product-card-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #cca35d, #1D322D);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(204, 163, 93, 0.3);
  will-change: transform, box-shadow;
}

.product-card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(204, 163, 93, 0.4);
  background: linear-gradient(135deg, #1D322D, #a6853f);
}

.product-card-btn:active {
  transform: translateY(0);
}

.product-card-btn i {
  font-size: 16px;
}

.product-card-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: #1d322d;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s;
}

.product-card-link:hover {
  background: #2a4942;
  transform: rotate(5deg) scale(1.1);
}

.product-card-link i {
  font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
  .product-card-modern {
    border-radius: 15px;
  }

  .product-card-content {
    padding: 16px;
  }

  .product-card-title {
    font-size: 14px;
  }

  .product-price-current {
    font-size: 18px;
  }

  .product-card-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Grid Layout Helper */
.products-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 20px 0;
  align-items: stretch; /* همه کارت‌ها ارتفاع یکسان دارند */
}

/* اطمینان از یک اندازه بودن کارت‌ها */
.products-grid-modern > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.products-grid-modern .product-card-modern {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.products-grid-modern .product-card-image-wrapper {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  /* استفاده از aspect-ratio برای اندازه یکسان */
  aspect-ratio: 4 / 3;
}

.products-grid-modern .product-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.products-grid-modern .product-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.products-grid-modern .product-card-header {
  flex-shrink: 0;
  min-height: 60px;
  max-height: 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.products-grid-modern .product-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  max-height: 44px;
  min-height: 44px;
}

.products-grid-modern .product-card-tag {
  margin-top: 4px;
  flex-shrink: 0;
}

.products-grid-modern .product-card-pricing {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 8px;
}

.products-grid-modern .product-card-actions {
  flex-shrink: 0;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .products-grid-modern {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .products-grid-modern .product-card-modern {
    min-height: 320px; /* Larger cards at 768px */
  }
}

/* Large tablets and small laptops (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .products-grid-modern .product-card-modern {
    min-height: 380px; /* Slightly taller cards */
  }
}

/* Very small mobile devices (320px and down) */
@media (max-width: 320px) {
  .products-grid-modern {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .products-grid-modern .product-card-modern {
    min-height: 280px; /* Slightly larger cards */
  }
}
