export default defineNuxtConfig({
  compatibilityDate: "2025-07-15",
  devtools: { enabled: false },

  // SPA-mode: statisch servierbar via nginx try_files /index.html
  ssr: false,

  app: {
    htmlAttrs: { lang: "de" },
    head: {
      meta: [
        {
          name: "viewport",
          content: "width=device-width, initial-scale=1",
        },
      ],
    },
  },

  modules: [
    "@nuxt/ui",
    "@nuxt/image",
    "@nuxt/fonts",
    "@nuxt/icon",
    "@nuxtjs/i18n",
    "@vueuse/motion/nuxt",
    "@vueuse/nuxt",
  ],

  fonts: {
    families: [{ name: "Nunito", provider: "google" }],
  },

  i18n: {
    locales: [
      { code: "de", name: "Deutsch", dir: "ltr", file: "de.json" },
      { code: "en", name: "English", dir: "ltr", file: "en.json" },
    ],
    defaultLocale: "de",
    strategy: "no_prefix",
    // restructureDir:false verhindert dass i18n v9 den Nuxt-4-Default-Prefix
    // "i18n/" vor langDir stellt. Ohne das würde es unter {rootDir}/i18n/locales/ suchen.
    restructureDir: false,
    langDir: "locales",
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: "rebreak_lang",
      cookieSecure: false,
      fallbackLocale: "de",
      redirectOn: "root",
    },
  },

  colorMode: {
    preference: "dark",
    fallback: "dark",
  },

  css: ["~/assets/css/main.css"],

  devServer: {
    port: 3020,
  },

  runtimeConfig: {
    public: {
      // Backend-API für public endpoints (Blocklist-Count etc.)
      // Staging: api.staging.rebreak.org  |  Prod: api.rebreak.org
      apiBase: process.env.NUXT_PUBLIC_API_BASE ?? "https://api.staging.rebreak.org",
    },
  },
});
