import 'package:flutter/material.dart';

import '../theme/kc_colors.dart';
import '../theme/kc_spacing.dart';
import 'kc_card.dart';

/// A reusable empty-state panel shown when a section has no data yet.
///
/// Displays an [icon], a [message], and an optional [action] widget
/// (e.g. a button to create the first item). Wraps content in a [KcCard].
class KcEmptyState extends StatelessWidget {
  final IconData icon;
  final String message;
  final Widget? action;

  const KcEmptyState({super.key, required this.icon, required this.message, this.action});

  @override
  Widget build(BuildContext context) {
    return KcCard(
      child: Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: KcSpacing.xl),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Icon(icon, size: 48, color: KcColors.neutral),
              const SizedBox(height: KcSpacing.md),
              Text(
                message,
                style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: KcColors.neutral),
                textAlign: TextAlign.center,
              ),
              if (action != null) ...[const SizedBox(height: KcSpacing.md), action!],
            ],
          ),
        ),
      ),
    );
  }
}
