{#
Project: EPT-MX-ADM
Company: EasyProTech LLC (www.easypro.tech)
Dev: Brabus
Date: Thu 23 Oct 2025 22:56:11 UTC
Status: Login Template
Telegram: https://t.me/EasyProTech
#}
<!DOCTYPE html>
<html lang="{{ current_locale }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ t('auth.login') }} - {{ t('app.name') }}</title>
    
    <!-- Bootstrap CSS -->
    <link href="{{ url_for('static', filename='vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="{{ url_for('static', filename='vendor/bootstrap-icons/bootstrap-icons.css') }}">
    
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0;
            padding: 20px;
            box-sizing: border-box;
        }

        .login-container {
            width: 100%;
            max-width: 400px;
        }

        .login-card {
            border: none;
            border-radius: 15px;
            backdrop-filter: blur(10px);
            background: rgba(255, 255, 255, 0.95);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        }

        .theme-switcher {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 1000;
        }

        .theme-toggle {
            background: rgba(255, 255, 255, 0.9);
            border: none;
            border-radius: 25px;
            padding: 8px 12px;
            color: #333;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }

        .theme-toggle:hover {
            background: rgba(255, 255, 255, 1);
            transform: translateY(-2px);
        }

        .copyright {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            color: rgba(255, 255, 255, 0.8);
            font-size: 0.8rem;
            text-align: center;
        }

        .form-control:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
        }

        .btn-primary {
            background: linear-gradient(45deg, #667eea, #764ba2);
            border: none;
            border-radius: 25px;
            padding: 12px 30px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .text-primary {
            color: #667eea !important;
        }

        .flash-messages {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1050;
            width: 90%;
            max-width: 500px;
        }
        
        /* Dark theme styles for login page */
        [data-bs-theme="dark"] body {
            background: linear-gradient(135deg, #1a1d29 0%, #2c3e50 50%, #34495e 100%);
        }
        
        [data-bs-theme="dark"] .login-card {
            background: rgba(52, 58, 70, 0.95);
            color: #e9ecef;
        }
        
        [data-bs-theme="dark"] .text-muted {
            color: #adb5bd !important;
        }
        
        [data-bs-theme="dark"] .form-control {
            background-color: #495057;
            border-color: #6c757d;
            color: #e9ecef;
        }
        
        [data-bs-theme="dark"] .form-control:focus {
            background-color: #495057;
            border-color: #667eea;
            color: #e9ecef;
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
        }
        
        [data-bs-theme="dark"] .form-control::placeholder {
            color: #adb5bd;
        }
        
        [data-bs-theme="dark"] .text-primary {
            color: #6ea8fe !important;
        }
        
        [data-bs-theme="dark"] .theme-toggle {
            background: rgba(52, 58, 70, 0.9);
            color: #e9ecef;
        }
        
        [data-bs-theme="dark"] .theme-toggle:hover {
            background: rgba(52, 58, 70, 1);
        }

    </style>
</head>
<body>
    <!-- Flash Messages -->
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="flash-messages">
                {% for category, message in messages %}
                    <div class="alert alert-{{ 'danger' if category == 'error' else category }} alert-dismissible fade show" role="alert">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    <!-- Login Form -->
    <div class="login-container">
        <div class="card login-card">
            <div class="card-body p-5">
                <div class="text-center mb-4">
                    <i class="bi bi-chat-square-dots fs-1 text-primary"></i>
                    <h2 class="mt-3 mb-2">{{ t('app.name') }}</h2>
                    <p class="text-muted">{{ t('auth.login_subtitle') }}</p>
                </div>
                
                <form method="POST">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
                    
                    <!-- Security Indicators -->
                    <div class="mb-3 d-flex gap-2 justify-content-center">
                        <span class="badge bg-success">
                            <i class="bi bi-shield-check"></i> CSRF Protected
                        </span>
                        <span class="badge bg-success">
                            <i class="bi bi-shield-lock"></i> Rate Limited
                        </span>
                        <span class="badge bg-success">
                            <i class="bi bi-shield-fill-check"></i> Encrypted
                        </span>
                    </div>
                    
                    <div class="mb-3">
                        <label for="matrix_server" class="form-label">
                            <i class="bi bi-server"></i> Matrix Server
                        </label>
                        <input type="text" class="form-control form-control-lg" id="matrix_server" name="matrix_server" 
                               placeholder="matrix.example.com" required>
                    </div>
                    
                    <div class="mb-3">
                        <label for="username" class="form-label">
                            <i class="bi bi-person"></i> Username
                        </label>
                        <input type="text" class="form-control form-control-lg" id="username" name="username" 
                               placeholder="admin" required autofocus>
                    </div>
                    
                    <div class="mb-4">
                        <label for="password" class="form-label">
                            <i class="bi bi-lock"></i> {{ t('auth.password') }}
                        </label>
                        <input type="password" class="form-control form-control-lg" id="password" name="password" required>
                    </div>
                    
                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary btn-lg">
                            <i class="bi bi-box-arrow-in-right"></i> {{ t('auth.login') }}
                        </button>
                    </div>
                </form>
                
                <div class="mt-4 text-center">
                    <small class="text-muted">
                        {{ t('auth.admin_only_access') }}
                    </small>
                </div>
            </div>
        </div>
    </div>

    <!-- Theme Toggle -->
    <div class="theme-switcher">
        <button class="theme-toggle" onclick="toggleTheme()" title="{{ t('settings.toggle_theme') }}">
            <i class="bi bi-sun-fill" id="theme-icon"></i>
        </button>
    </div>

    <!-- Copyright -->
    <div class="copyright">
        <a href="{{ t('footer.website_url') }}" target="_blank" style="color: rgba(255, 255, 255, 0.8); text-decoration: none;">
            {{ t('footer.copyright') }}
        </a>
    </div>

    <!-- Bootstrap JS -->
    <script src="{{ url_for('static', filename='vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
    
    <script>
    // Theme switching functionality
    function toggleTheme() {
        const currentTheme = localStorage.getItem('theme') || 'light';
        const newTheme = currentTheme === 'light' ? 'dark' : 'light';
        
        setTheme(newTheme);
        localStorage.setItem('theme', newTheme);
    }
    
    function setTheme(theme) {
        const html = document.documentElement;
        const themeIcon = document.getElementById('theme-icon');
        
        if (theme === 'dark') {
            html.setAttribute('data-bs-theme', 'dark');
            if (themeIcon) {
                themeIcon.className = 'bi bi-moon-fill';
            }
        } else {
            html.setAttribute('data-bs-theme', 'light');
            if (themeIcon) {
                themeIcon.className = 'bi bi-sun-fill';
            }
        }
    }
    
    // Initialize theme on page load
    document.addEventListener('DOMContentLoaded', function() {
        const savedTheme = localStorage.getItem('theme') || 'light';
        setTheme(savedTheme);
    });
    </script>
</body>
</html> 