<template>
  <el-card class="stat-card">
    <div class="stat-content">
      <el-icon class="stat-icon" :color="color">
        <component :is="icon" />
      </el-icon>
      <div class="stat-info">
        <div class="stat-value">{{ value }}</div>
        <div class="stat-label">{{ label }}</div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
interface Props {
  icon: string
  label: string
  value?: string | number
  color?: string
}

withDefaults(defineProps<Props>(), {
  value: '0',
  color: '#409eff'
})
</script>

<style scoped>
.stat-card {
  text-align: center;
}

.stat-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.stat-icon {
  font-size: 40px;
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #303133;
}

.stat-label {
  font-size: 14px;
  color: #909399;
  margin-top: 5px;
}

@media (max-width: 900px) {
  .stat-value {
    font-size: 24px;
  }

  .stat-icon {
    font-size: 28px;
  }
}
</style>
