/// Splash Screen Page
///
/// Displays while checking authentication state on app startup.
library;

import 'package:flutter/material.dart';
import 'package:worker/core/widgets/loading_indicator.dart';
import 'package:worker/core/theme/colors.dart';

/// Splash Page
///
/// Shows a loading screen while the app checks for stored authentication.
/// This prevents the brief flash of login page before redirecting to home.
class SplashPage extends StatelessWidget {
  const SplashPage({super.key});

  @override
  Widget build(BuildContext context) {
    final colorScheme = Theme.of(context).colorScheme;

    return Scaffold(
      backgroundColor: colorScheme.surface,
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Logo
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 20.0),
              decoration: BoxDecoration(
                gradient: const LinearGradient(
                  colors: [AppColors.primaryBlue, AppColors.lightBlue],
                  begin: Alignment.topLeft,
                  end: Alignment.bottomRight,
                ),
                borderRadius: BorderRadius.circular(20.0),
              ),
              child: const Column(
                children: [
                  Text(
                    'EUROTILE',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 32.0,
                      fontWeight: FontWeight.w700,
                      letterSpacing: 1.5,
                    ),
                  ),
                  SizedBox(height: 4.0),
                  Text(
                    'Worker App',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 12.0,
                      letterSpacing: 0.5,
                    ),
                  ),
                ],
              ),
            ),

            const SizedBox(height: 48.0),

            // Loading Indicator
            const CustomLoadingIndicator(),

            const SizedBox(height: 16.0),

            // Loading Text
            Text(
              'Đang tải...',
              style: TextStyle(
                fontSize: 14.0,
                color: colorScheme.onSurfaceVariant,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
