<template>
  <view class="function-card">
    <view class="function-left">
      <view class="icon-wrapper" :class="iconClass">
        <image class="function-icon" :src="iconPath" mode="aspectFit"></image>
      </view>
      <view class="function-text">
        <view class="title-row">
          <text class="function-title">{{ title }}</text>
          <text class="feature-tag" v-if="tag">{{ tag }}</text>
        </view>
        <text class="function-description">{{ description }}</text>
      </view>
    </view>
    <view class="function-right">
      <button class="function-button" :class="buttonClass" hover-class="button-hover" @tap="$emit('action')">
        <view class="button-content">
          <text>{{ buttonText }}</text>
          <text class="arrow">›</text>
        </view>
      </button>
    </view>
  </view>
</template>

<script setup lang="ts">
defineEmits(["action"]);

defineProps({
  title: {
    type: String,
    required: true,
  },
  description: {
    type: String,
    required: true,
  },
  iconPath: {
    type: String,
    required: true,
  },
  buttonText: {
    type: String,
    required: true,
  },
  iconClass: {
    type: String,
    default: "",
  },
  buttonClass: {
    type: String,
    default: "",
  },
  tag: {
    type: String,
    default: "",
  },
});
</script>

<style scoped>
.function-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 250, 253, 0.86)),
    linear-gradient(90deg, rgba(255, 204, 220, 0.2), rgba(207, 237, 255, 0.16));
  margin: 0 0 20rpx;
  padding: 28rpx 26rpx;
  border-radius: 24rpx;
  box-shadow: 0 12rpx 32rpx rgba(83, 96, 130, 0.08);
  border: 1rpx solid rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12rpx);
}

.function-card:active {
  transform: translateY(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.function-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.function-icon {
  width: 48rpx;
  height: 48rpx;
  border-radius: 18rpx;
  margin-right: 22rpx;
  background: linear-gradient(145deg, #fff, #f2f7ff);
  padding: 14rpx;
  box-shadow: 0 10rpx 22rpx rgba(112, 126, 157, 0.1);
}

.function-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: 8rpx;
}

.function-title {
  font-size: 31rpx;
  font-weight: 600;
  color: #1f2937;
  display: block;
  line-height: 1.3;
}

.feature-tag {
  margin-left: 12rpx;
  padding: 5rpx 12rpx;
  border-radius: 999rpx;
  background: rgba(255, 232, 240, 0.86);
  color: #d94f75;
  font-size: 20rpx;
  line-height: 1.2;
  flex-shrink: 0;
  border: 1rpx solid rgba(255, 255, 255, 0.72);
}

.function-description {
  font-size: 24rpx;
  color: #7b8493;
  display: block;
  line-height: 1.45;
}

.function-button {
  background: transparent;
  padding: 0;
  margin: 0;
  line-height: 1;
  border: none;
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.function-button::after {
  content: none;
}

.button-content {
  background-color: #f1f5fe;
  color: #4f7cfe;
  padding: 13rpx 20rpx;
  border-radius: 999rpx;
  font-size: 24rpx;
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.arrow {
  margin-left: 6rpx;
  font-size: 34rpx;
  font-weight: 300;
  line-height: 1;
}

.color-button .button-content {
  background: linear-gradient(135deg, #ff6f96 0%, #77b9ff 100%);
  color: white;
  box-shadow: 0 10rpx 20rpx rgba(255, 111, 150, 0.18);
}

.green-button .button-content {
  background: rgba(236, 249, 244, 0.9);
  color: #179b70;
}

.purple-button .button-content {
  background: rgba(244, 240, 255, 0.9);
  color: #7861d4;
}

.red-button .button-content {
  background: rgba(255, 241, 245, 0.92);
  color: #d94f75;
}
</style>
