import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:google_fonts/google_fonts.dart';
import 'firebase_options.dart';
import 'terminal_boot_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  runApp(const SageApp());
}

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

  @override
  Widget build(BuildContext context) {
    const Color cyberOrange = Color(0xFFE87D25);

    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'SAVEXSTATE™',
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: const Color(0xFF000000),

        // FONT: Retro Tech Mono
        textTheme: ThemeData.dark().textTheme.apply(
          fontFamily: 'ShareTechMono', // Matches the family name in pubspec
          bodyColor: cyberOrange,
          displayColor: cyberOrange,
        ),

        primaryColor: cyberOrange,

        appBarTheme: AppBarTheme(
          backgroundColor: Colors.black,
          elevation: 0,
          centerTitle: true,
          titleTextStyle: GoogleFonts.shareTechMono(
            color: cyberOrange,
            fontSize: 20,
            fontWeight: FontWeight.bold,
          ),
          iconTheme: const IconThemeData(color: cyberOrange),
        ),

        // INPUTS: Sharp edges [TERMINAL_STYLE]
        inputDecorationTheme: InputDecorationTheme(
          filled: true,
          fillColor: Colors.black,
          labelStyle: const TextStyle(color: cyberOrange),
          hintStyle: TextStyle(color: cyberOrange.withValues(alpha: 0.5)),
          enabledBorder: const OutlineInputBorder(
            borderSide: BorderSide(color: cyberOrange, width: 1),
            borderRadius: BorderRadius.zero,
          ),
          focusedBorder: const OutlineInputBorder(
            borderSide: BorderSide(color: cyberOrange, width: 2),
            borderRadius: BorderRadius.zero,
          ),
        ),

        // BUTTONS: Brackets [ EXECUTE ]
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            backgroundColor: Colors.black,
            foregroundColor: cyberOrange,
            side: const BorderSide(color: cyberOrange, width: 1),
            shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
            padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 25),
            textStyle: GoogleFonts.shareTechMono(fontWeight: FontWeight.bold, letterSpacing: 2),
          ),
        ),

        bottomNavigationBarTheme: const BottomNavigationBarThemeData(
          backgroundColor: Colors.black,
          selectedItemColor: cyberOrange,
          unselectedItemColor: Color(0xFF004400),
          type: BottomNavigationBarType.fixed,
        ),
      ),
      home: const TerminalBootScreen(),
    );
  }
}