<!DOCTYPE html>
<html lang="es" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Iniciar sesion | Base Admin Web</title>
    <link rel="stylesheet" th:href="@{/assets/plugins/global/plugins.bundle.css}">
    <link rel="stylesheet" th:href="@{/assets/css/style.bundle.css}">
</head>
<body id="kt_body" class="app-blank bgi-size-cover bgi-attachment-fixed bgi-position-center"
      th:style="|background-image: url('@{/assets/media/auth/bg10.jpeg}');|">
<div class="d-flex flex-column flex-root" id="kt_app_root">
    <div class="d-flex flex-column flex-lg-row flex-column-fluid">
        <div class="d-flex flex-column flex-lg-row-fluid w-lg-50 p-10 order-2 order-lg-1">
            <div class="d-flex flex-center flex-column flex-lg-row-fluid">
                <div class="w-lg-500px rounded-4 bg-body shadow-sm p-10 p-lg-15">
                    <div class="text-center mb-11">
                        <h1 class="text-gray-900 fw-bolder mb-3">Base Admin Web</h1>
                        <div class="text-gray-500 fw-semibold fs-6">Proyecto base Spring Boot con Metronic</div>
                    </div>

                    <div th:if="${hasError}" class="alert alert-danger d-flex align-items-center p-5 mb-8">
                        <i class="ki-duotone ki-shield-cross fs-2hx text-danger me-4"><span class="path1"></span><span class="path2"></span></i>
                        <div class="d-flex flex-column">
                            <span>Usuario o contrasena incorrectos.</span>
                        </div>
                    </div>

                    <div th:if="${loggedOut}" class="alert alert-success d-flex align-items-center p-5 mb-8">
                        <i class="ki-duotone ki-abstract-26 fs-2hx text-success me-4"><span class="path1"></span><span class="path2"></span></i>
                        <div class="d-flex flex-column">
                            <span>La sesion se cerro correctamente.</span>
                        </div>
                    </div>

                    <form class="form w-100" th:action="@{/login}" method="post">
                        <div class="fv-row mb-8">
                            <input type="text" placeholder="Usuario" name="username" autocomplete="username"
                                   class="form-control bg-transparent" value="admin">
                        </div>

                        <div class="fv-row mb-4">
                            <input type="password" placeholder="Contrasena" name="password" autocomplete="current-password"
                                   class="form-control bg-transparent" value="Admin123*">
                        </div>

                        <div class="d-flex justify-content-between text-gray-500 fs-7 mb-8">
                            <span>Usuario: <strong>admin</strong></span>
                            <span>Password: <strong>Admin123*</strong></span>
                        </div>
                        <div class="text-gray-500 fs-8 mb-8 text-center">
                            Autenticacion via Cognito local (grupo <strong>admins</strong>)
                        </div>

                        <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">

                        <div class="d-grid mb-5">
                            <button type="submit" class="btn btn-primary">
                                <span class="indicator-label">Entrar al panel</span>
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="d-flex flex-lg-row-fluid w-lg-50 bgi-size-cover bgi-position-center order-1 order-lg-2"
             th:style="|background-image: url('@{/assets/media/auth/bg1.jpg}');|">
            <div class="d-flex flex-column flex-center py-7 py-lg-15 px-5 px-md-15 w-100 bg-dark bg-opacity-50">
                <div class="mb-8 text-center">
                    <span class="badge badge-light-primary fs-7 fw-bold">Spring Boot 4.0 + Java 25</span>
                </div>
                <h2 class="text-white fs-2hx fw-bolder text-center mb-5">Base lista para crecer</h2>
                <div class="text-white fs-5 text-center opacity-75 mw-500px">
                    Login funcional, panel administrativo inicial y estructura modular limpia para extender el sistema.
                </div>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/assets/plugins/global/plugins.bundle.js}"></script>
<script th:src="@{/assets/js/scripts.bundle.js}"></script>
</body>
</html>
