<template>
  <div class="payment-step">
    <div class="payment-wrapper">
      <v-card-text class="payment-content text-center">
        <div class="failure-container">
          <div class="icon-container mb-6">
            <v-icon icon="mdi-close-circle" size="100" class="text-red animated-icon" />
          </div>
          
          <h2 class="failure-title mb-6">Pembayaran Gagal</h2>
          
          <p class="failure-message mb-8">
            Terjadi kesalahan saat memproses<br />pembayaran Anda.
          </p>
          
          <!-- Uncomment jika butuh buttons -->
          <!-- <div class="button-group">
            <v-btn 
              color="primary" 
              size="large" 
              variant="flat" 
              rounded="xl" 
              @click="retryPayment" 
              class="action-btn mb-3"
            >
              Coba Lagi
            </v-btn>
            <v-btn 
              color="grey-darken-1" 
              size="large" 
              variant="outlined" 
              rounded="xl" 
              @click="paymentStore.reset"
              class="action-btn"
            >
              Kembali ke Awal
            </v-btn>
          </div> -->
        </div>
      </v-card-text>
    </div>
  </div>
</template>

<script setup>
import { usePaymentStore } from '~/stores/payment';
const paymentStore = usePaymentStore();

const retryPayment = () => {
  console.log("Mencoba pembayaran lagi...");
  paymentStore.setPaymentStatus('aktif');
};
</script>

<style scoped>
.payment-step {
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
  min-height: 100vh;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.payment-wrapper {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1rem;
}

.payment-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 3rem 2rem !important;
}

.failure-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.icon-container {
  position: relative;
}

.animated-icon {
  animation: errorPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 20px rgba(244, 67, 54, 0.3));
}

@keyframes errorPulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 1;
  }
  50% { 
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.text-red {
  color: #f44336 !important;
}

.failure-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1a1a1a;
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.failure-message {
  font-size: 1.25rem;
  font-weight: 500;
  color: #666;
  line-height: 1.5;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 300px;
}

.action-btn {
  font-weight: 600 !important;
  text-transform: none !important;
  transition: all 0.3s ease !important;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .payment-step {
    padding: 1rem 0;
  }
  
  .payment-wrapper {
    padding: 0 0.5rem;
  }
  
  .payment-content {
    padding: 2rem 1.5rem !important;
  }
  
  .failure-title {
    font-size: 2rem;
  }
  
  .failure-message {
    font-size: 1.1rem;
  }
  
  .animated-icon {
    font-size: 80px !important;
  }
}

@media (max-width: 480px) {
  .payment-content {
    padding: 2rem 1rem !important;
  }
  
  .failure-title {
    font-size: 1.8rem;
  }
  
  .failure-message {
    font-size: 1rem;
  }
  
  .button-group {
    max-width: 100%;
  }
}

/* Landscape Tablet Optimization */
@media (orientation: landscape) and (min-width: 768px) and (max-height: 600px) {
  .payment-step {
    padding: 1rem 0;
  }
  
  .payment-content {
    padding: 2rem !important;
  }
  
  .failure-title {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
  
  .failure-message {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .animated-icon {
    font-size: 70px !important;
  }
  
  .icon-container {
    margin-bottom: 1rem;
  }
}

/* Large Tablet Landscape */
@media (orientation: landscape) and (min-width: 1024px) {
  .payment-wrapper {
    max-width: 700px;
  }
  
  .failure-title {
    font-size: 2.2rem;
  }
  
  .failure-message {
    font-size: 1.2rem;
  }
}
</style>