<script setup lang="ts">
const props = defineProps<{
  icon: Component
  title: string
  description: string
}>()
</script>

<template>
  <div class="relative w-fit cursor-pointer">
    <svg
      width="306"
      height="182"
      viewBox="-1 -1 308 184"
      xmlns="http://www.w3.org/2000/svg"
    >
      <path
        class="border-path"
        d="M306 106.077C306 116.087 292.009 123 282 123C262.67 123 247 138.67 247 158C247 168.009 240.087 182 230.077 182H16C7.16344 182 0 174.837 0 166V16C0 7.16344 7.16344 0 16 0H290C298.837 0 306 7.16344 306 16V106.077Z"
        stroke-width="2"
        fill="transparent"
      />
      <defs>
        <linearGradient
          id="gradient-light"
          x1="164.372"
          y1="-137.957"
          x2="-20.5433"
          y2="68.1723"
          gradientUnits="userSpaceOnUse"
        >
          <stop stop-color="#479FFF" />
          <stop
            offset="1"
            stop-color="#0070EB"
          />
        </linearGradient>

        <linearGradient
          id="gradient-dark"
          x1="164.372"
          y1="-137.957"
          x2="-20.5433"
          y2="68.1723"
          gradientUnits="userSpaceOnUse"
        >
          <stop stop-color="#4FBDFF" />
          <stop
            offset="1"
            stop-color="#1B98E2"
          />
        </linearGradient>
      </defs>
    </svg>

    <div class="absolute left-6 top-6 flex flex-col gap-4 pr-6">
      <div class="flex items-center gap-2">
        <div class="rounded-sm bg-deepblue-900/5 dark:bg-gray-200/5 p-1">
          <component
            :is="icon"
            class="size-6 shrink-0"
          />
        </div>
        <p class="text-base font-semibold">
          {{ title }}
        </p>
      </div>
      <p class="text-sm text-gray-600 dark:text-gray-200">
        {{ description }}
      </p>
    </div>

    <svg
      class="absolute bottom-0 right-0"
      width="48"
      height="48"
      viewBox="0 0 48 48"
      xmlns="http://www.w3.org/2000/svg"
    >
      <rect
        x="1"
        y="1"
        width="46"
        height="46"
        rx="23"
        fill="transparent"
      />
      <rect
        class="animated-border"
        x="1"
        y="1"
        width="46"
        height="46"
        rx="23"
        stroke-width="2"
        fill="transparent"
      />
      <path
        class="arrow"
        fill-rule="evenodd"
        clip-rule="evenodd"
        d="M17.1155 16C16.4994 16 16 16.4994 16 17.1155C16 17.7315 16.4994 18.231 17.1155 18.231L28.1915 18.231L16.3267 30.0958C15.8911 30.5314 15.8911 31.2377 16.3267 31.6733C16.7623 32.1089 17.4686 32.1089 17.9042 31.6733L29.769 19.8085L29.769 30.8845C29.769 31.5006 30.2685 32 30.8845 32C31.5006 32 32 31.5006 32 30.8845L32 17.1155C32 16.9642 31.9699 16.82 31.9154 16.6885C31.8617 16.5589 31.7826 16.4373 31.678 16.3315C31.6749 16.3283 31.6717 16.3251 31.6685 16.322C31.5627 16.2174 31.4411 16.1383 31.3115 16.0846C31.18 16.0301 31.0358 16 30.8845 16L17.1155 16Z"
      />
      <defs>
        <linearGradient
          id="gradient-circle-light"
          x1="25.7838"
          y1="-36.3843"
          x2="-19.403"
          y2="-6.42519"
          gradientUnits="userSpaceOnUse"
        >
          <stop stop-color="#479FFF" />
          <stop
            offset="1"
            stop-color="#0070EB"
          />
        </linearGradient>

        <linearGradient
          id="gradient-circle-dark"
          x1="25.7838"
          y1="-36.3843"
          x2="-19.403"
          y2="-6.42519"
          gradientUnits="userSpaceOnUse"
        >
          <stop stop-color="#4FBDFF" />
          <stop
            offset="1"
            stop-color="#1B98E2"
          />
        </linearGradient>
      </defs>
    </svg>
  </div>
</template>

<style lang="scss" scoped>
.border-path {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  fill: #F4F5F6;
  transition: stroke-dashoffset 2s ease, fill 2s ease;
}

.animated-border {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  transition: stroke-dashoffset 2s ease, fill 2s ease;
  fill: #F4F5F6;
}


.relative:hover .border-path,
.relative:hover .animated-border {
  stroke-dashoffset: 0;
  fill: white;
}

.border-path {
  stroke: url(#gradient-light);
}

.dark .border-path {
  stroke: url(#gradient-dark);
}

.animated-border {
  stroke: url(#gradient-circle-light);
}

.dark .animated-border {
  stroke: url(#gradient-circle-dark);
}

.arrow {
  fill: #0070EB;
}

.dark {
  .border-path,
  .animated-border {
    fill: #393d40;
  }
  .relative:hover .border-path,
  .relative:hover .animated-border {
    fill: #26282b;
  }
  .arrow {
    fill: #1b98e2;
  }
}
</style>


