<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <title>登录 | 您的应用名称</title>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" th:href="@{/webjars/bootstrap/5.1.3/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/webjars/font-awesome/5.15.4/css/all.min.css}">

    <!-- 自定义CSS -->
    <style>
        :root {
            --primary-color: #4e73df;
            --secondary-color: #f8f9fc;
            --accent-color: #2e59d9;
            --text-color: #5a5c69;
        }

        body {
            background-color: var(--secondary-color);
            height: 100vh;
            display: flex;
            align-items: center;
        }

        .login-container {
            width: 100%;
            max-width: 450px;
            margin: 0 auto;
            padding: 2rem;
            background: white;
            border-radius: 10px;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
        }

        .login-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .login-header img {
            height: 80px;
            margin-bottom: 1rem;
        }

        .login-header h1 {
            color: var(--primary-color);
            font-weight: 600;
            font-size: 1.8rem;
        }

        .form-control {
            padding: 0.75rem 1rem;
            border-radius: 0.35rem;
        }

        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
        }

        .btn-login {
            background-color: var(--primary-color);
            border: none;
            padding: 0.75rem;
            font-weight: 600;
            width: 100%;
            transition: all 0.3s;
        }

        .btn-login:hover {
            background-color: var(--accent-color);
        }

        .input-group-text {
            background-color: #f8f9fa;
        }

        .divider {
            position: relative;
            margin: 1.5rem 0;
            text-align: center;
        }

        .divider::before {
            content: "";
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 1px;
            background-color: #e3e6f0;
            z-index: 1;
        }

        .divider-text {
            display: inline-block;
            padding: 0 1rem;
            background-color: white;
            position: relative;
            z-index: 2;
            color: #b7b9cc;
            font-size: 0.85rem;
        }

        .footer-links {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.9rem;
        }

        .footer-links a {
            color: var(--text-color);
            text-decoration: none;
            margin: 0 0.5rem;
        }

        .footer-links a:hover {
            color: var(--primary-color);
            text-decoration: underline;
        }

        .alert {
            border-radius: 0.35rem;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="login-container">
        <div class="login-header">
            <!-- 替换为你的logo -->
            <img alt="Logo" class="img-fluid" src="/favicon.ico">
            <h1>欢迎回来</h1>
            <p class="text-muted">请登录您的账户</p>
        </div>

        <!-- 错误消息显示 -->
        <div class="alert alert-danger alert-dismissible fade show" role="alert" th:if="${param.error}">
            <i class="fas fa-exclamation-circle me-2"></i>
            <span th:text="#{login.error}">无效的用户名或密码</span>
            <button aria-label="Close" class="btn-close" data-bs-dismiss="alert" type="button"></button>
        </div>

        <div class="alert alert-success alert-dismissible fade show" role="alert" th:if="${param.logout}">
            <i class="fas fa-check-circle me-2"></i>
            <span th:text="#{login.logout}">您已成功登出</span>
            <button aria-label="Close" class="btn-close" data-bs-dismiss="alert" type="button"></button>
        </div>

        <!-- 登录表单 -->
        <form method="post" th:action="@{/login}">
            <div class="mb-3">
                <label class="form-label" for="username">用户名</label>
                <div class="input-group">
                    <span class="input-group-text"><i class="fas fa-user"></i></span>
                    <input autofocus class="form-control" id="username" name="username" placeholder="请输入用户名"
                           required type="text">
                </div>
            </div>

            <div class="mb-3">
                <label class="form-label" for="password">密码</label>
                <div class="input-group">
                    <span class="input-group-text"><i class="fas fa-lock"></i></span>
                    <input class="form-control" id="password" name="password" placeholder="请输入密码" required
                           type="password" value="123456">
                </div>
            </div>

            <div class="mb-3 form-check">
                <input class="form-check-input" id="remember-me" name="remember-me" type="checkbox">
                <label class="form-check-label" for="remember-me">记住我</label>
            </div>

            <button class="btn btn-primary btn-login mb-3" type="submit">
                <i class="fas fa-sign-in-alt me-2"></i> 登录
            </button>

            <div class="text-center mb-3">
                <a class="text-decoration-none" th:href="@{/forgot-password}">忘记密码?</a>
            </div>

            <div class="divider">
                <span class="divider-text">或</span>
            </div>

            <div class="text-center">
                <p class="text-muted">还没有账户? <a class="text-decoration-none" th:href="@{/register}">注册</a></p>
            </div>
        </form>

        <div class="footer-links">
            <a href="#">隐私政策</a>
            <a href="#">使用条款</a>
            <a href="#">帮助中心</a>
        </div>
    </div>
</div>
</body>
<!-- Bootstrap JS Bundle with Popper -->
<script th:src="@{/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js}"></script>
</html>