<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <title>Login | CRM GD</title>
    <link rel="icon" href="/static/favicon.ico" type="image/x-icon">
    <style>
        body {
            margin: 0;
            padding: 0;
            background-image: url('/static/FONDOLOGIN.PNG');
            background-size: cover;
            background-position: center;
            font-family: Arial, sans-serif;
        }

        .login-container {
            max-width: 400px;
            margin: 100px auto;
            padding: 30px;
            background-color: rgba(255, 255, 255, 0.95);
            border-radius: 10px;
            box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
            text-align: center;
        }

        .login-container h1 {
            margin-bottom: 25px;
            font-size: 28px;
            color: #333;
        }

        .login-container input {
            width: 100%;
            padding: 10px;
            margin: 10px 0 20px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        .toggle-password {
            font-size: 13px;
            margin-top: -15px;
            margin-bottom: 10px;
            color: #007bff;
            cursor: pointer;
            display: block;
            text-align: left;
        }

        .login-container button {
            background-color: #007bff;
            color: white;
            border: none;
            padding: 12px 20px;
            font-size: 16px;
            border-radius: 6px;
            width: 100%;
            cursor: pointer;
        }

        .login-container button:hover {
            background-color: #0056b3;
        }

        .forgot-password {
            margin-top: 20px;
            display: block;
            font-size: 14px;
            color: #007bff;
            text-decoration: none;
        }

        .error-message {
            color: red;
            font-size: 14px;
        }

        .brand-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #1b1b1b;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="brand-title">GD GROUP</div>
        <h1>Iniciar Sesión</h1>
        <form method="post" action="/login">
            <label for="correo">Correo Electrónico</label>
            <input type="email" id="correo" name="correo" required>

            <label for="password">Contraseña</label>
            <input type="password" id="password" name="password" required>
            <span class="toggle-password" onclick="togglePassword()">Ver/ocultar contraseña</span>

            <button type="submit">Ingresar</button>

            {% if error %}
                <p class="error-message">{{ error }}</p>
            {% endif %}
        </form>
        <a href="/recuperar_contrasena" class="forgot-password">¿Olvidaste tu contraseña?</a>
    </div>

    <script>
        function togglePassword() {
            const input = document.getElementById('password');
            input.type = input.type === 'password' ? 'text' : 'password';
        }
    </script>
</body>
</html>
