<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="FrymasterBadgeApp.SettingsPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Title="Settings">
    <ScrollView>
        <VerticalStackLayout Padding="30" Spacing="20">

            <Label
                FontAttributes="Bold"
                FontSize="24"
                Text="Configuration"
                TextColor="{StaticResource Primary}" />

            <VerticalStackLayout Spacing="8">
                <Label
                    FontAttributes="Bold"
                    FontSize="16"
                    Text="Theme" />

                <Picker 
                    x:Name="ThemePicker" 
                    Title="Select theme"
                    TextColor="{AppThemeBinding Light={StaticResource TextLight}, Dark={StaticResource TextDark}}">
                    <Picker.Items>
                        <x:String>System</x:String>
                        <x:String>Light</x:String>
                        <x:String>Dark</x:String>
                    </Picker.Items>
                </Picker>
            </VerticalStackLayout>

            <BoxView HeightRequest="1" 
                     Color="{AppThemeBinding Light={StaticResource BorderLight}, Dark={StaticResource BorderDark}}" />

            <VerticalStackLayout Spacing="10">
                <Label
                    FontAttributes="Bold"
                    FontSize="16"
                    Text="Badge Photo Folder" />

                <Label
                    FontSize="12"
                    Text="Where employee photos are stored"
                    TextColor="{StaticResource Gray500}" />

                <HorizontalStackLayout Spacing="10">
                    <Entry
                        x:Name="PathEntry"
                        IsReadOnly="True"
                        Placeholder="Select folder..."
                        FontSize="15"
                        HorizontalOptions="FillAndExpand" />

                    <Button
                        Clicked="OnPickPhotoFolderClicked"
                        Text="Browse..."
                        WidthRequest="100" />
                </HorizontalStackLayout>
            </VerticalStackLayout>

            <VerticalStackLayout Margin="0,10,0,0" Spacing="10">
                <Label
                    FontAttributes="Bold"
                    FontSize="16"
                    Text="Logo Folder" />

                <HorizontalStackLayout Spacing="10">
                    <Entry
                        x:Name="LogoPathEntry"
                        IsReadOnly="True"
                        Placeholder="Select folder..."
                        FontSize="15"
                        HorizontalOptions="FillAndExpand" />

                    <Button
                        Clicked="OnPickLogoFolderClicked"
                        Text="Browse..."
                        WidthRequest="100" />
                </HorizontalStackLayout>
            </VerticalStackLayout>

            <VerticalStackLayout Margin="0,10,0,0" Spacing="10">
                <Label
                    FontAttributes="Bold"
                    FontSize="16"
                    Text="Additional Images Folder" />

                <HorizontalStackLayout Spacing="10">
                    <Entry
                        x:Name="ImagesPathEntry"
                        IsReadOnly="True"
                        Placeholder="Select folder..."
                        FontSize="15"
                        HorizontalOptions="FillAndExpand" />

                    <Button
                        Clicked="OnPickImagesFolderClicked"
                        Text="Browse..."
                        WidthRequest="100" />
                </HorizontalStackLayout>
            </VerticalStackLayout>

            <Button
                x:Name="SaveButton"
                Margin="0,30,0,0"
                BackgroundColor="{StaticResource Primary}"
                Clicked="OnSaveClicked"
                CornerRadius="8"
                HeightRequest="50"
                Text="Save Settings"
                TextColor="White" />

            <Label
                x:Name="StatusLabel"
                Margin="5,8,0,0"
                FontSize="13"
                TextColor="{StaticResource Success}" />

            <Label
                Margin="0,20,0,0"
                FontSize="11"
                HorizontalOptions="Center"
                Text="Tip: Use the Browse buttons to select folders easily"
                TextColor="{StaticResource Gray500}" />

        </VerticalStackLayout>
    </ScrollView>
</ContentPage>