<!--
/**
 * Status Card Component - Platform Neutral Status Display
 * 
 * Reusable card component for displaying system status
 * 
 * @author Matthew Raymer
 * @version 1.0.0
 */
-->

<template>
  <div class="status-card" :class="`card-${status}`">
    <div class="card-header">
      <h3 class="card-title">{{ title }}</h3>
      <div class="status-badge" :class="`badge-${status}`">
        <span class="status-indicator" :class="`indicator-${status}`"></span>
        {{ value }}
      </div>
    </div>
    
    <div class="card-content">
      <p class="card-description">{{ description }}</p>
      
      <button 
        v-if="action" 
        class="action-button" 
        @click="handleAction"
        :class="`action-${status}`"
      >
        {{ action.label }}
      </button>
    </div>
  </div>
</template>

<script setup lang="ts">
interface Action {
  label: string
  method: string
}

interface Props {
  title: string
  status: 'success' | 'warning' | 'error' | 'info'
  value: string
  description: string
  action?: Action
}

const props = defineProps<Props>()

const emit = defineEmits<{
  actionClick: [action: Action]
}>()

const handleAction = () => {
  if (props.action) {
    emit('actionClick', props.action)
  }
}
</script>

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

.status-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.card-success {
  border-left-color: #4caf50;
}

.card-warning {
  border-left-color: #ff9800;
}

.card-error {
  border-left-color: #f44336;
}

.card-info {
  border-left-color: #2196f3;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.badge-success {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge-warning {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-error {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.badge-info {
  background: rgba(33, 150, 243, 0.2);
  color: #2196f3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.indicator-success {
  background: #4caf50;
}

.indicator-warning {
  background: #ff9800;
}

.indicator-error {
  background: #f44336;
}

.indicator-info {
  background: #2196f3;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.action-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.action-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.action-success {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.4);
}

.action-success:hover {
  background: rgba(76, 175, 80, 0.3);
}

.action-warning {
  background: rgba(255, 152, 0, 0.2);
  border-color: rgba(255, 152, 0, 0.4);
}

.action-warning:hover {
  background: rgba(255, 152, 0, 0.3);
}

.action-error {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.4);
}

.action-error:hover {
  background: rgba(244, 67, 54, 0.3);
}

.action-info {
  background: rgba(33, 150, 243, 0.2);
  border-color: rgba(33, 150, 243, 0.4);
}

.action-info:hover {
  background: rgba(33, 150, 243, 0.3);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .status-card {
    padding: 16px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .status-badge {
    align-self: flex-end;
  }
  
  .action-button {
    align-self: stretch;
    text-align: center;
  }
}
</style>
