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

/// En-tête de section dashboard — titre 13px w700 avec trailing optionnel
/// Adaptatif dark/light via AppColors
class UFSectionHeader extends StatelessWidget {
  final String title;

  /// Texte secondaire affiché à droite : "· trailing"
  final String? trailing;

  const UFSectionHeader(this.title, {this.trailing, super.key});

  @override
  Widget build(BuildContext context) {
    final isDark        = Theme.of(context).brightness == Brightness.dark;
    final titleColor    = isDark ? AppColors.textPrimaryDark   : AppColors.textPrimary;
    final trailingColor = isDark ? AppColors.textSecondaryDark : AppColors.textTertiary;

    return Row(
      children: [
        Text(
          title,
          style: TextStyle(fontSize: 13, fontWeight: FontWeight.w700, color: titleColor),
        ),
        if (trailing != null && trailing!.isNotEmpty) ...[
          const SizedBox(width: 6),
          Text(
            '· $trailing',
            style: TextStyle(fontSize: 11, color: trailingColor),
          ),
        ],
      ],
    );
  }
}
