// App.tsx
import React from 'react';
import { Platform } from 'react-native';
import { Provider as PaperProvider } from 'react-native-paper';
import { NavigationContainer } from '@react-navigation/native'; // Always used
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { StatusBar } from 'expo-status-bar';

import { AuthProvider } from './src/contexts/AuthContext';
import RootNavigator from './src/navigation/RootNavigator';
import theme from './src/constants/theme';
// Import the combined theme
import { CombinedDarkTheme } from './src/navigation/WebAppLayout'; // Adjust import path if needed

export default function App() {
  return (
    <SafeAreaProvider>
      <AuthProvider>
        <PaperProvider theme={theme}>
          {/* NavigationContainer wraps RootNavigator for ALL platforms */}
          <NavigationContainer theme={CombinedDarkTheme}>
             <RootNavigator />
          </NavigationContainer>
          <StatusBar
            style="light" // Assuming dark theme
            backgroundColor={Platform.OS === 'web' ? theme.colors.background : theme.colors.surface}
          />
        </PaperProvider>
      </AuthProvider>
    </SafeAreaProvider>
  );
}