<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:components="clr-namespace:LocationTrackerApp.Components"
             x:Class="LocationTrackerApp.MainPage"
             Title="Location Tracker">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!-- Header -->
        <Grid Grid.Row="0" 
              BackgroundColor="#8B5CF6" 
              HeightRequest="60">
            <Label Text="Location Tracker"
                   FontSize="20"
                   FontAttributes="Bold"
                   TextColor="White"
                   VerticalOptions="Center"
                   HorizontalOptions="Center" />
        </Grid>

        <!-- Map Container -->
        <Grid Grid.Row="1">
            <components:OpenStreetMapView x:Name="MainMap" />
        </Grid>

        <!-- Bottom Controls -->
        <Grid Grid.Row="2" 
              BackgroundColor="#F3F4F6" 
              HeightRequest="100">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <!-- Start Tracking Button -->
            <Button Grid.Row="0" Grid.Column="0"
                    x:Name="StartTrackingBtn"
                    Text="Start Tracking"
                    BackgroundColor="#10B981"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="3,5,1,2"
                    CornerRadius="20"
                    Clicked="OnStartTrackingClicked" />

            <!-- Stop Tracking Button -->
            <Button Grid.Row="0" Grid.Column="1"
                    x:Name="StopTrackingBtn"
                    Text="Stop Tracking"
                    BackgroundColor="#EF4444"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="1,5,1,2"
                    CornerRadius="20"
                    Clicked="OnStopTrackingClicked" />

            <!-- Center Map Button -->
            <Button Grid.Row="0" Grid.Column="2"
                    x:Name="CenterMapBtn"
                    Text="Center Map"
                    BackgroundColor="#3B82F6"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="1,5,1,2"
                    CornerRadius="20"
                    Clicked="OnCenterMapClicked" />

            <!-- Heat Map Button -->
            <Button Grid.Row="0" Grid.Column="3"
                    x:Name="HeatMapBtn"
                    Text="Demo Heat Map"
                    BackgroundColor="#8B5CF6"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="1,5,3,2"
                    CornerRadius="20"
                    Clicked="OnHeatMapClicked" />

            <!-- Clear Demo Button -->
            <Button Grid.Row="1" Grid.Column="0"
                    x:Name="ClearDemoBtn"
                    Text="Clear Demo"
                    BackgroundColor="#F59E0B"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="3,2,1,5"
                    CornerRadius="20"
                    Clicked="OnClearDemoClicked" />

            <!-- Reset Map Button -->
            <Button Grid.Row="1" Grid.Column="1"
                    x:Name="ResetMapBtn"
                    Text="Reset Map"
                    BackgroundColor="#6B7280"
                    TextColor="White"
                    FontSize="11"
                    FontAttributes="Bold"
                    Margin="1,2,1,5"
                    CornerRadius="20"
                    Clicked="OnResetMapClicked" />

            <!-- Location Count Label -->
            <Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2"
                   x:Name="LocationCountLabel"
                   Text="Locations: 0"
                   FontSize="12"
                   FontAttributes="Bold"
                   VerticalOptions="Center"
                   HorizontalOptions="Center"
                   TextColor="#374151" />
        </Grid>
    </Grid>

</ContentPage>
