<script setup lang="ts">
import { useI18n } from 'vue-i18n';

defineProps<{
  label: string;
  promoLabel?: string;
  statusLabel?: string;
  expanded: boolean;
  hasMarket: boolean;
}>();

const emit = defineEmits<{ toggle: [] }>();
const { t } = useI18n();
</script>

<template>
  <button
    type="button"
    class="row"
    :class="{ expanded, disabled: !hasMarket }"
    :disabled="!hasMarket"
    @click="emit('toggle')"
  >
    <span class="row-label">{{ label }}</span>
    <span v-if="promoLabel" class="row-promo">{{ promoLabel }}</span>
    <span v-if="statusLabel" class="row-status">{{ statusLabel }}</span>
    <span v-else-if="!hasMarket" class="row-muted">{{ t('bet.market_closed') }}</span>
  </button>
</template>

<style scoped>
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 13px 12px;
  background: transparent;
  border: none;
  text-align: left;
  transition: background 0.15s ease;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.row:not(.disabled):active {
  background: rgba(255, 255, 255, 0.025);
}

.row.expanded {
  background: rgba(255, 255, 255, 0.03);
}

.row.expanded::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 30%, var(--primary-light) 50%, var(--primary) 70%, transparent 100%);
  opacity: 0.6;
}

.row.disabled {
  opacity: 0.4;
}

.row-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.row-promo {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  color: #ffb800;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.35);
}

.row-status {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  color: #f0b429;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
}

.row.expanded .row-label {
  color: var(--primary-light);
}

.row-muted {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}
</style>
