<template>
  <div class="step-actions">
    <div v-if="showBack" class="step-actions__back">
      <BaseButton
        variant="transparent"
        type="button"
        :text="backText"
        custom-class="step-actions__back-btn"
        @click="emit('back')"
      >
        <template #prependIcon>
          <SvgIcon name="caret-right" :size="12" color="var(--color-sec-gray)" />
        </template>
      </BaseButton>
    </div>
    <div class="step-actions__next">
      <BaseButton
        type="submit"
        :text="nextText"
        :loading="loading"
        custom-class="step-actions__next-btn"
      >
        <template #appendIcon>
          <SvgIcon name="arrow-left" :size="18" color="#fff" />
        </template>
      </BaseButton>
    </div>
  </div>
</template>

<script setup>
import BaseButton from '@/components/BaseButton.vue'
import SvgIcon from '@/components/icons/SvgIcon.vue'

defineProps({
  showBack: { type: Boolean, default: true },
  loading: { type: Boolean, default: false },
  nextText: { type: String, default: 'مرحله بعدی' },
  backText: { type: String, default: 'مرحله قبلی' },
})

const emit = defineEmits(['back'])
</script>

<style lang="scss" scoped>
.step-actions {
  display: flex;
  gap: 0.5rem;

  &__back {
    flex: 1 1 60%;
    display: flex;
    justify-content: flex-start;
  }

  &__next {
    flex: 1 1 40%;
    max-width: 16rem;
    margin-inline-start: auto;

    @media (min-width: 768px) {
      flex: 0 0 16rem;
    }
  }

  &__back-btn {
    color: #969696;
    padding: 0 1rem;
    width: fit-content;
  }

  &__next-btn {
    width: 100%;
  }
}
</style>
