import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const jinzhiLightScheme = ShadColorScheme(
  background: Color(0xFFFBFAF7),
  foreground: Color(0xFF1A1A17),
  card: Color(0xFFFFFFFF),
  cardForeground: Color(0xFF1A1A17),
  popover: Color(0xFFFFFFFF),
  popoverForeground: Color(0xFF1A1A17),
  primary: Color(0xFFB5862A),
  primaryForeground: Color(0xFFFFFFFF),
  secondary: Color(0xFFF6ECD6),
  secondaryForeground: Color(0xFF7A5B12),
  muted: Color(0xFFF1EFE9),
  mutedForeground: Color(0xFF8A8780),
  accent: Color(0xFFF6ECD6),
  accentForeground: Color(0xFF7A5B12),
  destructive: Color(0xFFC0392B),
  destructiveForeground: Color(0xFFFFFFFF),
  border: Color(0xFFECEAE3),
  input: Color(0xFFECEAE3),
  ring: Color(0xFFB5862A),
  selection: Color(0xFF1A1A17),
);

/// Hero 卡描边 = demo `--brand-soft-border`（比 brand-soft 填充更深一档的绿）。
/// ShadColorScheme 无对应 slot，单列于此（色值仍集中在 theme，widget 不写 hex）；
/// widget 按 brightness 取值。light=oklch(0.9 0.07 128)、dark=oklch(0.42 0.07 131)。
const jinzhiBrandSoftBorderLight = Color(0xFFE3D6B4);
const jinzhiBrandSoftBorderDark = Color(0xFF5E4A22);

Color brandSoftBorder(Brightness b) => b == Brightness.dark
    ? jinzhiBrandSoftBorderDark
    : jinzhiBrandSoftBorderLight;

/// Hero（brand-soft 绿底）上的副/弱文本色。
/// 规范：次级文本是**中性 muted**，不挪用语义色（accentForeground 是链接/强调专用）。
/// 浅绿底上灰 muted(#8E8E93) 对比不足，故用 foreground 降透明的**中性深灰**
/// （叠在绿底上自然带轻微绿调、和谐且达 AA）；深色底仍用灰 muted（已够对比）。
Color brandSoftMutedForeground(Brightness b, ShadColorScheme cs) =>
    b == Brightness.dark
    ? cs.mutedForeground
    : cs.foreground.withValues(alpha: 0.7);

/// 危险警示卡 soft-tint（demo `.da-warn`，与 brand-soft 同语言的 destructive 变体）。
const jinzhiDestructiveSoftLight = Color(0xFFFBEDEA);
const jinzhiDestructiveSoftBorderLight = Color(0xFFE8C7BF);
const jinzhiDestructiveSoftDark = Color(0x1AEF4444);
const jinzhiDestructiveSoftBorderDark = Color(0x52EF4444);

Color destructiveSoft(Brightness b) => b == Brightness.dark
    ? jinzhiDestructiveSoftDark
    : jinzhiDestructiveSoftLight;

Color destructiveSoftBorder(Brightness b) => b == Brightness.dark
    ? jinzhiDestructiveSoftBorderDark
    : jinzhiDestructiveSoftBorderLight;

const jinzhiDarkScheme = ShadColorScheme(
  background: Color(0xFF0F0F0F),
  foreground: Color(0xFFF0F0F0),
  card: Color(0xFF1A1A1A),
  cardForeground: Color(0xFFF0F0F0),
  popover: Color(0xFF1A1A1A),
  popoverForeground: Color(0xFFF0F0F0),
  primary: Color(0xFFD9B45D),
  primaryForeground: Color(0xFF1A1A17),
  secondary: Color(0xFF27272A),
  secondaryForeground: Color(0xFFF0F0F0),
  muted: Color(0xFF262626),
  mutedForeground: Color(0xFFA1A1AA),
  accent: Color(0xFF3A2A0D),
  accentForeground: Color(0xFFD9B45D),
  destructive: Color(0xFFEF4444),
  destructiveForeground: Color(0xFFFFFFFF),
  border: Color(0x1FFFFFFF),
  input: Color(0x26FFFFFF),
  ring: Color(0xFFD9B45D),
  selection: Color(0xFFF0F0F0),
);
