<template>
  <div class="tier-picker">
    <div
      v-for="tier in tiers"
      :key="tier.amount"
      class="tier-option"
      :class="{ current: modelValue === tier.amount }"
      @click="$emit('update:modelValue', tier.amount)"
    >
      <span class="tier-amount">{{ tier.display }}</span>
      <span class="tier-label">{{ tier.label }}</span>
    </div>
  </div>
</template>

<script setup>
defineProps({
  modelValue: { type: Number, default: 0 },
  tiers: {
    type: Array,
    default: () => [
      { amount: 0, display: '$0', label: 'Free' },
      { amount: 5, display: '$5', label: '/month' },
      { amount: 15, display: '$15', label: '/month' },
      { amount: 30, display: '$30', label: '/month' },
      { amount: 50, display: '$50', label: '/month' },
    ],
  },
})

defineEmits(['update:modelValue'])
</script>

<style scoped>
.tier-picker {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
}

.tier-option {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  border: 1px dashed var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
}

.tier-option + .tier-option {
  border-left: none;
}

.tier-option:hover {
  background: var(--surface-hover);
}

.tier-option.current {
  border-color: var(--candle);
  border-style: solid;
  background: var(--surface);
}

.tier-amount {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Brygada 1918', serif;
  display: block;
}

.tier-option.current .tier-amount {
  color: var(--candle);
}

.tier-label {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: block;
  margin-top: 2px;
}

.tier-option.current .tier-label {
  color: var(--candle-dim);
}

@media (max-width: 768px) {
  .tier-picker {
    flex-wrap: wrap;
  }
  .tier-option {
    min-width: 60px;
  }
}
</style>
