import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';
import '../../../components/spacer/spacer.dart';

class HomeFeatureTile extends StatelessWidget {
  final String title;
  final String iconPath;
  final Function() onTap;
  final bool isHighlighted;

  const HomeFeatureTile({
    super.key,
    required this.title,
    required this.iconPath,
    required this.onTap,
    this.isHighlighted = false,
  });

  @override
  Widget build(BuildContext context) {
    final double iconSize = isHighlighted ? 72 : 56;
    final double borderRadius = isHighlighted ? 20 : 16;

    return Expanded(
      child: InkWell(
        onTap: onTap,
        borderRadius: BorderRadius.circular(AppValue.radius),
        child: Container(
          padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 6),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Container(
                width: iconSize,
                height: iconSize,
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    colors: [
                      AppColor.primary.withOpacity(0.1),
                      AppColor.primary.withOpacity(0.05),
                    ],
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                  ),
                  borderRadius: BorderRadius.circular(borderRadius),
                ),
                child: Image.asset(iconPath),
              ),
              const SpaceHeight(12),
              Text(
                title,
                style: AppStyle.xs.copyWith(
                  fontWeight: isHighlighted ? FontWeight.w700 : FontWeight.w600,
                  color: isHighlighted
                      ? const Color(0xFF388E3C)
                      : AppColor.textPrimary,
                  letterSpacing: -0.2,
                ),
                textAlign: TextAlign.center,
                maxLines: 2,
                overflow: TextOverflow.ellipsis,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
