import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'providers/dino_provider.dart';
import 'screens/home_screen.dart';

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (context) => DinoProvider()..loadData(),
      child: const DinoGuideApp(),
    ),
  );
}

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

  @override
  Widget build(BuildContext context) {
    final provider = Provider.of<DinoProvider>(context);

    return MaterialApp(
      debugShowCheckedModeBanner: false,
      themeMode: provider.isDarkMode ? ThemeMode.dark : ThemeMode.light,
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.green, surface: const Color(0xFFFDFCF8)),
        cardTheme: const CardThemeData(color: Colors.white, elevation: 1),
      ),
      darkTheme: ThemeData(
        useMaterial3: true,
        brightness: Brightness.dark,
        colorScheme: ColorScheme.fromSeed(
          brightness: Brightness.dark,
          seedColor: Colors.green,
          surface: const Color(0xFF121212),
          primary: const Color(0xFF4CAF50),
        ),
        scaffoldBackgroundColor: const Color(0xFF0A0A0A),
        cardTheme: const CardThemeData(color: Color(0xFF1E1E1E), elevation: 0),
      ),
      home: const HomeScreen(),
    );
  }
}