import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'dart:math' as math;

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

  @override
  State<DriverVerificationScreen> createState() =>
      _DriverVerificationScreenState();
}

class _DriverVerificationScreenState extends State<DriverVerificationScreen>
    with SingleTickerProviderStateMixin {
  late final AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 2),
    )..repeat();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return Scaffold(
      backgroundColor: const Color(0xFFF8F9FA),
      body: SafeArea(
        child: Center(
          child: SingleChildScrollView(
            padding: const EdgeInsets.all(24.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                // Animated Icon
                AnimatedBuilder(
                  animation: _controller,
                  builder: (_, child) {
                    return Transform.rotate(
                      angle: _controller.value * 2 * math.pi,
                      child: child,
                    );
                  },
                  child: Icon(
                    Icons.sync,
                    size: 80,
                    color: theme.primaryColor.withOpacity(0.8),
                  ),
                ),
                const SizedBox(height: 32),

                // Title
                Text(
                  "Your Application is Under Review".tr,
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 26,
                    fontWeight: FontWeight.bold,
                    color: theme.textTheme.titleLarge?.color,
                  ),
                ),
                const SizedBox(height: 16),

                // Main Message
                Text(
                  "We have received your application to join us as a driver. Our team is currently reviewing it. Thank you for your patience."
                      .tr,
                  textAlign: TextAlign.center,
                  style: const TextStyle(
                    fontSize: 16,
                    color: Colors.black54,
                    height: 1.5,
                  ),
                ),
                const SizedBox(height: 32),

                // Notification Card
                Container(
                  padding: const EdgeInsets.all(16),
                  decoration: BoxDecoration(
                    color: theme.primaryColor.withOpacity(0.1),
                    borderRadius: BorderRadius.circular(12),
                    border: Border.all(
                      color: theme.primaryColor.withOpacity(0.3),
                      width: 1,
                    ),
                  ),
                  child: Row(
                    children: [
                      Icon(Icons.notifications_active_outlined,
                          color: theme.primaryColor, size: 30),
                      const SizedBox(width: 16),
                      Expanded(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              "You Will Be Notified".tr,
                              style: TextStyle(
                                fontSize: 16,
                                fontWeight: FontWeight.bold,
                                color: theme.primaryColor,
                              ),
                            ),
                            const SizedBox(height: 4),
                            Text(
                              "We will send you a notification as soon as your account is approved. You can safely close this page, and we'll let you know when the review is complete."
                                  .tr,
                              style: const TextStyle(
                                fontSize: 14,
                                color: Colors.black87,
                                height: 1.4,
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),

                const SizedBox(height: 40),

                // Refresh Button
                // ElevatedButton.icon(
                //   onPressed: () {
                //     // TODO: Add logic to check status from your API
                //     Get.snackbar(
                //       "Status", // This can also be a key if you want
                //       "Checking for updates...".tr,
                //       snackPosition: SnackPosition.BOTTOM,
                //     );
                //   },
                //   icon: const Icon(Icons.refresh, color: Colors.white),
                //   label: Text(
                //     "Refresh Status".tr,
                //     style: const TextStyle(fontSize: 16, color: Colors.white),
                //   ),
                //   style: ElevatedButton.styleFrom(
                //     backgroundColor: theme.primaryColor,
                //     padding: const EdgeInsets.symmetric(
                //         horizontal: 40, vertical: 15),
                //     shape: RoundedRectangleBorder(
                //       borderRadius: BorderRadius.circular(30.0),
                //     ),
                //     elevation: 3,
                //   ),
                // ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
