<template>
  <div class="action-buttons">
    <div class="action-left">
      <button class="btn-secondary" @click="emit('reset')">
        <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
          <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
          <path d="M3 3v5h5" />
        </svg>
        <span>重置筛选条件</span>
      </button>
      <button v-if="showSetAsCurrent" class="btn-secondary" @click="emit('setAsCurrent')">
        <span>设置为当前提案</span>
      </button>
    </div>
    <div class="action-right">
      <button
        v-if="showPrevious"
        class="btn-secondary"
        @click="emit('previous')"
      >
        <span>{{ previousText || '返回设置' }}</span>
      </button>
      <button
        class="btn-primary"
        :disabled="nextDisabled"
        @click="emit('next')"
      >
        <span>{{ nextText || '下一步' }}</span>
        <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
          <line x1="5" y1="12" x2="19" y2="12" />
          <polyline points="12 5 19 12 12 19" />
        </svg>
      </button>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps<{
  showPrevious?: boolean
  previousText?: string
  nextText?: string
  nextDisabled?: boolean
  showSetAsCurrent?: boolean
}>()

const emit = defineEmits<{
  reset: []
  previous: []
  next: []
  setAsCurrent: []
}>()
</script>

<style scoped>
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
}

.action-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--bg-black-10);
  border-radius: var(--radius-4);
  background-color: var(--bg-white-100);
  font-size: 14px;
  color: var(--text-primary-80-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background-color: var(--bg-black-2);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 260px;
  padding: 10px 32px;
  border: none;
  border-radius: var(--radius-4);
  background-color: var(--color-primary-100);
  font-size: 14px;
  color: var(--bg-white-100);
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon {
  width: 16px;
  height: 16px;
}

.btn-secondary .icon {
  color: var(--text-primary-65-color);
}
</style>
