import 'package:flutter/material.dart';

/// 数字货币应用颜色系统
///
/// 设计原则:
/// 1. 所有文字与背景对比度 >= 4.5:1 (WCAG AA)
/// 2. 涨跌色使用国际通用标准 (绿涨红跌)
/// 3. 背景色层次分明，易于区分
/// 4. 杜绝文字和背景颜色一样无法区分的情况
class AppColors {
  AppColors._();

  // ============================================
  // 品牌色 (Brand Colors) - 专业蓝
  // ============================================

  /// 主色 - 专业蓝，代表信任与稳定
  static const Color primary = Color(0xFF2563EB);
  static const Color primaryLight = Color(0xFF3B82F6);
  static const Color primaryDark = Color(0xFF1D4ED8);

  /// 主色渐变 - 用于卡片、按钮等
  static const LinearGradient primaryGradient = LinearGradient(
    colors: [primary, primaryDark],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );

  // ============================================
  // 交易色 (Trading Colors)
  // ============================================

  /// 涨/买入 - 标准绿色 (国际通用)
  static const Color up = Color(0xFF00C853);

  /// 跌/卖出 - 标准红色 (国际通用)
  static const Color down = Color(0xFFFF5252);

  /// 买入按钮渐变
  static const LinearGradient buyGradient = LinearGradient(
    colors: [Color(0xFF00C853), Color(0xFF00A844)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );

  /// 卖出按钮渐变
  static const LinearGradient sellGradient = LinearGradient(
    colors: [Color(0xFFFF5252), Color(0xFFD32F2F)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );

  // ============================================
  // 功能色 (Semantic Colors)
  // ============================================

  /// 成功
  static const Color success = Color(0xFF00C853);

  /// 警告
  static const Color warning = Color(0xFFFF9800);

  /// 错误
  static const Color error = Color(0xFFFF5252);

  /// 信息
  static const Color info = Color(0xFF2196F3);

  /// 充值
  static const Color deposit = Color(0xFF00C853);

  /// 提现
  static const Color withdraw = Color(0xFFFF9800);

  /// 划转/交易
  static const Color trade = Color(0xFF2196F3);

  // ============================================
  // 背景色 (Dark Theme Backgrounds)
  // ============================================

  /// 页面背景 - 最深
  static const Color background = Color(0xFF0F0F1A);

  /// 卡片背景 - 中等深度
  static const Color cardBackground = Color(0xFF1A1A2E);

  /// 输入框背景 - 稍浅
  static const Color inputBackground = Color(0xFF16213E);

  /// Scaffold 背景 (兼容旧代码)
  static const Color scaffoldBackground = Color(0xFF0F0F1A);

  /// 模态框背景
  static const Color modalBackground = Color(0xFF1E1E32);

  // ============================================
  // 文字颜色 (Text Colors)
  // ============================================

  /// 主要文字 - 白色，对比度 21:1
  static const Color textPrimary = Color(0xFFFFFFFF);

  /// 次要文字 - 浅灰蓝，对比度约 8:1
  static const Color textSecondary = Color(0xFFB0B0C0);

  /// 提示文字 - 中灰，对比度约 4.7:1
  static const Color textHint = Color(0xFF6B6B80);

  /// 禁用文字 - 暗灰
  static const Color textDisabled = Color(0xFF4A4A5A);

  /// 链接文字 - 品牌蓝
  static const Color textLink = Color(0xFF2563EB);

  // ============================================
  // 边框与分割线 (Borders & Dividers)
  // ============================================

  /// 边框 - 低透明度白色
  static const Color border = Color(0x14FFFFFF); // 8% white

  /// 分割线 - 更低透明度
  static const Color divider = Color(0x0FFFFFFF); // 6% white

  /// 输入框边框
  static const Color inputBorder = Color(0x1AFFFFFF); // 10% white

  /// 输入框聚焦边框 - 品牌蓝
  static const Color inputFocusBorder = Color(0xFF2563EB);

  // ============================================
  // 便捷方法
  // ============================================

  /// 根据涨跌获取颜色
  static Color getChangeColor(bool isUp) => isUp ? up : down;

  /// 获取带透明度的涨跌背景色
  static Color getChangeBackgroundColor(bool isUp) =>
      isUp ? up.withValues(alpha: 0.15) : down.withValues(alpha: 0.15);

  /// 渐变色 (兼容旧代码) - 品牌蓝
  static const List<Color> gradientColors = [Color(0xFF2563EB), Color(0xFF1D4ED8)];
}
