<!--
/**
 * Action Card Component - Platform Neutral Action Card
 * 
 * Reusable card component for displaying actions
 * 
 * @author Matthew Raymer
 * @version 1.0.0
 */
-->

<template>
  <div class="action-card" @click="handleClick" :class="{ loading: loading }">
    <div class="card-content">
      <div class="card-icon">{{ icon }}</div>
      <div class="card-text">
        <h3 class="card-title">{{ title }}</h3>
        <p class="card-description">{{ description }}</p>
      </div>
      <div class="card-arrow">
        <span v-if="loading" class="loading-spinner">⟳</span>
        <span v-else class="arrow-icon">→</span>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component, Prop, toNative } from 'vue-facing-decorator'

@Component
class ActionCard extends Vue {
  @Prop({ type: String, required: true }) title!: string
  @Prop({ type: String }) icon?: string
  @Prop({ type: String }) description?: string
  @Prop({ type: Boolean, default: false }) loading!: boolean

  handleClick() {
    console.log('🔄 ActionCard handleClick called for:', this.title)
    if (!this.loading) {
      console.log('🔄 ActionCard emitting click event for:', this.title)
      this.$emit('click')
    } else {
      console.log('🔄 ActionCard click ignored - loading state')
    }
  }
}

export default toNative(ActionCard)
</script>

<style scoped>
.action-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.action-card:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.action-card.loading {
  cursor: not-allowed;
  opacity: 0.7;
}

.card-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.card-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.card-text {
  flex: 1;
}

.card-title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.card-description {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.card-arrow {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .action-card {
    padding: 16px;
  }
  
  .card-content {
    gap: 12px;
  }
  
  .card-icon {
    font-size: 20px;
  }
  
  .card-title {
    font-size: 15px;
  }
  
  .card-description {
    font-size: 13px;
  }
}
</style>
