import 'package:flutter/material.dart';

/// TBOSS OA 标准色彩体系
///
/// 从主色 #00ABF3 (H=199° S=100%) 在 HSL 空间推导完整色板。
/// 亮色主题 + 深色主题（感知等价）。
class AppColors {
  AppColors._();

  // ═══════════════════════════════════════════
  //  品牌色梯度（H=199° S=100% L 渐变）
  // ═══════════════════════════════════════════
  static const Color primary50 = Color(0xFFE6F9FE);   // L=95% 最浅背景
  static const Color primary100 = Color(0xFFB3EDFC);  // L=85% Tag 浅底
  static const Color primary200 = Color(0xFF80DFFA);  // L=74% hover
  static const Color primary300 = Color(0xFF4DD1F8);  // L=64% 边框
  static const Color primary400 = Color(0xFF1ABEF5);  // L=53% 次级按钮
  static const Color primary500 = Color(0xFF00ABF3);  // L=48% ★ 主色
  static const Color primary600 = Color(0xFF0089C4);  // L=38% 按压态
  static const Color primary700 = Color(0xFF006794);  // L=29% 深色文字
  static const Color primary800 = Color(0xFF004563);  // L=19% 深色底
  static const Color primary900 = Color(0xFF002233);  // L=10% 最深

  // ── 兼容旧名 ──
  static const Color primary = primary500;
  static const Color primaryActive = primary600;
  static const Color primaryLight = primary100;

  // ═══════════════════════════════════════════
  //  中性灰（用于文本/背景/分割线）
  // ═══════════════════════════════════════════
  static const Color gray50 = Color(0xFFF9FAFB);
  static const Color gray100 = Color(0xFFF2F4F6);
  static const Color gray200 = Color(0xFFE5E8EB);
  static const Color gray300 = Color(0xFFD1D6DB);   // 占位符 / 禁用文字
  static const Color gray400 = Color(0xFF9CA3AF);
  static const Color gray500 = Color(0xFF6B7280);   // 二级文字
  static const Color gray600 = Color(0xFF4B5563);
  static const Color gray700 = Color(0xFF374151);
  static const Color gray800 = Color(0xFF1F2937);   // 主文字
  static const Color gray900 = Color(0xFF111827);   // 最深文字（极少用）

  // ── 文本三档 ──
  static const Color textPrimary = Color(0xFF1F2937);    // #1F2937 WCAG AAA
  static const Color textSecondary = Color(0xFF6B7280);  // #6B7280 WCAG AA
  static const Color textPlaceholder = Color(0xFFD1D6DB); // #D1D6DB WCAG AA（白底 4.5:1）
  static const Color textDisabled = Color(0xFFD1D6DB);
  static const Color statusGray = Color(0xFF9CA3AF);

  // ── 背景三档 ──
  static const Color bgPage = Color(0xFFF2F4F6);    // 页面底
  static const Color bgCard = Color(0xFFFFFFFF);    // 卡片/表单
  static const Color bgDisabled = Color(0xFFE5E8EB); // 禁用态

  // ── 边框 ──
  static const Color border = Color(0xFFE5E8EB);

  // ═══════════════════════════════════════════
  //  语义色
  // ═══════════════════════════════════════════
  static const Color success = Color(0xFF0EA371);       // 成功/已通过
  static const Color successBg = Color(0xFFE6F9F2);     // 成功浅底
  static const Color warning = Color(0xFFE37318);       // 警告/审批中
  static const Color warningBg = Color(0xFFFFF3E8);     // 警告浅底
  static const Color danger = Color(0xFFDC2626);        // 危险/已拒绝/删除
  static const Color dangerBg = Color(0xFFFEF2F2);      // 危险浅底

  // ═══════════════════════════════════════════
  //  金额色（独立于成功/危险语义）
  // ═══════════════════════════════════════════
  static const Color amountPositive = Color(0xFF1D7AB5); // 正金额（品牌蓝，区分 success）
  static const Color amountNegative = Color(0xFFDC2626); // 负金额/超支
  static const Color amountNeutral = Color(0xFF6B7280);  // 普通数值

  // ── 兼容旧名 ──
  static const Color amountPrimary = amountPositive;

  // ═══════════════════════════════════════════
  //  信息色（已还车/已付款/GPS/时间线）
  // ═══════════════════════════════════════════
  static const Color infoText = Color(0xFF3B82C4);
  static const Color infoBg = Color(0xFFEBF4FC);
  static const Color infoLightBg = Color(0xFFF0F7FD);
  static const Color infoBorder = Color(0xFFC8DFF0);
  static const Color timelineInactive = Color(0xFFE5E8EB);

  // ═══════════════════════════════════════════
  //  支付状态色
  // ═══════════════════════════════════════════
  static const Color paidText = Color(0xFF2563B0);      // 已付款-深蓝
  static const Color paidBg = Color(0xFFEBF4FC);        // 已付款-浅蓝
  static const Color unpaidText = Color(0xFFCA8A04);    // 待付款-琥珀
  static const Color unpaidBg = Color(0xFFFFF9EB);      // 待付款-浅琥珀

  // ═══════════════════════════════════════════
  //  撤回/草稿/过期
  // ═══════════════════════════════════════════
  static const Color revokedText = Color(0xFF7C6F8A);
  static const Color revokedBg = Color(0xFFF4F2F5);
  static const Color bgExpired = Color(0xFFF9FAFB);
  static const Color swipeDeleteBg = Color(0xFFF2F4F6);

  // ═══════════════════════════════════════════
  //  图表色（fl_chart）
  // ═══════════════════════════════════════════
  static const Color chart1 = primary500;
  static const Color chart2 = Color(0xFF0EA371);
  static const Color chart3 = Color(0xFFE37318);
  static const Color chart4 = Color(0xFF8B5CF6);
  static const Color chart5 = Color(0xFF3B82C4);

  // ═══════════════════════════════════════════
  //  遮罩 / 高亮
  // ═══════════════════════════════════════════
  static const Color overlay = Color(0x66000000);       // 弹窗蒙层 40%
  static const Color highlight = Color(0xFFE6F9FE);     // 列表选中高亮（primary50）
}

/// 深色主题 — 感知等价映射
///
/// 原则：降低饱和度、提高明度下限、压缩对比度
class AppDarkColors {
  AppDarkColors._();

  // ── 品牌色梯度（主色保持，浅色调暗）──
  static const Color primary50 = Color(0xFF0D2430);
  static const Color primary100 = Color(0xFF103545);
  static const Color primary200 = Color(0xFF13475C);
  static const Color primary300 = Color(0xFF165973);
  static const Color primary400 = Color(0xFF19708E);
  static const Color primary500 = Color(0xFF00ABF3);
  static const Color primary600 = Color(0xFF33BBF5);
  static const Color primary700 = Color(0xFF66CCF8);
  static const Color primary800 = Color(0xFF99DDFA);
  static const Color primary900 = Color(0xFFCCEEFD);

  static const Color primary = primary500;
  static const Color primaryActive = Color(0xFF0089C4);
  static const Color primaryLight = primary100;

  // ── 中性灰 ──
  static const Color gray50 = Color(0xFF0D0D0D);
  static const Color gray100 = Color(0xFF1A1A1A);
  static const Color gray200 = Color(0xFF262626);
  static const Color gray300 = Color(0xFF404040);
  static const Color gray400 = Color(0xFF595959);
  static const Color gray500 = Color(0xFF808080);
  static const Color gray600 = Color(0xFFA6A6A6);
  static const Color gray700 = Color(0xFFBFBFBF);
  static const Color gray800 = Color(0xFFD9D9D9);
  static const Color gray900 = Color(0xFFF2F2F2);

  // ── 文本三档 ──
  static const Color textPrimary = Color(0xFFE6E6E6);
  static const Color textSecondary = Color(0xFFA6A6A6);
  static const Color textPlaceholder = Color(0xFF595959);
  static const Color textDisabled = Color(0xFF595959);
  static const Color statusGray = Color(0xFF808080);

  // ── 背景三档 ──
  static const Color bgPage = Color(0xFF0D0D0D);
  static const Color bgCard = Color(0xFF1A1A1A);
  static const Color bgDisabled = Color(0xFF262626);

  static const Color border = Color(0xFF333333);

  // ── 语义色（饱和度微降，适配深色底）──
  static const Color success = Color(0xFF22C55E);
  static const Color successBg = Color(0xFF052E16);
  static const Color warning = Color(0xFFF59E0B);
  static const Color warningBg = Color(0xFF2D1B06);
  static const Color danger = Color(0xFFEF4444);
  static const Color dangerBg = Color(0xFF2D0A0A);

  // ── 金额色 ──
  static const Color amountPositive = Color(0xFF5BB8F0); // 正金额（亮蓝，适配深色底）
  static const Color amountNegative = Color(0xFFEF4444);
  static const Color amountNeutral = Color(0xFFA6A6A6);
  static const Color amountPrimary = amountPositive;

  // ── 信息色 ──
  static const Color infoText = Color(0xFF6AA8E6);
  static const Color infoBg = Color(0xFF0E1F33);
  static const Color infoLightBg = Color(0xFF112238);
  static const Color infoBorder = Color(0xFF1E3D5C);
  static const Color timelineInactive = Color(0xFF333333);

  // ── 支付状态 ──
  static const Color paidText = Color(0xFF6AA8E6);
  static const Color paidBg = Color(0xFF0E1F33);
  static const Color unpaidText = Color(0xFFFBBF24);
  static const Color unpaidBg = Color(0xFF2D1B06);

  // ── 撤回/草稿/过期 ──
  static const Color revokedText = Color(0xFF9A8DA0);
  static const Color revokedBg = Color(0xFF1E1A22);
  static const Color bgExpired = Color(0xFF1A1A1A);
  static const Color swipeDeleteBg = Color(0xFF262626);

  // ── 图表 ──
  static const Color chart1 = primary500;
  static const Color chart2 = Color(0xFF22C55E);
  static const Color chart3 = Color(0xFFF59E0B);
  static const Color chart4 = Color(0xFFA78BFA);
  static const Color chart5 = Color(0xFF6AA8E6);

  // ── 遮罩 ──
  static const Color overlay = Color(0xCC000000);
  static const Color highlight = Color(0xFF0D2430);
}

/// Pencil 设计字号体系
class AppFontSizes {
  AppFontSizes._();

  static const double caption = 12;
  static const double body = 14;
  static const double subtitle = 16;
  static const double title = 18;
}

/// Pencil 设计间距体系
class AppSpacing {
  AppSpacing._();

  static const double xs = 4;
  static const double sm = 8;
  static const double md = 16;
  static const double lg = 24;
  static const double xl = 32;
}
