<template>
  <div>
    <NuxtRouteAnnouncer />
    <NuxtPage />
    <SearchModal />

    <!-- Mobile-only floating search button -->
    <button
      v-if="$isMobile"
      @click="ui.openSearch()"
      class="fixed bottom-4 right-4 z-40 inline-flex h-12 w-12 items-center justify-center rounded-full bg-esyellow text-slate-800 shadow-lg ring-1 ring-slate-300 hover:brightness-95 active:brightness-90 dark:ring-slate-600"
      aria-label="Rechercher"
    >
      <svg class="h-6 w-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
        <circle cx="11" cy="11" r="8" />
        <path d="m21 21-4.3-4.3" />
      </svg>
    </button>
  </div>
</template>

<script setup>
import SearchModal from '~/components/SearchModal.vue'
import { useUiStore } from '~/store/ui'

const ui = useUiStore()
const { $isMobile } = useNuxtApp()
useHead({
  bodyAttrs: {
    class: 'bg-slate-100 dark:bg-slate-900'
  }
})
</script>

<style>
button,
input {
  @apply px-4 py-2 m-4 rounded-md text-center font-bold
}

button {
  @apply bg-esyellow text-slate-700;
}

input[type="email"] {
  @apply bg-slate-900 text-esyellow;
}
</style>