<script setup>
import { ref } from 'vue'
import { useDebateStore } from './stores/debate'
import PromptInput from './components/PromptInput.vue'
import DebateThread from './components/DebateThread.vue'

const debateStore = useDebateStore()
const showDebate = ref(false)

function handleDebateCreated(debate) {
  showDebate.value = true
}

function startNewDebate() {
  debateStore.clearCurrentDebate()
  showDebate.value = false
}
</script>

<template>
  <div class="app">
    <div v-if="!showDebate">
      <PromptInput @debate-created="handleDebateCreated" />
    </div>

    <div v-else>
      <div class="debate-view">
        <button @click="startNewDebate" class="new-debate-btn">
          + New Debate
        </button>

        <DebateThread
          v-if="debateStore.currentDebate"
          :debate="debateStore.currentDebate"
        />
      </div>
    </div>
  </div>
</template>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f5f7fa;
  color: #2c3e50;
}

#app {
  min-height: 100vh;
}
</style>

<style scoped>
.app {
  min-height: 100vh;
  padding: 2rem;
}

.debate-view {
  position: relative;
}

.new-debate-btn {
  position: fixed;
  top: 2rem;
  right: 2rem;
  padding: 0.75rem 1.5rem;
  background-color: white;
  border: 2px solid #667eea;
  color: #667eea;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.new-debate-btn:hover {
  background-color: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
</style>
