<template>
  <div class="border-b border-surface-border bg-surface px-6 py-2 flex items-center gap-3">
    <span class="text-text-dim text-xs whitespace-nowrap">Quick diagnose</span>
    <input
      v-model="query"
      type="text"
      placeholder='Describe what broke (e.g. "plex audio dropped around 2pm")'
      class="flex-1 bg-surface-raised border border-surface-border rounded px-3 py-1.5 text-sm text-text-primary placeholder-text-dim focus:outline-none focus:border-accent transition-colors"
      @keydown.enter="submit"
    />
    <button
      :disabled="!query.trim()"
      @click="submit"
      class="px-4 py-1.5 rounded bg-accent text-white text-xs font-semibold hover:bg-blue-400 transition-colors disabled:opacity-50 whitespace-nowrap"
    >Go</button>
  </div>
</template>

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

const router = useRouter()
const query  = ref('')

function submit() {
  if (!query.value.trim()) return
  router.push({ path: '/diagnose', query: { q: query.value, tab: 'quick' } })
  query.value = ''
}
</script>
