<Window x:Class="FahrzeugVerwaltung.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Fahrzeugverwaltung" Height="700" Width="1000"
        WindowStartupLocation="CenterScreen">

    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="BorderBrush" Value="#FF1976D2"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="#FF2196F3"/>
            <Setter Property="Padding" Value="10,5"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="5">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#FF1976D2"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="TextBox">
            <Setter Property="Padding" Value="5"/>
            <Setter Property="BorderBrush" Value="#FFCCCCCC"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="25"/>
        </Style>

        <Style TargetType="Label">
            <Setter Property="Foreground" Value="#FF333333"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="Margin" Value="0,2,0,2"/>
        </Style>

        <Style TargetType="GroupBox">
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Foreground" Value="#FF333333"/>
        </Style>
    </Window.Resources>

    <Grid Margin="10">
        <Grid.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                <GradientStop Color="#F5F5F5" Offset="0"/>
                <GradientStop Color="#E1F5FE" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="400"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.ColumnSpan="2" Grid.Row="0" Text="Fahrzeugverwaltung" FontSize="32" FontWeight="SemiBold" FontFamily="Segoe UI" Foreground="#FF0D47A1" HorizontalAlignment="Center" Margin="0,0,0,10"/>
        <GroupBox Grid.Column="0" Grid.Row="1" Header="Neues Fahrzeug" Margin="5">
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="Marke:" VerticalAlignment="Center"/>
                <ComboBox Grid.Row="0" Grid.Column="1" Name="cmbMarke" Margin="5" SelectionChanged="CmbMarke_AuswahlGeaendert"/>

                <Label Grid.Row="1" Grid.Column="0" Content="Modell:" VerticalAlignment="Center"/>
                <ComboBox Grid.Row="1" Grid.Column="1" Name="cmbModell" Margin="5"/>

                <Label Grid.Row="2" Grid.Column="0" Content="Baujahr:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="2" Grid.Column="1" Name="txtBaujahr" Margin="5"/>

                <Label Grid.Row="3" Grid.Column="0" Content="Leistung (PS):" VerticalAlignment="Center"/>
                <TextBox Grid.Row="3" Grid.Column="1" Name="txtLeistung" Margin="5"/>

                <Label Grid.Row="4" Grid.Column="0" Content="Kilometerstand:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="4" Grid.Column="1" Name="txtKilometer" Margin="5"/>

                <Label Grid.Row="5" Grid.Column="0" Content="Kaufpreis (€):" VerticalAlignment="Center"/>
                <TextBox Grid.Row="5" Grid.Column="1" Name="txtKaufpreis" Margin="5"/>

                <Label Grid.Row="6" Grid.Column="0" Content="Farbe:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="6" Grid.Column="1" Name="txtFarbe" Margin="5"/>
            </Grid>
        </GroupBox>
        <GroupBox Grid.Column="1" Grid.Row="1" Header="Fahrzeuge suchen" Margin="5">
            <StackPanel Margin="10" Orientation="Horizontal">
                <Label Content="Suchbegriff:" VerticalAlignment="Center"/>
                <TextBox Name="txtSuche" Width="200" Margin="5"/>
                <Button Name="btnSuchen" Content="Suchen" Width="80" Height="30" Margin="5"
                        Click="BtnSuchen_Click"/>
                <Button Name="btnAlle" Content="Alle anzeigen" Width="100" Height="30" Margin="5"
                        Click="BtnAlle_Click"/>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Header="Fahrzeuge" Margin="5">
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <DataGrid Grid.Row="0" Name="dgFahrzeuge" AutoGenerateColumns="False"
                          IsReadOnly="True" SelectionMode="Single" Margin="10,10,0,28"
                          AlternatingRowBackground="#FFE3F2FD" SelectionChanged="Liste_AuswahlGeaendert" Grid.RowSpan="2">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Marke" Binding="{Binding Marke}" Width="100"/>
                        <DataGridTextColumn Header="Modell" Binding="{Binding Modell}" Width="120"/>
                        <DataGridTextColumn Header="Baujahr" Binding="{Binding Baujahr}" Width="80"/>
                        <DataGridTextColumn Header="Leistung" Binding="{Binding Leistung}" Width="80"/>
                        <DataGridTextColumn Header="Kilometer" Binding="{Binding KilometerstandFormatiert}" Width="100"/>
                        <DataGridTextColumn Header="Kaufpreis" Binding="{Binding KaufpreisFormatiert}" Width="100"/>
                        <DataGridTextColumn Header="Farbe" Binding="{Binding Farbe}" Width="80"/>
                        <DataGridTextColumn Header="Aktueller Wert" Binding="{Binding AktuellerWertFormatiert}" Width="120"/>
                    </DataGrid.Columns>
                </DataGrid>

                <TextBlock Grid.Row="1" Name="txtDetails" Margin="5" FontWeight="Bold" FontSize="14"
                           Text="Kein Fahrzeug ausgewählt" HorizontalAlignment="Center"/>

                <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
                    <Button Name="btnHinzufuegen" Content="Hinzufügen" Width="120" Height="35" Click="BtnHinzufuegen_Click"/>
                    <Button Name="btnBearbeiten" Content="Bearbeiten" Width="120" Height="35" Click="BtnBearbeiten_Click"/>
                    <Button Name="btnLoeschen" Content="Löschen" Width="120" Height="35" Click="BtnLoeschen_Click"/>
                    <Button Name="btnPdf" Content="Als PDF speichern" Width="150" Height="35" IsEnabled="False" Click="BtnPdf_Click"/>
                    <Button Name="btnAktualisieren" Content="Aktualisieren" Width="120" Height="35" Click="BtnAktualisieren_Click"/>
                </StackPanel>
            </Grid>
        </GroupBox>
    </Grid>
</Window>