<script setup>
import { computed, onMounted } from 'vue'
import { RouterView, useRoute } from 'vue-router'
import { useLangStore } from '@/stores/lang'
import { isPublicPath } from '@/config/security.js'
import { isDebugMode } from './utils/env.js'

const langStore = useLangStore()
const route = useRoute()

const protectedPageClass = computed(() => ({
  'protected-page': !isDebugMode() && !isPublicPath(route.path),
}))

onMounted(() => {
  langStore.initLanguage()
})
</script>

<template>
  <div id="app" :class="protectedPageClass">
    <RouterView />
  </div>
</template>

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

#app {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
}

#app.protected-page img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
</style>
