<template>
  <div class="player-card" :class="{ 'is-current': isCurrent }">
    <div class="player-header">
      <h4>{{ player.name }}</h4>
      <span class="role">{{ player.producerRole }}</span>
    </div>
    
    <div class="player-tokens">
      <div class="token">🦃 {{ player.tokens.turkey }}</div>
      <div class="token">☕ {{ player.tokens.coffee }}</div>
      <div class="token">🌽 {{ player.tokens.corn }}</div>
    </div>
    
    <div class="player-stats">
      <div class="stat">
        <span>Puntos:</span>
        <span class="value">{{ player.points }}</span>
      </div>
      <div v-if="player.shameTokens > 0" class="stat shame">
        <span>Vergüenza:</span>
        <span class="value">{{ player.shameTokens }}</span>
      </div>
    </div>
    
    <button v-if="!isCurrent" @click="$emit('make-offer')" class="offer-button">
      Hacer oferta
    </button>
  </div>
</template>

<script setup lang="ts">
defineProps<{
  player: {
    name: string
    producerRole: string
    tokens: {
      turkey: number
      coffee: number
      corn: number
    }
    points: number
    shameTokens: number
    role: string
  }
  isCurrent: boolean
}>()

defineEmits<{
  'make-offer': []
}>()
</script>

<style scoped>
.player-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.player-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.player-card.is-current {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.player-header h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.role {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.player-tokens {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.token {
  font-size: 1.1rem;
  font-weight: 500;
}

.player-stats {
  margin-bottom: 1rem;
}

.stat {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.stat.shame {
  color: #ff6b6b;
}

.value {
  font-weight: 700;
}

.offer-button {
  width: 100%;
  padding: 0.75rem;
  background: rgba(103, 126, 234, 0.8);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.offer-button:hover {
  background: rgba(103, 126, 234, 1);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
</style>