using System;
using System.Drawing;
using System.Windows.Forms;
using Zoo;

namespace Zoo

{
    public class FormLogin : Form
    {
        TextBox txtLogin;
        TextBox txtPassword;
        Button btnLogin;
        Button btnExit;

        public FormLogin()
        {
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            Text = "Авторизация";
            StartPosition = FormStartPosition.CenterScreen;
            Size = new Size(400, 280);
            FormBorderStyle = FormBorderStyle.FixedSingle;
            MaximizeBox = false;
            BackColor = Color.WhiteSmoke;
            Font = new Font("Segoe UI", 10);

            Label title = new Label();
            title.Text = "Вход в систему";
            title.Font = new Font("Segoe UI", 18, FontStyle.Bold);
            title.AutoSize = true;
            title.Location = new Point(90, 20);

            Label lblLogin = new Label();
            lblLogin.Text = "Логин";
            lblLogin.Location = new Point(40, 80);
            lblLogin.AutoSize = true;

            txtLogin = new TextBox();
            txtLogin.Location = new Point(120, 76);
            txtLogin.Size = new Size(200, 30);
            txtLogin.Text = "admin";

            Label lblPassword = new Label();
            lblPassword.Text = "Пароль";
            lblPassword.Location = new Point(40, 125);
            lblPassword.AutoSize = true;

            txtPassword = new TextBox();
            txtPassword.Location = new Point(120, 121);
            txtPassword.Size = new Size(200, 30);
            txtPassword.UseSystemPasswordChar = true;
            txtPassword.Text = "12345";

            btnLogin = new Button();
            btnLogin.Text = "Войти";
            btnLogin.Location = new Point(40, 180);
            btnLogin.Size = new Size(130, 40);
            btnLogin.BackColor = Color.DodgerBlue;
            btnLogin.ForeColor = Color.White;
            btnLogin.FlatStyle = FlatStyle.Flat;
            btnLogin.Click += BtnLogin_Click;

            btnExit = new Button();
            btnExit.Text = "Выход";
            btnExit.Location = new Point(190, 180);
            btnExit.Size = new Size(130, 40);
            btnExit.BackColor = Color.IndianRed;
            btnExit.ForeColor = Color.White;
            btnExit.FlatStyle = FlatStyle.Flat;
            btnExit.Click += (s, e) => Application.Exit();

            Controls.Add(title);
            Controls.Add(lblLogin);
            Controls.Add(txtLogin);
            Controls.Add(lblPassword);
            Controls.Add(txtPassword);
            Controls.Add(btnLogin);
            Controls.Add(btnExit);
        }

        private void BtnLogin_Click(object sender, EventArgs e)
        {
            FormMain main = new FormMain();
            main.Show();
            Hide();
        }
    }
}