<template>
  <el-card shadow="hover" class="stat-card">
    <div class="stat">
      <div class="stat-icon" :style="{ background: color || '#3b82f6' }">
        <el-icon><component :is="icon" /></el-icon>
      </div>
      <div class="stat-body">
        <div class="stat-value">{{ value }}</div>
        <div class="stat-title">{{ title }}</div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
defineProps<{
  title: string;
  value: string | number;
  icon: string;
  color?: string;
}>();
</script>

<style scoped>
.stat-card {
  border: none;
}
.stat {
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
}
.stat-title {
  font-size: 13px;
  color: #909399;
  margin-top: 2px;
}
</style>
