<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

const goToShooting = () => {
  router.push('/shooting')
}

const goToUpload = () => {
  router.push('/upload')
}

const goBack = () => {
  router.push('/frame')
}
</script>

<template>
  <div class="source-container">
    <header class="header">
      <button @click="goBack" class="back-button">← กลับ</button>
      <h1>เลือกแหล่งภาพ</h1>
    </header>

    <section class="options-section">
      <div class="option-card" @click="goToShooting">
        <div class="option-icon">
          📷
        </div>
        <h3>ถ่ายภาพใหม่</h3>
        <p>ถ่ายภาพ 4 รูปจากกล้องหรือเว็บแคม</p>
        <div class="arrow">→</div>
      </div>

      <div class="option-card" @click="goToUpload">
        <div class="option-icon">
          🖼️
        </div>
        <h3>อัพโหลดภาพ</h3>
        <p>เลือกภาพ 4 รูปจากคลังภาพในอุปกรณ์</p>
        <div class="arrow">→</div>
      </div>
    </section>
  </div>
</template>

<style scoped>
.source-container {
  min-height: 100vh;
  padding: 2rem;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.back-button {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.header h1 {
  margin: 0;
  color: #333;
  font-size: 2rem;
}

.options-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.option-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: relative;
}

.option-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.option-icon {
  font-size: 3rem;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  color: white;
}

.option-card h3 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.5rem;
}

.option-card p {
  margin: 0;
  color: #666;
  flex: 1;
}

.arrow {
  font-size: 1.5rem;
  color: #007bff;
  font-weight: bold;
}

@media (max-width: 768px) {
  .option-card {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .option-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
}
</style>