<template>
  <div class="analysis-tool-card" :class="[type, { 'primary-tool': isPrimary }]">
    <div class="tool-header">
      <div class="tool-icon" :style="{ background: iconColor }">
        <i :class="iconClass"></i>
      </div>
      <div class="tool-info">
        <h4>{{ title }}</h4>
        <p>{{ description }}</p>
      </div>
      <div class="tool-status">
        <span class="status-badge">{{ statusText }}</span>
      </div>
    </div>

    <div class="tool-content">
      <div class="tool-features">
        <span
          v-for="(feature, index) in features"
          :key="index"
          class="feature-tag"
        >
          {{ feature }}
        </span>
      </div>
      <div class="tool-actions">
        <button class="start-analysis-btn" @click="$emit('start-analysis')">
          <i class="fas fa-play"></i>
          {{ buttonText }}
        </button>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  type: {
    type: String,
    required: true
  },
  title: {
    type: String,
    required: true
  },
  description: {
    type: String,
    required: true
  },
  iconClass: {
    type: String,
    required: true
  },
  iconColor: {
    type: String,
    required: true
  },
  features: {
    type: Array,
    required: true
  },
  isPrimary: {
    type: Boolean,
    default: true
  },
  statusText: {
    type: String,
    default: '就绪'
  },
  buttonText: {
    type: String,
    default: '开始分析'
  }
})

defineEmits(['start-analysis'])
</script>

<style scoped>
/* 分析工具卡片样式 */
.analysis-tool-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--spacing-lg);
  overflow: hidden;
  transition: var(--transition-all-smooth);
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: var(--color-shadow-card);
}

.analysis-tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary-gradient);
  opacity: 0.8;
}

.analysis-tool-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--color-shadow-card), 0 0 20px var(--color-shadow-primary);
  transform: translateY(-4px) scale(1.02);
}

.analysis-tool-card.primary-tool {
  border: 1px solid var(--color-primary);
  background: var(--color-gradient-brand-bg);
  box-shadow: 0 8px 32px var(--color-shadow-primary);
}

.analysis-tool-card.primary-tool::after {
  content: '核心功能';
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: var(--color-primary-gradient);
  color: var(--color-text-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--size-border-radius-button);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  box-shadow: 0 2px 8px var(--color-shadow-primary);
  z-index: 10;
}

/* 工具头部 */
.tool-header {
  display: flex;
  align-items: center;
  padding: var(--spacing-2xl);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-primary);
  position: relative;
}

.tool-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--spacing-2xl);
  right: var(--spacing-2xl);
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--color-primary) 50%, transparent 100%);
}

.tool-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--spacing-xl);
  font-size: var(--spacing-2xl);
  color: var(--color-text-primary);
  position: relative;
  overflow: hidden;
}

.tool-icon::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(135deg, var(--color-white-rgb-15) 0%, transparent 50%, var(--color-white-rgb-05) 100%);
  border-radius: inherit;
  pointer-events: none;
}

/* 图标背景现在通过props动态设置 */

.tool-info {
  flex: 1;
}

.tool-info h4 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.tool-info p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

.tool-status {
  margin-left: var(--spacing-lg);
}

.status-badge {
  background: var(--color-gradient-success);
  color: var(--color-text-primary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--spacing-xl);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--spacing-xs);
  box-shadow: 0 4px 12px var(--color-shadow-primary);
}

/* 工具内容 */
.tool-content {
  padding: var(--spacing-xl);
}

.tool-features {
  margin-bottom: var(--spacing-lg);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  gap: var(--spacing-sm);
}

.feature-tag {
  background: var(--color-primary-rgb);
  color: var(--color-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--size-border-radius-button);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--spacing-xs);
}

/* 工具操作按钮 */
.tool-actions {
  display: flex;
  justify-content: center;
  margin-top: var(--spacing-lg);
}

.start-analysis-btn {
  background: var(--color-primary-gradient);
  color: var(--color-text-primary);
  border: none;
  padding: var(--spacing-lg) var(--spacing-3xl);
  border-radius: var(--spacing-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  transition: var(--transition-all-smooth);
  box-shadow: 0 6px 20px var(--color-shadow-primary);
  position: relative;
  overflow: hidden;
  min-width: 140px;
}

.start-analysis-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--color-white-rgb-2) 50%, transparent 100%);
  transition: left 0.6s ease;
}

.start-analysis-btn:hover::before {
  left: 100%;
}

.start-analysis-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px var(--color-shadow-hover);
}

.start-analysis-btn:active {
  transform: translateY(-1px) scale(1.02);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .tool-header {
    padding: var(--spacing-lg);
  }

  .tool-content {
    padding: var(--spacing-lg);
  }

  .tool-icon {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-lg);
  }
}
</style>