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

class EcoFloatingButton extends StatelessWidget {
  const EcoFloatingButton({super.key});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (_) => const AiPetChatScreen()),
        );
      },
      child: Row(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          // ── Globo de texto ──
          Container(
            margin: const EdgeInsets.only(bottom: 12, right: 8),
            padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: const BorderRadius.only(
                topLeft: Radius.circular(16),
                topRight: Radius.circular(16),
                bottomLeft: Radius.circular(16),
                bottomRight: Radius.circular(4),
              ),
              boxShadow: AppTheme.softShadow,
              border: Border.all(color: AppTheme.primaryMid, width: 1.5),
            ),
            child: const Text(
              'Soy Eco, tu asistente',
              style: TextStyle(
                fontSize: 13,
                fontWeight: FontWeight.w700,
                color: AppTheme.primaryDark,
              ),
            ),
          ),

          // ── Mascota Circular (GIF) ──
          Container(
            width: 65,
            height: 65,
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              color: AppTheme.primaryLight,
              boxShadow: AppTheme.cardShadow,
              border: Border.all(color: AppTheme.primary, width: 2.5),
            ),
            clipBehavior: Clip.hardEdge,
            child: Transform.scale(
              scale:
                  1.5, // Ajusta este número si quieres el GIF más grande o pequeño
              child: Image.asset(
                'assets/animations/info.gif',
                fit: BoxFit.cover,
                errorBuilder: (context, error, stackTrace) {
                  return const Icon(
                    Icons.delete_outline,
                    color: AppTheme.primary,
                    size: 32,
                  );
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}
