import type { ThemeTokens } from './tokens';

/**
 * 预置主题 —— 「明亮 Bento 现代风」（docs/ui-redesign-design.md §3）。
 * 浅色为默认；暗色为 OLED 纯黑完整对等主题。
 * accent 为近黑白单色：品牌感靠排版与财务语义色表达。
 */

export const lightTheme: ThemeTokens = {
  colors: {
    bgPrimary: '#F6F7F9',
    bgSecondary: '#FFFFFF',
    bgTertiary: '#EFF1F4',
    fgPrimary: '#111318',
    fgSecondary: '#565F6D', // 提升文本对比度至 WCAG AA（≈ 6.0:1）
    fgInverse: '#FFFFFF',
    accent: '#111318',                 // 近黑：按钮/选中态
    accentLight: 'rgba(17,19,24,0.08)', // accent 8% 底色（选中高亮）
    accentDark: '#000000',              // 按压加深态
    success: '#10B981',
    warning: '#F59E0B',
    error: '#EF4444',
    info: '#3B82F6',
    financial: {
      income: '#10B981',
      expense: '#EF4444',
      transfer: '#3B82F6',
    },
    border: '#E5E7EB',
    divider: '#F0F1F3',
    overlay: 'rgba(17,19,24,0.4)',
    skeleton: '#E5E7EB',
    progressBg: 'rgba(17,19,24,0.06)',
  },
  spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32 },
  radii: { sm: 8, md: 12, lg: 16, xl: 24, full: 9999 },
  typography: {
    display: { fontSize: 34, fontWeight: '800', lineHeight: 42 },
    h1: { fontSize: 28, fontWeight: '700', lineHeight: 36 },
    h2: { fontSize: 22, fontWeight: '700', lineHeight: 30 },
    h3: { fontSize: 17, fontWeight: '600', lineHeight: 24 },
    body: { fontSize: 16, fontWeight: '400', lineHeight: 24 },
    bodySmall: { fontSize: 14, fontWeight: '400', lineHeight: 20 },
    caption: { fontSize: 12, fontWeight: '400', lineHeight: 16 },
  },
  shadows: {
    sm: { shadowColor: '#111318', shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.04, shadowRadius: 4, elevation: 1 },
    md: { shadowColor: '#111318', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.06, shadowRadius: 8, elevation: 2 },
    lg: { shadowColor: '#111318', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.10, shadowRadius: 12, elevation: 4 },
  },
  opacities: {
    pressed: 0.7,
    disabled: 0.4,
  },
};

export const darkTheme: ThemeTokens = {
  ...lightTheme,
  colors: {
    bgPrimary: '#040508',               // OLED 纯黑
    bgSecondary: '#101218',
    bgTertiary: '#1A1D24',
    fgPrimary: '#F3F4F6',
    fgSecondary: '#9CA3AF',
    fgInverse: '#111318',
    accent: '#F3F4F6',                  // 反转为白
    accentLight: 'rgba(243,244,246,0.10)',
    accentDark: '#FFFFFF',
    success: '#34D399',
    warning: '#FBBF24',
    error: '#F87171',
    info: '#60A5FA',
    financial: {
      income: '#34D399',                // 提亮一档保证对比度
      expense: '#F87171',
      transfer: '#60A5FA',
    },
    border: 'rgba(255,255,255,0.08)',
    divider: 'rgba(255,255,255,0.04)',
    overlay: 'rgba(0,0,0,0.7)',
    skeleton: '#1A1D24',
    progressBg: 'rgba(243,244,246,0.08)',
  },
  shadows: {
    sm: { shadowColor: '#000', shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.5, shadowRadius: 3, elevation: 2 },
    md: { shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.6, shadowRadius: 6, elevation: 4 },
    lg: { shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.7, shadowRadius: 12, elevation: 8 },
  },
};

/** 预置主题注册表。 */
export const presetThemes: Record<string, ThemeTokens> = {
  light: lightTheme,
  dark: darkTheme,
};
