.product-card {
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);

  &:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

.product-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 220px;
  border: 1px solid var(--border-color);
  border-radius: 13px 13px 0 0;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 16px;
    transition: transform 0.2s ease;
  }

  &:hover img {
    transform: scale(1.02);
  }
}

.discount-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ef4444;
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--font-size-base, 0.875rem);
  z-index: 1;
}

.stock-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full, 999px);
  background: color-mix(in srgb, var(--success-color) 90%, black);
  color: #fff;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-bold, 700);
  text-transform: capitalize;
}

.stock-badge.out {
  background: color-mix(in srgb, var(--error-color) 90%, black);
}

.product-actions-overlay {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  display: grid;
  gap: 8px;
}

.product-action-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(30, 60, 56, 0.15);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  font-size: var(--font-size-lg, 1rem);
  font-weight: var(--font-weight-bold, 700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.product-action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.product-action-btn.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.product-action-btn:focus-visible,
.product-link:focus-visible,
.add-to-cart-btn:focus-visible {
  outline: 3px solid rgba(73, 118, 113, 0.25);
  outline-offset: 2px;
}

.product-action-favorite.active {
  animation: favorite-pulse 280ms ease-out;
}

@keyframes favorite-pulse {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.product-badges-overlay {
  position: absolute;
  left: 12px;
  top: 46px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 1;
  max-width: calc(100% - 60px);
}

.product-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: var(--radius-full, 999px);
  background: var(--primary-color);
  color: #fff;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-bold, 700);
  text-transform: uppercase;
}

.product-details {
  width: 100%;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 13px 13px;
  padding: 16px;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
  background: var(--bg-secondary);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-name {
  font-weight: var(--font-weight-bold, 700);
  font-size: clamp(14px, 1.4vw, 18px);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(2 * 1.3em);
}

.product-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-base, 0.875rem);
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm, 0.8125rem);
  color: var(--text-secondary);

  .rating-stars {
    color: #b45309;
    font-weight: var(--font-weight-bold, 700);
  }
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.original-price {
  text-decoration: line-through;
  color: #a1b4b5;
  font-size: var(--font-size-base, 0.875rem);
}

.discounted-price,
.current-price {
  color: var(--text-primary);
  font-size: var(--font-size-xl, 1.125rem);
  font-weight: 800;
}

.product-stock {
  margin-top: auto;
}

.stock-bar {
  display: flex;
  gap: 4px;
  height: 4px;
}

.bar-segment {
  flex: 1;
  border-radius: var(--radius-full, 999px);
  background: var(--border-color);

  &.filled.high {
    background: var(--success-color);
  }

  &.filled.medium {
    background: var(--warning-color);
  }

  &.filled.low {
    background: var(--error-color);
  }
}

.add-to-cart-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-lg, 13px);
  background: var(--primary-color);
  color: #fff;
  font-weight: var(--font-weight-bold, 700);
  cursor: pointer;
  transition: background var(--transition-normal), transform var(--transition-fast);

  &:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
  }

  &:focus-visible {
    outline: 3px solid rgba(73, 118, 113, 0.25);
    outline-offset: 2px;
  }
}

@media (max-width: 640px) {
  .product-image {
    min-height: 200px;
  }

  .product-action-btn {
    width: 34px;
    height: 34px;
  }

  .product-details {
    gap: 10px;
    padding: 14px;
  }
}

.product-card-compact {
  .product-details {
    padding: 10px 12px;
    gap: 8px;
  }

  .product-description,
  .product-stock {
    display: none;
  }
}
