// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },
  ssr: false, // SPA mode for Apache static hosting
  modules: [
    '@nuxtjs/tailwindcss',
    '@pinia/nuxt'
  ],
  // Auto-import components
  components: [
    '~/components',
    { path: '~/components/clients', prefix: 'Client' }
  ],
  tailwindcss: {
    cssPath: '~/assets/css/tailwind.css',
    configPath: 'tailwind.config.js',
    exposeConfig: false,
    viewer: true,
  },
  vite: {
    resolve: {
      alias: {
        '~': '/assets',
        '@': '/'
      }
    }
  },

  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },
  app: {
    head: {
      title: 'CRM Pro',
      meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { name: 'description', content: 'CRM system for managing users and clients' }
      ],
      link: [
        { rel: 'icon', type: 'image/svg+xml', href: '/logo_faicon.svg' }
      ]
    }
  },
  runtimeConfig: {
    public: {
      apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:8000/api',
      wsBase: process.env.NUXT_PUBLIC_WS_BASE || 'ws://localhost:8000'
    }
  }
})