import 'package:flutter/material.dart';

class AppHeader extends StatelessWidget implements PreferredSizeWidget {
  const AppHeader({super.key});

  @override
  Size get preferredSize => const Size.fromHeight(60);

  @override
  Widget build(BuildContext context) {
    return AppBar(
      backgroundColor: const Color(0xFFb8e6e1),
      elevation: 2,
      title: Row(
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              const Text(
                'Nhance',
                style: TextStyle(
                  fontSize: 24,
                  fontWeight: FontWeight.bold,
                  color: Color(0xFF00acc1),
                ),
              ),
              const Text(
                'Partner',
                style: TextStyle(fontSize: 10, color: Color(0xFF666666)),
              ),
            ],
          ),
        ],
      ),
      actions: [
        TextButton(
          onPressed: () {},
          child: const Text(
            'Dashboard',
            style: TextStyle(color: Colors.black87),
          ),
        ),
        TextButton(
          onPressed: () {},
          child: const Text('Enquiry', style: TextStyle(color: Colors.black87)),
        ),
        PopupMenuButton<String>(
          child: const Padding(
            padding: EdgeInsets.symmetric(horizontal: 16),
            child: Row(
              children: [
                Text('Users', style: TextStyle(color: Colors.black87)),
                Icon(Icons.arrow_drop_down, color: Colors.black87),
              ],
            ),
          ),
          itemBuilder: (context) => [
            const PopupMenuItem(value: 'staff', child: Text('Staff')),
            const PopupMenuItem(value: 'agent', child: Text('Agent')),
          ],
        ),
        PopupMenuButton<String>(
          child: const Padding(
            padding: EdgeInsets.symmetric(horizontal: 16),
            child: Row(
              children: [
                Text('Reports', style: TextStyle(color: Colors.black87)),
                Icon(Icons.arrow_drop_down, color: Colors.black87),
              ],
            ),
          ),
          itemBuilder: (context) => [
            const PopupMenuItem(value: 'claims', child: Text('Claims')),
            const PopupMenuItem(
              value: 'endorsement',
              child: Text('Endorsement'),
            ),
          ],
        ),
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
          child: PopupMenuButton<String>(
            child: Container(
              padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(6),
              ),
              child: Row(
                children: [
                  const Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      Text(
                        'John Doe',
                        style: TextStyle(fontWeight: FontWeight.w600),
                      ),
                      Text(
                        'Administrator',
                        style: TextStyle(fontSize: 11, color: Colors.grey),
                      ),
                    ],
                  ),
                  const SizedBox(width: 10),
                  CircleAvatar(
                    radius: 18,
                    backgroundColor: const Color(0xFF4a90e2),
                    child: const Text(
                      'JD',
                      style: TextStyle(
                        color: Colors.white,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                ],
              ),
            ),
            itemBuilder: (context) => [
              const PopupMenuItem(
                value: 'profile',
                child: Text('👤 Profile Details'),
              ),
              const PopupMenuItem(value: 'logout', child: Text('🚪 Logout')),
            ],
          ),
        ),
      ],
    );
  }
}
