<template>
  <view class="podium-card" :class="['podium-' + rank]" @click="handleClick">
    <!-- 藏品主图（不规则圆角） -->
    <view class="cover-wrap">
      <!-- 相框（最底层） -->
      <image
        class="podium-frame"
        :src="`/static/square/galaxy/LV${rank}.png`"
        mode="aspectFit"
      />
      <image
        class="cover-image"
        :src="item.cover_url || item.cover_image || ''"
        mode="aspectFill"
      />
    </view>

    <!-- TOP N 标签（cover 下方居中） -->
    <view class="top-label">TOP {{ rank }}</view>
  </view>
</template>

<script setup>
const props = defineProps({
  item: { type: Object, required: true },
  rank: { type: Number, required: true, validator: (v) => v >= 1 && v <= 3 },
});

const emit = defineEmits(["cardClick"]);

function handleClick() {
  emit("cardClick", props.item);
}
</script>

<style scoped lang="scss">
.podium-card {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  // 公共背景图（不随 rank 变化，所有 podium 卡片都显示）
  // 放在 .podium-N 之前以确保不被任何具体 rank 的样式覆盖
  background-image: url("/static/square/galaxy/topbj3.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* TOP 1: 中央大卡（最大） */
.podium-1 {
  top: 400rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 96rpx;
  height: 128rpx;
}

/* TOP 2: 右上 */
.podium-2 {
  top: 150rpx;
  right: 60rpx;
  width: 96rpx;
  height: 128rpx;
}

/* TOP 3: 左上 */
.podium-3 {
  top: 152rpx;
  left: 96rpx;
  width: 160rpx;
  height: 208rpx;
  .podium-frame {
    width: 160rpx;
    height: 208rpx;
  }
}

.podium-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  transform: scale(1.5);
}

.cover-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.cover-image {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.top-label {
  width: 64rpx;
  position: absolute;
  bottom: -64rpx;
  left: 50%;
  transform: translateX(-50%);
  color: #fffabd;
  font-size: 20rpx;
  font-weight: 800;
  border-radius: 16rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: -1px 1px 4px #ce0909d6;
  background: linear-gradient(
    93.1deg,
    rgba(224, 180, 247, 0.71) -12.06%,
    rgba(178, 246, 204, 0.71) 52.09%,
    rgba(98, 178, 244, 0.71) 163.5%
  );
  backdrop-filter: blur(11.699999809265137px);
  z-index: 7;
  padding: 0 16rpx;
}
</style>
