<template>
  <section class="overview-stats">
    <div class="stats-grid">
      <div
        v-for="item in summary.stats || []"
        :key="item.key"
        class="stats-card"
      >
        <div class="stats-icon" :class="`stats-icon-${item.tone || 'blue'}`">
          <i :class="item.icon || 'el-icon-data-analysis'" />
        </div>
        <div class="stats-content">
          <div class="stats-label">{{ item.label }}</div>
          <div class="stats-value">{{ item.value }}</div>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  name: "OverviewStats",
  props: {
    summary: {
      type: Object,
      default: () => ({}),
    },
  },
};
</script>

<style lang="scss" scoped>
.overview-stats {
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.stats-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: 1px solid var(--ccdi-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: 0 4px 14px rgba(31, 45, 61, 0.05);
}

.stats-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 18px;
}

.stats-icon-blue {
  color: var(--ccdi-primary);
  background: rgba(47, 93, 138, 0.12);
}

.stats-icon-red {
  color: #b55252;
  background: rgba(181, 82, 82, 0.12);
}

.stats-icon-amber {
  color: #a56a2a;
  background: rgba(165, 106, 42, 0.14);
}

.stats-icon-green {
  color: #3f6b55;
  background: rgba(63, 107, 85, 0.14);
}

.stats-content {
  min-width: 0;
}

.stats-label {
  font-size: 12px;
  color: var(--ccdi-text-muted);
}

.stats-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  color: var(--ccdi-text-primary);
}
</style>
