import 'package:citycards_customer/common_packages/app_bar.dart';
import 'package:citycards_customer/common_packages/custom_textfield.dart';
import 'package:flutter/material.dart';
import 'package:citycards_customer/common_packages/custom_text.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

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

  @override
  Widget build(BuildContext context) {
    final TextEditingController firstNameController = TextEditingController();
    final TextEditingController lastNameController = TextEditingController();
    final TextEditingController emailController = TextEditingController();
    final TextEditingController phoneController = TextEditingController();
    final TextEditingController addressController = TextEditingController();

    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: SingleChildScrollView(
          padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              // Header
              CommonAppBar(isWhiteLogo: false, isProfilePage: true),
              SizedBox(height: 12.h),
              Divider(height: 1.h, color: Color(0xFFD9D9D9)),
              SizedBox(height: 22.h),

              // Back + title
              Row(
                children: [
                  GestureDetector(
                    onTap: () {
                      Navigator.pop(context);
                    },
                    child: Icon(Icons.arrow_back, size: 24.sp),
                  ),
                  SizedBox(width: 8.w),
                  Text(
                    "Edit Profile",
                    style: TextStyle(
                      fontSize: 12.sp,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ],
              ),
              SizedBox(height: 33.h),

              // Profile Image
              CircleAvatar(
                radius: 38.r,
                backgroundImage: AssetImage("assets/images/profile_img.png"),
              ),
              SizedBox(height: 18.h),
              Text(
                "Change Profile Picture",
                style: TextStyle(
                  fontSize: 12.sp,
                  color: Color(0xFFF95F62),
                  fontWeight: FontWeight.w400,
                ),
              ),
              SizedBox(height: 40.h),

              // Personal Information
              Align(
                alignment: Alignment.centerLeft,
                child: CustomText(
                  text: "Personal Information",
                  size: 18.sp,
                  weight: FontWeight.w500,
                ),
              ),
              SizedBox(height: 12.h),

              Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.w),
                child: CustomTextField(
                  label: "First Name",
                  hint: "Enter your first name",
                  controller: firstNameController,
                ),
              ),
              Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.w),
                child: CustomTextField(
                  label: "Last Name",
                  hint: "Enter your last name",
                  controller: lastNameController,
                ),
              ),
              Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.w),
                child: CustomTextField(
                  label: "Email",
                  hint: "Enter your email address",
                  controller: emailController,
                ),
              ),
              Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.w),
                child: CustomTextField(
                  label: "Phone Number",
                  hint: "Enter your phone number",
                  controller: phoneController,
                ),
              ),

              SizedBox(height: 2.h),

              // Location Details
              Align(
                alignment: Alignment.centerLeft,
                child: CustomText(
                  text: "Location Details",
                  size: 18.sp,
                  weight: FontWeight.w500,
                ),
              ),
              SizedBox(height: 16.h),

              Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.0.w),
                child: CustomTextField(
                  label: "Address 1",
                  hint: "Enter address manually or tap to search",
                  controller: addressController,
                ),
              ),

              SizedBox(height: 26.h),

              // Buttons
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  Expanded(
                    child: OutlinedButton(
                      style: OutlinedButton.styleFrom(
                        foregroundColor: const Color(0xFFF95F62),
                        side: const BorderSide(color: Colors.transparent),
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(38.r),
                        ),
                        padding: EdgeInsets.symmetric(vertical: 12.h),
                      ),
                      onPressed: () {},
                      child: Text(
                        "Cancel",
                        style: TextStyle(
                          fontSize: 16.sp,
                          fontWeight: FontWeight.w500,
                        ),
                      ),
                    ),
                  ),
                  SizedBox(width: 16.w),
                  Expanded(
                    child: ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: const Color(0xFFF95F62),
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(38.r),
                        ),
                        padding: EdgeInsets.symmetric(vertical: 6.h),
                      ),
                      onPressed: () {},
                      child: Text(
                        "Save",
                        style: TextStyle(
                          fontSize: 16.sp,
                          fontWeight: FontWeight.w500,
                          color: Colors.white,
                        ),
                      ),
                    ),
                  ),
                ],
              ),
              SizedBox(height: 20.h),
            ],
          ),
        ),
      ),
    );
  }
}
