import 'package:flutter/material.dart';
import '../../widgets/color.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.background,
      appBar: AppBar(
        backgroundColor: Colors.white,
        surfaceTintColor: Colors.transparent,
        elevation: 0.5,
        automaticallyImplyLeading: false,
        title: Row(
          children: [
            // Logo tanpa background container
            Image.asset(
              'assets/images/Logo_Coffee_Scan.png',
              width: 30, // Ukuran disesuaikan agar proporsional
              errorBuilder: (c, e, s) => const Icon(
                Icons.coffee,
                color: AppColors.brownMain,
                size: 24,
              ),
            ),
            const SizedBox(width: 10),
            RichText(
              text: TextSpan(
                style: const TextStyle(
                  fontFamily: 'Montserrat',
                  fontSize: 20,
                  fontWeight: FontWeight.w900,
                ),
                children: const [
                  TextSpan(
                    text: 'Coffee',
                    style: TextStyle(color: AppColors.brownMain),
                  ),
                  TextSpan(
                    text: 'Scan',
                    style: TextStyle(color: AppColors.greenMain),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
      body: SingleChildScrollView(
        physics: const BouncingScrollPhysics(),
        padding: const EdgeInsets.fromLTRB(24, 32, 24, 170),
        child: Column(
          children: [
            // LOGO UTAMA DI BODY (Tetap pakai shadow agar menonjol)
            Center(
              child: Container(
                padding: const EdgeInsets.all(20),
                decoration: BoxDecoration(
                  color: Colors.white,
                  shape: BoxShape.circle,
                  boxShadow: [
                    BoxShadow(
                      color: AppColors.brownMain.withOpacity(0.08),
                      blurRadius: 30,
                      offset: const Offset(0, 15),
                    ),
                  ],
                ),
                child: Image.asset(
                  'assets/images/Logo_Coffee_Scan.png',
                  width: 90,
                  height: 90,
                  errorBuilder: (c, e, s) => const Icon(
                    Icons.coffee_maker_rounded,
                    size: 70,
                    color: AppColors.brownMain,
                  ),
                ),
              ),
            ),

            const SizedBox(height: 25),

            Text(
              "Tentang Aplikasi",
              style: const TextStyle(
                fontFamily: 'Montserrat',
                fontSize: 18,
                fontWeight: FontWeight.w800,
                color: AppColors.textDark,
              ),
            ),
            const SizedBox(height: 8),
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),
              decoration: BoxDecoration(
                color: AppColors.brownMain.withOpacity(0.1),
                borderRadius: BorderRadius.circular(20),
              ),
              child: Text(
                "v1.0.0",
                style: const TextStyle(
                  fontFamily: 'Montserrat',
                  color: AppColors.brownMain,
                  fontSize: 12,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),

            const SizedBox(height: 40),

            _buildInfoCard(
              title: "Apa itu CoffeeScan?",
              description:
                  "Aplikasi berbasis mobile yang dirancang khusus untuk membantu Anda mengidentifikasi jenis biji kopi Arabika dan Robusta pada tingkat sangrai (roasting) secara instan.",
              icon: Icons.question_mark_rounded,
              accentColor: AppColors.greenMain,
            ),

            const SizedBox(height: 16),

            _buildInfoCard(
              title: "Teknologi AI",
              description:
                  "Aplikasi CoffeeScan dirancang menggunakan teknologi Deep Learning dengan arsitektur MobileNetV2. Model ini dilatih secara khusus untuk mengenali karakteristik visual biji kopi jenis Robusta dan Arabika pada berbagai tingkat roasting. Berdasarkan hasil eksperimen yang dilakukan, model mencapai titik performa optimal pada Epoch ke-15.",
              icon: Icons.psychology_rounded,
              accentColor: AppColors.brownMain,
            ),

            const SizedBox(height: 16),

            _buildInfoCard(
              title: "Tujuan",
              description:
                  "Mengimplementasikan dan mengevaluasi metode Convolutional Neural Network (CNN) dengan model MobileNetV2 pada sistem berbasis mobile guna mengklasifikasikan biji kopi jenis Robusta dan Arabika pada tingkat roasting light, medium, dan dark melalui citra visual.",
              icon: Icons.lightbulb_outline_rounded,
              accentColor: Colors.orange,
            ),

            const SizedBox(height: 60),

            Column(
              children: [
                Text(
                  "Developed by",
                  style: const TextStyle(
                    fontFamily: 'Montserrat',
                    color: AppColors.textGrey,
                    fontSize: 12,
                  ),
                ),
                const SizedBox(height: 6),
                Text(
                  "Johan Indra",
                  style: const TextStyle(
                    fontFamily: 'Montserrat',
                    color: AppColors.brownMain,
                    fontSize: 16,
                    fontWeight: FontWeight.bold,
                    letterSpacing: 1.2,
                  ),
                ),
                const SizedBox(height: 12),
                Text(
                  "© 2026 Skripsi - Politeknik Negeri Jember",
                  style: TextStyle(
                    fontFamily: 'Montserrat',
                    color: AppColors.textGrey.withOpacity(0.7),
                    fontSize: 10,
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }

  Widget _buildInfoCard({
    required String title,
    required String description,
    required IconData icon,
    required Color accentColor,
  }) {
    return Container(
      width: double.infinity,
      padding: const EdgeInsets.all(20),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(25),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.04),
            blurRadius: 15,
            offset: const Offset(0, 8),
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              // Icon tetap menggunakan background soft agar teks "Apa itu..." terlihat terstruktur
              Container(
                padding: const EdgeInsets.all(10),
                decoration: BoxDecoration(
                  color: accentColor.withOpacity(0.1),
                  borderRadius: BorderRadius.circular(15),
                ),
                child: Icon(icon, color: accentColor, size: 24),
              ),
              const SizedBox(width: 15),
              Expanded(
                child: Text(
                  title,
                  style: const TextStyle(
                    fontFamily: 'Montserrat',
                    fontWeight: FontWeight.bold,
                    fontSize: 16,
                    color: AppColors.textDark,
                  ),
                ),
              ),
            ],
          ),
          const SizedBox(height: 15),
          Text(
            description,
            style: const TextStyle(
              fontFamily: 'Montserrat',
              fontSize: 13,
              color: AppColors.textGrey,
              height: 1.6,
              fontWeight: FontWeight.w400,
            ),
          ),
        ],
      ),
    );
  }
}
