import 'package:flutter/material.dart';
import '../tokens/unionflow_colors.dart';

/// Card de balance UnionFlow - Affichage élégant du solde principal
class UnionBalanceCard extends StatelessWidget {
  final String label;
  final String amount;
  final String? trend;
  final bool? isTrendPositive;
  final VoidCallback? onTap;

  const UnionBalanceCard({
    super.key,
    required this.label,
    required this.amount,
    this.trend,
    this.isTrendPositive,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: const EdgeInsets.all(20),
        decoration: BoxDecoration(
          color: UnionFlowColors.surface,
          borderRadius: BorderRadius.circular(16),
          boxShadow: UnionFlowColors.softShadow,
          // Bordure dorée subtile en haut
          border: const Border(
            top: BorderSide(
              color: UnionFlowColors.gold,
              width: 3,
            ),
          ),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            // Label
            Text(
              label.toUpperCase(),
              style: const TextStyle(
                fontSize: 11,
                fontWeight: FontWeight.w600,
                color: UnionFlowColors.textSecondary,
                letterSpacing: 0.8,
              ),
            ),
            const SizedBox(height: 8),

            // Montant principal
            Text(
              amount,
              style: const TextStyle(
                fontSize: 32,
                fontWeight: FontWeight.w700,
                color: UnionFlowColors.unionGreen,
                height: 1.2,
              ),
            ),

            // Trend (optionnel)
            if (trend != null) ...[
              const SizedBox(height: 10),
              Row(
                children: [
                  Icon(
                    isTrendPositive == true
                        ? Icons.trending_up
                        : Icons.trending_down,
                    size: 16,
                    color: isTrendPositive == true
                        ? UnionFlowColors.success
                        : UnionFlowColors.error,
                  ),
                  const SizedBox(width: 4),
                  Text(
                    trend!,
                    style: TextStyle(
                      fontSize: 13,
                      fontWeight: FontWeight.w600,
                      color: isTrendPositive == true
                          ? UnionFlowColors.success
                          : UnionFlowColors.error,
                    ),
                  ),
                ],
              ),
            ],
          ],
        ),
      ),
    );
  }
}
