<template>
  <div class="profile-card">
    <div class="profile-card__avatar">
      <img v-if="avatarUrl" :src="avatarUrl" :alt="name" />
    </div>

    <p class="profile-card__name">{{ name }}</p>

    <div class="profile-card__location">
      <SvgIcon name="map-pin-simple-area" :size="'0.9375rem'" />
      <span>{{ location }}</span>
    </div>

    <div class="profile-card__stats">
      <div v-for="(stat, i) in stats" :key="i" class="profile-card__stat">
        <span class="profile-card__stat-label">{{ stat.label }}</span>
        <span class="profile-card__stat-value">
          {{ stat.value }}
          <span class="profile-card__stat-unit">{{ stat.unit }}</span>
        </span>
      </div>
    </div>
  </div>
</template>

<script setup>
import SvgIcon from '@/components/icons/SvgIcon.vue'

defineProps({
  name: { type: String, default: '' },
  location: { type: String, default: '' },
  avatarUrl: { type: String, default: '' },
  /** mini-stats of { label, value, unit } */
  stats: { type: Array, default: () => [] },
})
</script>

<style lang="scss" scoped>
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 58%);
  box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
  border-radius: 0.9375rem;

  &__avatar {
    width: 7.75rem;
    height: 7.75rem;
    border-radius: 50%;
    background: #f4f4f4;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &__name {
    margin: 0;
    font-family: var(--font-family-fa);
    font-weight: 500;
    font-size: 1.25rem;
    color: #000;
  }

  &__location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-family-fa);
    font-weight: 400;
    font-size: 0.875rem;
    color: #989898;
  }

  &__stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-top: 0.5rem;
  }

  &__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
  }

  &__stat-label {
    font-family: var(--font-family-fa);
    font-weight: 500;
    font-size: 0.6875rem;
    color: #a7a7a7;
  }

  &__stat-value {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-family: var(--font-family-number-fa);
    font-weight: 400;
    font-size: 1.5625rem;
    color: #818181;
  }

  &__stat-unit {
    font-family: var(--font-family-fa);
    font-weight: 300;
    font-size: 0.75rem;
    color: #929292;
  }
}
</style>
