import 'package:flutter/material.dart';
import '../../core/theme/app_theme.dart';

/// 通用卡片组件 - 明亮工业风格
class CommonCard extends StatelessWidget {
  final Widget child;
  final VoidCallback? onTap;
  final bool selected;
  final EdgeInsetsGeometry? padding;
  final EdgeInsetsGeometry? margin;

  const CommonCard({
    super.key,
    required this.child,
    this.onTap,
    this.selected = false,
    this.padding,
    this.margin,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin ?? const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
      child: Material(
        color: selected ? AppTheme.bgCardHover : AppTheme.bgCard,
        borderRadius: BorderRadius.circular(AppTheme.radiusMd),
        elevation: 0,
        child: InkWell(
          onTap: onTap,
          borderRadius: BorderRadius.circular(AppTheme.radiusMd),
          child: Container(
            padding: padding ?? const EdgeInsets.all(16),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(AppTheme.radiusMd),
              border: selected
                  ? Border.all(color: AppTheme.primaryColor, width: 2)
                  : Border.all(color: AppTheme.borderLight, width: 1),
              boxShadow: AppTheme.shadowCard,
            ),
            child: child,
          ),
        ),
      ),
    );
  }
}
