<!DOCTYPE html>
<html lang="{{ current_language }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>{{ _('mobile_access_title') }} - iAccess</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #667eea;
            --secondary-color: #764ba2;
            --success-color: #28a745;
            --danger-color: #dc3545;
            --warning-color: #ffc107;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            overflow-x: hidden;
        }

        .mobile-container {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .login-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 25px;
            padding: 40px 30px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            text-align: center;
        }

        .logo-section {
            margin-bottom: 30px;
        }

        .logo-section img {
            width: 150px;
            height: auto;
            margin-bottom: 15px;
        }

        .logo-section h1 {
            color: var(--primary-color);
            font-size: 1.8rem;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .logo-section p {
            color: #666;
            font-size: 0.9rem;
        }

        .form-group {
            margin-bottom: 25px;
            text-align: left;
        }

        .form-label {
            font-weight: 600;
            color: #333;
            margin-bottom: 8px;
            display: block;
            font-size: 0.9rem;
        }

        .form-control-mobile {
            width: 100%;
            padding: 15px 20px;
            border: 2px solid #e9ecef;
            border-radius: 15px;
            font-size: 16px;
            transition: all 0.3s ease;
            background: #f8f9fa;
        }

        .form-control-mobile:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
            background: white;
        }

        .btn-mobile {
            width: 100%;
            padding: 15px;
            border: none;
            border-radius: 15px;
            font-size: 1.1rem;
            font-weight: 600;
            transition: all 0.3s ease;
            margin-bottom: 15px;
        }

        .btn-primary-mobile {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
        }

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

        .btn-secondary-mobile {
            background: linear-gradient(135deg, #6c757d, #495057);
            color: white;
        }

        .btn-secondary-mobile:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(108, 117, 125, 0.4);
        }



        .alert-mobile {
            border-radius: 12px;
            padding: 12px 15px;
            margin-bottom: 20px;
            font-size: 0.9rem;
        }

        .loading {
            display: none;
        }

        .loading.active {
            display: block;
        }

        .spinner {
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-top: 3px solid white;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            animation: spin 1s linear infinite;
            display: inline-block;
            margin-right: 10px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        @media (max-width: 480px) {
            .login-card {
                padding: 30px 25px;
                margin: 10px;
            }
            
            .logo-section h1 {
                font-size: 1.5rem;
            }
        }


    </style>
</head>
<body>
    <!-- Sağ üstte language seçici (web ile aynı stil) -->
    <div style="position: fixed; top: 0; right: 0; z-index: 9999; margin: 18px 18px 0 0; text-align: right;">
        <div class="dropdown d-inline-block">
            <button class="btn btn-light btn-sm dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                <i class="fas fa-language me-1"></i>{{ _('language') }}
            </button>
            <ul class="dropdown-menu" aria-labelledby="langDropdown">
                <li><a class="dropdown-item" href="{{ url_for('set_lang', lang='tr') }}?next=mobile_login">{{ _('turkish') }}</a></li>
                <li><a class="dropdown-item" href="{{ url_for('set_lang', lang='en') }}?next=mobile_login">{{ _('english') }}</a></li>
            </ul>
        </div>
    </div>
    <div class="mobile-container">
        <div class="login-card">
            <div class="logo-section">
                <img src="{{ url_for('static', filename='img/monicont_logo.png') }}" alt="Logo">
                <h1>{{ _('mobile_access_title') }}</h1>
                <p>{{ _('mobile_access_subtitle') }}</p>
            </div>

            {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                    {% for category, msg in messages %}
                        <div class="alert alert-{{ 'danger' if category == 'danger' else category }} alert-mobile">
                            <i class="fas fa-exclamation-triangle me-2"></i>{{ msg }}
                        </div>
                    {% endfor %}
                {% elif error_msg %}
                    <div class="alert alert-danger alert-mobile">
                        <i class="fas fa-exclamation-triangle me-2"></i>{{ error_msg }}
                    </div>
                {% endif %}
            {% endwith %}

            <form method="POST" id="loginForm">
                <div class="form-group">
                    <label class="form-label"><i class="fas fa-id-card me-2"></i>{{ _('user_uuid') }}</label>
                    <input type="text" name="user_uuid" class="form-control-mobile" 
                           placeholder="{{ _('mobile_uuid_placeholder') }}" required>
                </div>

                <div class="form-group">
                    <label class="form-label"><i class="fas fa-lock me-2"></i>{{ _('login_password') }}</label>
                    <input type="password" name="password" class="form-control-mobile" 
                           placeholder="{{ _('login_password_placeholder') }}" required>
                </div>

                <button type="submit" class="btn-mobile btn-primary-mobile">
                    <span class="loading">
                        <div class="spinner"></div>
                    </span>
                    <i class="fas fa-sign-in-alt me-2"></i>{{ _('login_button') }}
                </button>
            </form>

        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // Form submit handling
        document.getElementById('loginForm').addEventListener('submit', function(e) {
            const submitBtn = this.querySelector('button[type="submit"]');
            const loading = submitBtn.querySelector('.loading');
            
            submitBtn.disabled = true;
            loading.classList.add('active');
            
            // Re-enable after 3 seconds (in case of error)
            setTimeout(() => {
                submitBtn.disabled = false;
                loading.classList.remove('active');
            }, 3000);
        });


    </script>
</body>
</html> 