import { defineConfig, presetUno, presetIcons, presetWebFonts } from 'unocss'

export default defineConfig({
  // Basic UnoCSS configuration for jpl-website
  presets: [
    presetUno(),
    presetIcons({
      collections: {
        heroicons: () => import('@iconify-json/heroicons/icons.json').then(i => i.default),
        lucide: () => import('@iconify-json/lucide/icons.json').then(i => i.default),
      }
    }),
    presetWebFonts({
      fonts: {
        sans: 'Inter:400,500,600,700',
        mono: 'JetBrains Mono:400,500',
      }
    })
  ],
  
  // Theme configuration
  theme: {
    colors: {
      primary: {
        50: '#fef7ee',
        100: '#fdedd3',
        200: '#fbd6a5',
        300: '#f8b86d',
        400: '#f59332',
        500: '#f2751a',
        600: '#e35a0f',
        700: '#bc4210',
        800: '#953515',
        900: '#792d14',
      },
      gray: {
        50: '#f9fafb',
        100: '#f3f4f6',
        200: '#e5e7eb',
        300: '#d1d5db',
        400: '#9ca3af',
        500: '#6b7280',
        600: '#4b5563',
        700: '#374151',
        800: '#1f2937',
        900: '#111827',
      }
    },
    fontFamily: {
      sans: ['Inter', 'system-ui', 'sans-serif'],
      mono: ['JetBrains Mono', 'monospace'],
    }
  },
  
  // Content paths for purging
  content: {
    filesystem: [
      'src/**/*.rs',
      'templates/**/*.html',
      'content/**/*.md'
    ]
  },
  
  // Custom shortcuts for common patterns
  shortcuts: {
    'btn': 'px-4 py-2 rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2',
    'btn-primary': 'btn bg-primary-600 text-white hover:bg-primary-700',
    'btn-secondary': 'btn bg-gray-200 text-gray-900 hover:bg-gray-300',
    'btn-ghost': 'btn bg-transparent text-gray-700 hover:bg-gray-100',
    'card': 'bg-white rounded-lg shadow-sm border border-gray-200 p-6',
    'input': 'w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500',
    'nav-link': 'text-gray-700 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium transition-colors',
    'nav-link-active': 'text-primary-600 bg-primary-50 px-3 py-2 rounded-md text-sm font-medium',
  },
  
  // Custom rules for Rustelo-specific patterns
  rules: [
    // Custom spacing for Rustelo layouts
    [/^rustelo-container$/, () => ({ 'max-width': '1200px', 'margin': '0 auto', 'padding': '0 1rem' })],
    [/^rustelo-section$/, () => ({ 'padding': '4rem 0' })],
    [/^rustelo-hero$/, () => ({ 'padding': '8rem 0 6rem' })],
  ],
  
  // Safelist important classes that might be used dynamically
  safelist: [
    'bg-primary-600',
    'text-primary-600',
    'border-primary-600',
    'ring-primary-500',
    'btn-primary',
    'btn-secondary',
    'btn-ghost',
    'card',
    'nav-link',
    'nav-link-active',
  ],
  
  // Development configuration
  cli: {
    entry: [
      {
        patterns: ['src/**/*.rs'],
        outFile: 'public/styles/unocss.css'
      }
    ]
  }
})