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

/// Ligne d'événement à venir — style fintech avec bordure gauche verte
/// Titre + date + countdown optionnel + participants optionnel
class DashboardEventRow extends StatelessWidget {
  final String title;
  final String date;
  final String? daysUntil;
  final String? participants;

  const DashboardEventRow({
    super.key,
    required this.title,
    required this.date,
    this.daysUntil,
    this.participants,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(bottom: 6),
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 9),
      decoration: BoxDecoration(
        color: UnionFlowColors.surface,
        borderRadius: BorderRadius.circular(8),
        border: const Border(
          left: BorderSide(color: UnionFlowColors.unionGreen, width: 3),
        ),
      ),
      child: Row(
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  title,
                  style: const TextStyle(
                    fontSize: 12,
                    fontWeight: FontWeight.w600,
                    color: UnionFlowColors.textPrimary,
                  ),
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                ),
                const SizedBox(height: 2),
                Text(
                  date,
                  style: const TextStyle(
                    fontSize: 10,
                    color: UnionFlowColors.textSecondary,
                  ),
                ),
              ],
            ),
          ),
          if (daysUntil != null || participants != null)
            Column(
              crossAxisAlignment: CrossAxisAlignment.end,
              children: [
                if (daysUntil != null)
                  Text(
                    daysUntil!,
                    style: const TextStyle(
                      fontSize: 10,
                      fontWeight: FontWeight.w600,
                      color: UnionFlowColors.unionGreen,
                    ),
                  ),
                if (participants != null) ...[
                  const SizedBox(height: 2),
                  Text(
                    participants!,
                    style: const TextStyle(
                      fontSize: 10,
                      color: UnionFlowColors.textTertiary,
                    ),
                  ),
                ],
              ],
            ),
        ],
      ),
    );
  }
}
