<template>
  <view class="metric-container" :style="{ gridTemplateColumns: `repeat(${columns}, 1fr)` }">
    <view class="metric-item" v-for="(item, index) in items" :key="index">
      <view class="metric-value">
        {{ item.value }}
      </view>
      <view class="metric-label">{{ item.label }}</view>
      <view v-if="item.unit" class="metric-unit">{{ item.unit }}</view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'MetricCard',
  props: {
    items: {
      type: Array,
      required: true
    },
    columns: {
      type: Number,
      default: 3
    }
  }
}
</script>

<style scoped>
/* 简洁指标卡片容器 */
.metric-container {
  display: grid;
  gap: 20rpx;
  padding: 30rpx;
  box-sizing: border-box;
  background: #fff;
}

/* 单个指标项 */
.metric-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30rpx 20rpx;
  background: #f8f9fa;
  border-radius: 12rpx;
  border: 1rpx solid #e8e8e8;
  transition: all 0.2s ease;
  
  &:active {
    background: #f0f2f5;
  }
}

/* 指标数值 */
.metric-value {
  font-size: 48rpx;
  font-weight: 600;
  margin-bottom: 16rpx;
  line-height: 1.2;
  color: #1a73e8;
}

/* 单位 */
.metric-unit {
  font-size: 0.7em;
  color: #999;
  margin-left: 8rpx;
}

/* 指标标签 */
.metric-label {
  font-size: 26rpx;
  color: #666;
  letter-spacing: 1rpx;
  text-align: center;
  line-height: 1.5;
}
</style>