<Window x:Class="UI.Configuracao.ConfiguracaoBanco"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStartupLocation="CenterScreen"
        ResizeMode="NoResize"
        WindowStyle="None"
        Height="600"
        Width="800"
        AllowsTransparency="True"
        Background="Transparent"
        MouseDown="Window_MouseDown">

    <Window.Resources>

        <!-- Estilo TextBox padrão -->
        <Style x:Key="InputStyle" TargetType="TextBox">
            <Setter Property="Background" Value="#1E2D4A"/>
            <Setter Property="Foreground" Value="#CBD5E1"/>
            <Setter Property="BorderBrush" Value="#2E4270"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="42"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="CaretBrush" Value="White"/>
            <Setter Property="Padding" Value="10 0 0 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8">
                            <ScrollViewer x:Name="PART_ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="BorderBrush" Value="#3B82F6"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Estilo PasswordBox -->
        <Style x:Key="PasswordStyle" TargetType="PasswordBox">
            <Setter Property="Background" Value="#1E2D4A"/>
            <Setter Property="Foreground" Value="#CBD5E1"/>
            <Setter Property="BorderBrush" Value="#2E4270"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="42"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="CaretBrush" Value="White"/>
            <Setter Property="Padding" Value="10 0 0 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="PasswordBox">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8">
                            <ScrollViewer x:Name="PART_ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="BorderBrush" Value="#3B82F6"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Estilo ComboBox -->
        <Style x:Key="ComboStyle" TargetType="ComboBox">
            <Setter Property="Background" Value="#1E2D4A"/>
            <Setter Property="Foreground" Value="#CBD5E1"/>
            <Setter Property="BorderBrush" Value="#2E4270"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="42"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="Padding" Value="10 0 0 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="36"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter Grid.Column="0"
                                                  Content="{TemplateBinding SelectionBoxItem}"
                                                  Margin="12 0 0 0"
                                                  VerticalAlignment="Center"/>
                                <Path Grid.Column="1"
                                      Data="M0,0 L6,6 L12,0"
                                      Stroke="#64748B"
                                      StrokeThickness="1.5"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Fill="Transparent"/>
                                <Popup x:Name="PART_Popup"
                                       IsOpen="{TemplateBinding IsDropDownOpen}"
                                       AllowsTransparency="True"
                                       Placement="Bottom"
                                       PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <Border Background="#1A2540"
                                            BorderBrush="#2E4270"
                                            BorderThickness="1"
                                            CornerRadius="8"
                                            MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ComboBox}}">
                                        <ItemsPresenter/>
                                    </Border>
                                </Popup>
                                <ToggleButton Grid.ColumnSpan="2"
                                              IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                              Background="Transparent"
                                              BorderThickness="0"
                                              Cursor="Hand"/>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Resources>
                <Style TargetType="ComboBoxItem">
                    <Setter Property="Foreground" Value="#CBD5E1"/>
                    <Setter Property="Background" Value="Transparent"/>
                    <Setter Property="Padding" Value="12 8"/>
                    <Setter Property="FontSize" Value="13"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ComboBoxItem">
                                <Border x:Name="border"
                                        Background="{TemplateBinding Background}"
                                        Padding="{TemplateBinding Padding}">
                                    <ContentPresenter/>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter TargetName="border" Property="Background" Value="#2C395B"/>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="border" Property="Background" Value="#1D4ED8"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Style.Resources>
        </Style>

        <!-- Estilo botão primário -->
        <Style x:Key="BtnPrimary" TargetType="Button">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Height" Value="44"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="border"
                                CornerRadius="8"
                                Height="{TemplateBinding Height}">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                    <GradientStop Color="#2563EB" Offset="0"/>
                                    <GradientStop Color="#1D4ED8" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Opacity" Value="0.85"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Opacity" Value="0.7"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Estilo botão secundário -->
        <Style x:Key="BtnSecondary" TargetType="Button">
            <Setter Property="Foreground" Value="#94A3B8"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="#2E4270"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Height" Value="44"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="border"
                                Background="#1E2D4A"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8"
                                Height="{TemplateBinding Height}">
                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#263550"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Opacity" Value="0.7"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Toggle Switch style -->
        <Style x:Key="ToggleStyle" TargetType="ToggleButton">
            <Setter Property="Width" Value="50"/>
            <Setter Property="Height" Value="26"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Grid>
                            <Border x:Name="track"
                                    CornerRadius="13"
                                    Background="#2E4270"/>
                            <Ellipse x:Name="thumb"
                                     Width="20" Height="20"
                                     Fill="White"
                                     HorizontalAlignment="Left"
                                     Margin="3 0 0 0"
                                     VerticalAlignment="Center">
                                <Ellipse.RenderTransform>
                                    <TranslateTransform x:Name="thumbTranslate" X="0"/>
                                </Ellipse.RenderTransform>
                            </Ellipse>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="track" Property="Background" Value="#2563EB"/>
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="thumbTranslate"
                                                             Storyboard.TargetProperty="X"
                                                             To="24" Duration="0:0:0.15"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="thumbTranslate"
                                                             Storyboard.TargetProperty="X"
                                                             To="0" Duration="0:0:0.15"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>

    <!-- Sombra externa -->
    <Border CornerRadius="14" Margin="10">
        <Border.Effect>
            <DropShadowEffect Color="#000000" Opacity="0.6" BlurRadius="30" ShadowDepth="6"/>
        </Border.Effect>

        <Border CornerRadius="14" ClipToBounds="True">
            <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#1A2D50" Offset="0"/>
                    <GradientStop Color="#142240" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="54"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="68"/>
                </Grid.RowDefinitions>

                <!-- ===== TÍTULO ===== -->
                <Border Grid.Row="0"
                        BorderBrush="#1E3A6A"
                        BorderThickness="0 0 0 1">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                            <GradientStop Color="#1A2D50" Offset="0"/>
                            <GradientStop Color="#162540" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>

                    <Grid Margin="20 0">
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                            <Viewbox Width="26" Height="26" Margin="0 0 10 0">
                                <Canvas Width="100" Height="100">
                                    <Ellipse Canvas.Left="10" Canvas.Top="5" Width="60" Height="20" Fill="#4A90D9"/>
                                    <Rectangle Canvas.Left="10" Canvas.Top="14" Width="60" Height="35" Fill="#3A7AC8"/>
                                    <Ellipse Canvas.Left="10" Canvas.Top="34" Width="60" Height="18" Fill="#4A90D9"/>
                                    <Rectangle Canvas.Left="10" Canvas.Top="42" Width="60" Height="25" Fill="#3A7AC8"/>
                                    <Ellipse Canvas.Left="10" Canvas.Top="54" Width="60" Height="18" Fill="#4A90D9"/>
                                    <Ellipse Canvas.Left="50" Canvas.Top="52" Width="44" Height="44" Fill="#1A2D50"/>
                                    <Path Canvas.Left="52" Canvas.Top="54" Fill="#7CB9F0" Width="40" Height="40" Stretch="Uniform"
                                          Data="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/>
                                </Canvas>
                            </Viewbox>
                            <TextBlock Text="Conexão com Banco de Dados"
                                       Foreground="White"
                                       FontSize="16"
                                       FontWeight="SemiBold"
                                       VerticalAlignment="Center"/>
                        </StackPanel>

                        <!-- Botão fechar -->
                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center">
                            <Button Width="32" Height="32"
                                    Cursor="Hand"
                                    Click="BtnFechar_Click">
                                <Button.Style>
                                    <Style TargetType="Button">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="Button">
                                                    <Border x:Name="b" Background="#1E2D4A"
                                                            BorderBrush="#2E4270" BorderThickness="1"
                                                            CornerRadius="6">
                                                        <TextBlock Text="✕" FontSize="13"
                                                                   Foreground="#94A3B8"
                                                                   HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter TargetName="b" Property="Background" Value="#E53E3E"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Button.Style>
                            </Button>
                        </StackPanel>
                    </Grid>
                </Border>

                <!-- ===== CONTEÚDO ===== -->
                <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
                    <StackPanel Margin="30 24 30 16">

                        <!-- SGBD + ícone -->
                        <Grid Margin="0 0 0 24">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Viewbox Width="72" Height="72" Margin="0 0 20 0" VerticalAlignment="Center">
                                <Canvas Width="100" Height="100">
                                    <Ellipse Canvas.Left="10" Canvas.Top="5"  Width="60" Height="20" Fill="#5BA3E0"/>
                                    <Rectangle Canvas.Left="10" Canvas.Top="14" Width="60" Height="30" Fill="#4A8ED0"/>
                                    <Ellipse Canvas.Left="10" Canvas.Top="30"  Width="60" Height="18" Fill="#5BA3E0"/>
                                    <Rectangle Canvas.Left="10" Canvas.Top="38" Width="60" Height="25" Fill="#4A8ED0"/>
                                    <Ellipse Canvas.Left="10" Canvas.Top="50"  Width="60" Height="18" Fill="#5BA3E0"/>
                                    <Ellipse Canvas.Left="48" Canvas.Top="50" Width="46" Height="46" Fill="#1A2D50"/>
                                    <Path Canvas.Left="50" Canvas.Top="52" Fill="#7CB9F0" Width="42" Height="42" Stretch="Uniform"
                                          Data="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94zM12,15.6c-1.98,0-3.6-1.62-3.6-3.6s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/>
                                </Canvas>
                            </Viewbox>

                            <StackPanel Grid.Column="1" VerticalAlignment="Center">
                                <TextBlock Text="SGBD"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <ComboBox x:Name="CmbSgbd"
                                          Style="{StaticResource ComboStyle}"
                                          Width="280"
                                          HorizontalAlignment="Left"
                                          SelectionChanged="CmbSgbd_SelectionChanged">
                                    <ComboBoxItem Content="SQL Server" IsSelected="True"/>
                                    <ComboBoxItem Content="MySQL"/>
                                    <ComboBoxItem Content="PostgreSQL"/>
                                    <ComboBoxItem Content="SQLite"/>
                                    <ComboBoxItem Content="Oracle"/>
                                </ComboBox>
                            </StackPanel>
                        </Grid>

                        <!-- Linha 1: Endereço + Nome do Banco -->
                        <Grid Margin="0 0 0 16">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0">
                                <TextBlock Text="Endereço do Servidor"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <Border Background="#1E2D4A" CornerRadius="8"
                                        BorderBrush="#2E4270" BorderThickness="1">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="44"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Path Grid.Column="0"
                                              Fill="#4A6FA5" Width="18" Height="18"
                                              Stretch="Uniform" HorizontalAlignment="Center"
                                              Data="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/>
                                        <TextBox x:Name="TxtServidor"
                                                 Grid.Column="1"
                                                 Style="{StaticResource InputStyle}"
                                                 Background="Transparent"
                                                 BorderThickness="0"
                                                 Text="localhost"/>
                                    </Grid>
                                </Border>
                            </StackPanel>

                            <StackPanel Grid.Column="2">
                                <TextBlock Text="Nome do Banco de Dados"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <Border Background="#1E2D4A" CornerRadius="8"
                                        BorderBrush="#2E4270" BorderThickness="1">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="44"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Path Grid.Column="0"
                                              Fill="#4A6FA5" Width="16" Height="16"
                                              Stretch="Uniform" HorizontalAlignment="Center"
                                              Data="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
                                        <TextBox x:Name="TxtBancoDados"
                                                 Grid.Column="1"
                                                 Style="{StaticResource InputStyle}"
                                                 Background="Transparent"
                                                 BorderThickness="0"/>
                                    </Grid>
                                </Border>
                            </StackPanel>
                        </Grid>

                        <!-- Linha 2: Usuário + Senha -->
                        <Grid Margin="0 0 0 16">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0">
                                <TextBlock Text="Nome do Usuário"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <Border Background="#1E2D4A" CornerRadius="8"
                                        BorderBrush="#2E4270" BorderThickness="1">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="44"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Path Grid.Column="0"
                                              Fill="#4A6FA5" Width="16" Height="16"
                                              Stretch="Uniform" HorizontalAlignment="Center"
                                              Data="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
                                        <TextBox x:Name="TxtUsuario"
                                                 Grid.Column="1"
                                                 Style="{StaticResource InputStyle}"
                                                 Background="Transparent"
                                                 BorderThickness="0"/>
                                    </Grid>
                                </Border>
                            </StackPanel>

                            <!-- ===== CAMPO SENHA COM MOSTRAR/OCULTAR ===== -->
                            <StackPanel Grid.Column="2">
                                <TextBlock Text="Senha"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <Border x:Name="BorderSenha"
                                        Background="#1E2D4A"
                                        CornerRadius="8"
                                        BorderBrush="#2E4270"
                                        BorderThickness="1">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="44"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="44"/>
                                        </Grid.ColumnDefinitions>

                                        <!-- Ícone cadeado -->
                                        <Path Grid.Column="0"
                                              Fill="#4A6FA5" Width="16" Height="16"
                                              Stretch="Uniform" HorizontalAlignment="Center"
                                              Data="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>

                                        <!-- PasswordBox padrão (senha oculta) -->
                                        <PasswordBox x:Name="PboxSenha"
                                                     Grid.Column="1"
                                                     Style="{StaticResource PasswordStyle}"
                                                     Background="Transparent"
                                                     BorderThickness="0"
                                                     Visibility="Visible"/>

                                        <!-- TextBox sobreposto (senha visível) -->
                                        <TextBox x:Name="TxtSenhaVisivel"
                                                 Grid.Column="1"
                                                 Style="{StaticResource InputStyle}"
                                                 Background="Transparent"
                                                 BorderThickness="0"
                                                 Visibility="Collapsed"/>

                                        <!-- Botão olho: mostrar / ocultar senha -->
                                        <Button Grid.Column="2"
                                                Background="Transparent"
                                                BorderThickness="0"
                                                Cursor="Hand"
                                                ToolTip="Mostrar / ocultar senha"
                                                Click="BtnVerSenha_Click">
                                            <Button.Style>
                                                <Style TargetType="Button">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="Button">
                                                                <Border x:Name="btnBorder"
                                                                        Background="Transparent"
                                                                        CornerRadius="0 8 8 0">
                                                                    <ContentPresenter HorizontalAlignment="Center"
                                                                                      VerticalAlignment="Center"/>
                                                                </Border>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsMouseOver" Value="True">
                                                                        <Setter TargetName="btnBorder" Property="Background" Value="#263550"/>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Button.Style>
                                            <!-- Ícone olho — trocado via code-behind -->
                                            <Path x:Name="IconeOlho"
                                                  Fill="#4A6FA5"
                                                  Width="16" Height="16"
                                                  Stretch="Uniform"
                                                  Data="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
                                        </Button>

                                    </Grid>
                                </Border>
                            </StackPanel>
                        </Grid>

                        <!-- Linha 3: Provedor + info provedor -->
                        <Grid Margin="0 0 0 16">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0">
                                <TextBlock Text="Provedor"
                                           Foreground="#94A3B8"
                                           FontSize="12"
                                           Margin="0 0 0 6"/>
                                <ComboBox x:Name="CmbProvedor"
                                          Style="{StaticResource ComboStyle}">
                                    <ComboBoxItem Content="System.Data.SqlClient" IsSelected="True"/>
                                    <ComboBoxItem Content="Microsoft.Data.SqlClient"/>
                                    <ComboBoxItem Content="MySql.Data.MySqlClient"/>
                                    <ComboBoxItem Content="Npgsql"/>
                                    <ComboBoxItem Content="System.Data.SQLite"/>
                                </ComboBox>
                            </StackPanel>

                            <StackPanel Grid.Column="2" VerticalAlignment="Bottom" Margin="0 0 0 10">
                                <StackPanel Orientation="Horizontal">
                                    <Path Fill="#4A8ED0" Width="16" Height="16"
                                          Stretch="Uniform" Margin="0 0 8 0"
                                          VerticalAlignment="Center"
                                          Data="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
                                    <TextBlock x:Name="TxtProvedorInfo"
                                               Text="System.Data.SqlClient"
                                               Foreground="#64748B"
                                               FontSize="13"
                                               VerticalAlignment="Center"/>
                                </StackPanel>
                            </StackPanel>
                        </Grid>

                        <!-- Linha 4: Autenticação integrada + Testar conexão -->
                        <Grid Margin="0 0 0 8">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                                <TextBlock Text="Autenticação Integrada"
                                           Foreground="#CBD5E1"
                                           FontSize="13"
                                           VerticalAlignment="Center"
                                           Margin="0 0 14 0"/>
                                <ToggleButton x:Name="ToggleAutenticacao"
                                              Style="{StaticResource ToggleStyle}"
                                              IsChecked="True"
                                              Checked="ToggleAutenticacao_Changed"
                                              Unchecked="ToggleAutenticacao_Changed"/>
                            </StackPanel>

                            <StackPanel Grid.Column="2">
                                <Button Content="Testar Conexão"
                                        Style="{StaticResource BtnPrimary}"
                                        Click="BtnTestarConexao_Click"/>

                                <StackPanel x:Name="PanelResultado"
                                            Orientation="Horizontal"
                                            Margin="0 10 0 0"
                                            Visibility="Collapsed">
                                    <Ellipse Width="10" Height="10"
                                             x:Name="EllipseResultado"
                                             Fill="#22C55E"
                                             Margin="0 0 8 0"
                                             VerticalAlignment="Center"/>
                                    <TextBlock x:Name="TxtResultado"
                                               Text="Conexão bem-sucedida!"
                                               Foreground="#22C55E"
                                               FontSize="12"
                                               VerticalAlignment="Center"/>
                                </StackPanel>
                            </StackPanel>
                        </Grid>

                    </StackPanel>
                </ScrollViewer>

                <!-- ===== RODAPÉ ===== -->
                <Border Grid.Row="2"
                        BorderBrush="#1E3A6A"
                        BorderThickness="0 1 0 0">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                            <GradientStop Color="#142240" Offset="0"/>
                            <GradientStop Color="#1A2D50" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>

                    <Grid Margin="30 0">
                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center">
                            <Button Content="Cancelar"
                                    Style="{StaticResource BtnSecondary}"
                                    Width="120"
                                    Margin="0 0 12 0"
                                    Click="BtnFechar_Click"/>
                            <Button Content="Salvar"
                                    Style="{StaticResource BtnPrimary}"
                                    Width="120"
                                    Click="BtnSalvar_Click"/>
                        </StackPanel>
                    </Grid>
                </Border>

            </Grid>
        </Border>
    </Border>

</Window>
