{% set lang = request.cookies.get('panel_lang', 'es') %}
<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ "Bots de Traducción - Login" | translate(lang) }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
    <style>
        body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }
        .login-card { max-width: 400px; margin: 100px auto; }
        .lang-selector { position: fixed; top: 20px; right: 20px; }
    </style>
</head>
<body>
    <div class="lang-selector">
        <div class="dropdown">
            <button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown">
                <i class="bi bi-translate"></i>
            </button>
            <ul class="dropdown-menu">
                <li><a class="dropdown-item {{ 'active' if lang == 'es' }}" href="/set-lang/es">Español</a></li>
                <li><a class="dropdown-item {{ 'active' if lang == 'en' }}" href="/set-lang/en">English</a></li>
                <li><a class="dropdown-item {{ 'active' if lang == 'pt' }}" href="/set-lang/pt">Português</a></li>
            </ul>
        </div>
    </div>
    <div class="container">
        <div class="card login-card shadow">
            <div class="card-body">
                <h3 class="text-center mb-4">🔐 {{ "Panel de Configuración" | translate(lang) }}</h3>
                {% if error %}
                <div class="alert alert-danger">{{ error | translate(lang) }}</div>
                {% endif %}
                <form method="post">
                    <div class="mb-3">
                        <label class="form-label">{{ "Usuario" | translate(lang) }}</label>
                        <input type="text" name="username" class="form-control" required>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ "Contraseña" | translate(lang) }}</label>
                        <input type="password" name="password" class="form-control" required>
                    </div>
                    <button type="submit" class="btn btn-primary w-100">{{ "Iniciar Sesión" | translate(lang) }}</button>
                </form>
            </div>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
