<template>
  <div
    class="w-[150px] sm:w-[260px] md:w-[330px] px-2 py-3 sm:py-5 sm:px-[15px] bg-block rounded-2xl flex flex-col items-center gap-[15px] sm:gap-[50px]">
    <img onerror="this.src='https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg?cs=srgb&dl=pexels-souvenirpixels-414612.jpg&fm=jpg'" :src="`https://www.yourgold.cz/api/public/file/${props.product?.cover_picture_uuid}.webp`" alt="pics"
      class="max-h-[95px] sm:max-h-[180px] md:max-h-[205px] rounded-[5px]" />
    <div class="flex flex-col justify-between h-full w-full gap-[7px] sSm:gap-[15px]"
      @click="productStore.incrementCartItem(props.product?.id)">
      <div class="flex flex-col gap-[7px] sm:gap-[15px] w-full">
        <h3 class="text-[10px] sm:text-base md:text-lg text-xl font-bold leading-[130%] sm:leading-[150%] text-bg-dark">
          {{ props.product?.name }}
        </h3>
        <p class="text-[9px] sm:text-[12px] text-sm text-bg-dark">
          {{ props.product?.tax_name }}
        </p>
      </div>
      <div class="flex items-center justify-between">
        <p class="text-accent-green-light font-inter text-[12px] sm:text-[21px] md:text-2xl leading-[150%] font-bold">
          {{ props.product?.formatted_price }}
        </p>
        <button
          class="w-[22px] h-[22px] sm:w-9 sm:h-9 md:w-12 md:h-12 rounded-[5px] sm:rounded-xl bg-button cursor-pointer hover:bg-button-hover transition-all flex items-center justify-center p-1">
          <i class="uil uil-shopping-cart text-lg sm:text-2xl md:text-[31px] cursor-pointer"></i>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  product: Object,
});

const productStore = useProductStore()
</script>
