import type { Config } from 'tailwindcss';
import defaultTheme from 'tailwindcss/defaultTheme';

const config: Config = {
  darkMode: 'class',
  content: [
    './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
    './src/components/**/*.{js,ts,jsx,tsx,mdx}',
    './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
  ],
  theme: {
    extend: {
      fontFamily: {
        primary: ['var(--font-body)', ...defaultTheme.fontFamily.sans],
        mono: ['var(--font-mono)', ...defaultTheme.fontFamily.mono],
      },
      colors: {
        background: 'rgb(var(--color-background) / <alpha-value>)',
        foreground: 'rgb(var(--color-foreground) / <alpha-value>)',
        surface: 'rgb(var(--color-surface) / <alpha-value>)',
        'surface-secondary': 'rgb(var(--color-surface-secondary) / <alpha-value>)',
        'surface-tertiary': 'rgb(var(--color-surface-tertiary) / <alpha-value>)',
        overlay: 'rgb(var(--color-overlay) / <alpha-value>)',
        border: 'rgb(var(--color-border) / <alpha-value>)',
        accent: 'rgb(var(--color-accent) / <alpha-value>)',
        'accent-strong': 'rgb(var(--color-accent-strong) / <alpha-value>)',
        'accent-foreground': 'rgb(var(--color-background) / <alpha-value>)',
        field: 'rgb(var(--color-surface) / <alpha-value>)',
        success: 'rgb(var(--color-success) / <alpha-value>)',
        warning: 'rgb(var(--color-warning) / <alpha-value>)',
        danger: 'rgb(var(--color-danger) / <alpha-value>)',
        canvas: 'rgb(var(--a2-canvas) / <alpha-value>)',
        stage: 'rgb(var(--a2-stage) / <alpha-value>)',
        rail: 'rgb(var(--a2-rail) / <alpha-value>)',
        ink: 'rgb(var(--a2-text) / <alpha-value>)',
        'ink-soft': 'rgb(var(--a2-text-soft) / <alpha-value>)',
        muted: 'rgb(var(--a2-text-muted) / <alpha-value>)',
        copper: 'rgb(var(--a2-copper) / <alpha-value>)',
        'copper-strong': 'rgb(var(--a2-copper-strong) / <alpha-value>)',
        line: 'rgb(var(--a2-line) / <alpha-value>)',
        signal: {
          stable: 'rgb(var(--a2-signal-stable) / <alpha-value>)',
          warn: 'rgb(var(--a2-signal-warn) / <alpha-value>)',
          error: 'rgb(var(--a2-signal-error) / <alpha-value>)',
        },
        primary: {
          50: 'rgb(var(--color-primary-50) / <alpha-value>)',
          100: 'rgb(var(--color-primary-100) / <alpha-value>)',
          200: 'rgb(var(--color-primary-200) / <alpha-value>)',
          300: 'rgb(var(--color-primary-300) / <alpha-value>)',
          400: 'rgb(var(--color-primary-400) / <alpha-value>)',
          500: 'rgb(var(--color-primary-500) / <alpha-value>)',
          600: 'rgb(var(--color-primary-600) / <alpha-value>)',
          700: 'rgb(var(--color-primary-700) / <alpha-value>)',
          800: 'rgb(var(--color-primary-800) / <alpha-value>)',
          900: 'rgb(var(--color-primary-900) / <alpha-value>)',
        },
        dark: 'rgb(var(--color-dark) / <alpha-value>)',
        // 主题颜色系统
        'theme-bg': 'rgb(var(--color-theme-bg) / <alpha-value>)',
        'theme-surface': 'rgb(var(--color-theme-surface) / <alpha-value>)',
        'theme-accent': 'rgb(var(--color-theme-accent) / <alpha-value>)',
        'theme-text': 'rgb(var(--color-theme-text) / <alpha-value>)',
        'theme-text-secondary': 'rgb(var(--color-theme-text-secondary) / <alpha-value>)',
        'theme-border': 'rgb(var(--color-theme-border) / <alpha-value>)',
        // 扩展主题颜色
        'theme-success': 'rgb(var(--color-theme-success) / <alpha-value>)',
        'theme-warning': 'rgb(var(--color-theme-warning) / <alpha-value>)',
        'theme-error': 'rgb(var(--color-theme-error) / <alpha-value>)',
        'theme-info': 'rgb(var(--color-theme-info) / <alpha-value>)',
      },
      keyframes: {
        flicker: {
          '0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100%': {
            opacity: '0.99',
            filter:
              'drop-shadow(0 0 1px rgba(252, 211, 77)) drop-shadow(0 0 15px rgba(245, 158, 11)) drop-shadow(0 0 1px rgba(252, 211, 77))',
          },
          '20%, 21.999%, 63%, 63.999%, 65%, 69.999%': {
            opacity: '0.4',
            filter: 'none',
          },
        },
        shimmer: {
          '0%': {
            backgroundPosition: '-700px 0',
          },
          '100%': {
            backgroundPosition: '700px 0',
          },
        },
        fadeIn: {
          '0%': { opacity: '0' },
          '100%': { opacity: '1' },
        },
        slideUp: {
          '0%': { transform: 'translateY(10px)', opacity: '0' },
          '100%': { transform: 'translateY(0)', opacity: '1' },
        },
        slideDown: {
          '0%': { transform: 'translateY(-10px)', opacity: '0' },
          '100%': { transform: 'translateY(0)', opacity: '1' },
        },
        slideInFromRight: {
          '0%': { transform: 'translateX(100%)', opacity: '0' },
          '100%': { transform: 'translateX(0)', opacity: '1' },
        },
      },
      animation: {
        flicker: 'flicker 3s linear infinite',
        shimmer: 'shimmer 1.3s linear infinite',
        'fade-in': 'fadeIn 0.3s ease-in-out',
        'slide-up': 'slideUp 0.3s ease-in-out',
        'slide-down': 'slideDown 0.3s ease-in-out',
        'slide-in-from-right': 'slideInFromRight 0.3s ease-out',
      },
      backgroundImage: {
        'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
        'gradient-conic':
          'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
      },
    },
  },
  plugins: [require('@tailwindcss/forms')],
} satisfies Config;

export default config;
