<!--
/**
 * 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 { Component, Vue, Prop } from 'vue-facing-decorator'

@Component
export default class ActionCard extends Vue {
  @Prop({ required: true })
  icon!: string

  @Prop({ required: true })
  title!: string

  @Prop({ required: true })
  description!: string

  @Prop({ default: false })
  loading!: boolean

  handleClick(): void {
    if (!this.loading) {
      this.$emit('click')
    }
  }
}
</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>
