import 'package:flutter/material.dart';

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

class ReportAction extends StatefulWidget {
  const ReportAction({super.key});

  @override
  State<ReportAction> createState() => _ReportActionState();
}

class _ReportActionState extends State<ReportAction> {
  final actions = [
    {
      'title': 'Laporan Detail Penjualan',
      'subtitle': 'Analisis mendalam transaksi harian',
      'icon': Icons.assignment,
      'color': AppColor.primary,
      'gradient': [AppColor.primary, AppColor.primaryLight],
    },
    {
      'title': 'Monitor Stok Produk',
      'subtitle': 'Tracking inventory real-time',
      'icon': Icons.inventory_2,
      'color': AppColor.info,
      'gradient': [AppColor.info, const Color(0xFF64B5F6)],
    },
    {
      'title': 'Analisis Keuangan',
      'subtitle': 'Profit, loss & cash flow analysis',
      'icon': Icons.account_balance_wallet,
      'color': AppColor.success,
      'gradient': [AppColor.success, AppColor.secondaryLight],
    },
  ];

  @override
  Widget build(BuildContext context) {
    return Column(
      children: actions.map((action) {
        return Container(
          margin: const EdgeInsets.only(bottom: 16),
          child: Material(
            color: Colors.transparent,
            child: InkWell(
              onTap: () {},
              borderRadius: BorderRadius.circular(20),
              child: Container(
                padding: const EdgeInsets.all(20),
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    colors: [
                      (action['color'] as Color).withOpacity(0.1),
                      (action['color'] as Color).withOpacity(0.05),
                    ],
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                  ),
                  borderRadius: BorderRadius.circular(20),
                  border: Border.all(
                    color: (action['color'] as Color).withOpacity(0.3),
                    width: 1.5,
                  ),
                ),
                child: Row(
                  children: [
                    Container(
                      padding: const EdgeInsets.all(16),
                      decoration: BoxDecoration(
                        gradient: LinearGradient(
                          colors: action['gradient'] as List<Color>,
                          begin: Alignment.topLeft,
                          end: Alignment.bottomRight,
                        ),
                        borderRadius: BorderRadius.circular(16),
                        boxShadow: [
                          BoxShadow(
                            color: (action['color'] as Color).withOpacity(0.3),
                            blurRadius: 10,
                            offset: const Offset(0, 4),
                          ),
                        ],
                      ),
                      child: Icon(
                        action['icon'] as IconData,
                        color: AppColor.white,
                        size: 28,
                      ),
                    ),
                    const SizedBox(width: 20),
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            action['title'] as String,
                            style: AppStyle.lg.copyWith(
                              color: AppColor.textPrimary,
                              fontSize: 16,
                              fontWeight: FontWeight.w600,
                            ),
                          ),
                          const SpaceHeight(4),
                          Text(
                            action['subtitle'] as String,
                            style: AppStyle.sm.copyWith(
                              color: AppColor.textSecondary,
                              fontSize: 13,
                            ),
                          ),
                        ],
                      ),
                    ),
                    Container(
                      padding: const EdgeInsets.all(8),
                      decoration: BoxDecoration(
                        color: (action['color'] as Color).withOpacity(0.1),
                        borderRadius: BorderRadius.circular(10),
                      ),
                      child: Icon(
                        Icons.arrow_forward_ios,
                        color: action['color'] as Color,
                        size: 16,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      }).toList(),
    );
  }
}
