<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SocietyPro Login</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', sans-serif;
        }

        body {
            min-height: 100vh;
            background:
                radial-gradient(circle at top right,
                    rgba(34, 197, 94, .15),
                    transparent 35%),
                radial-gradient(circle at bottom left,
                    rgba(34, 197, 94, .08),
                    transparent 30%),
                #f8fafc;

            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
        }

        .small-swal {
            border-radius: 18px !important;
        }

        .small-swal .swal2-title {
            font-size: 20px !important;
            font-weight: 700 !important;
            color: #111827 !important;
        }

        .small-swal .swal2-html-container {
            font-size: 14px !important;
            color: #6b7280 !important;
        }

        .small-swal .swal2-success-ring {
            border-color: rgba(34, 197, 94, .3) !important;
        }

        .container {
            width: 100%;
            max-width: 1200px;
            display: grid;
            grid-template-columns: 1.1fr 450px;
            gap: 50px;
            align-items: center;
        }

        /* LEFT SIDE */

        .left-section h5 {
            color: #22c55e;
            font-size: 14px;
            margin-bottom: 15px;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .left-section h1 {
            font-size: 55px;
            line-height: 1.1;
            color: #0f172a;
            margin-bottom: 20px;
            font-weight: 800;
        }

        .left-section p {
            color: #64748b;
            font-size: 17px;
            line-height: 1.8;
            margin-bottom: 35px;
            max-width: 600px;
        }

        .features {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            margin-bottom: 40px;
        }

        .feature {
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 15px;
            font-weight: 600;
            color: #334155;
        }

        .check {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: #dcfce7;
            color: #16a34a;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }

        /* LOGIN CARD */

        .login-card {
            background: rgba(255, 255, 255, .95);
            backdrop-filter: blur(20px);
            border: 1px solid #e5e7eb;
            border-radius: 30px;
            padding: 40px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, .08);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 30px;
        }

        .logo-icon {
            width: 45px;
            height: 45px;
            border-radius: 12px;
            background: #22c55e;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 20px;
        }

        .logo h2 {
            color: #0f172a;
            font-size: 24px;
        }

        .login-card h3 {
            font-size: 32px;
            color: #0f172a;
            margin-bottom: 10px;
        }

        .login-card > p {
            color: #64748b;
            margin-bottom: 30px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #334155;
        }

        .input-wrapper {
            position: relative;
        }

        .form-control {
            width: 100%;
            height: 55px;
            border: 1px solid #dbe2ea;
            border-radius: 14px;
            padding: 0 18px;
            font-size: 15px;
            transition: .3s;
        }

        .form-control:focus {
            outline: none;
            border-color: #22c55e;
            box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
        }

        .password-toggle {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: #64748b;
        }

        .options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }

        .options a {
            color: #22c55e;
            text-decoration: none;
            font-weight: 600;
        }

        .btn-login {
            width: 100%;
            height: 56px;
            border: none;
            border-radius: 14px;
            background: linear-gradient(135deg, #22c55e, #16a34a);
            color: white;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: .3s;
        }

        .btn-login:hover {
            transform: translateY(-2px);
        }

        /* RESPONSIVE */

        @media(max-width:992px) {

            .container {
                grid-template-columns: 1fr;
            }

            .left-section {
                display: none;
            }

            .login-card {
                max-width: 500px;
                margin: auto;
            }

        }
    </style>
</head>

<body>

    <div class="container">

        <!-- LEFT SIDE -->

        <div class="left-section">

            <h5>Society Management Software</h5>

            <h1>
                Simplify Society
                Management
            </h1>

            <p>
                Manage residents, visitors, complaints, maintenance
                billing and community operations from one centralized
                platform.
            </p>

            <div class="features">

                <div class="feature">
                    <div class="check">✓</div>
                    Resident Management
                </div>

                <div class="feature">
                    <div class="check">✓</div>
                    Visitor Tracking
                </div>

                <div class="feature">
                    <div class="check">✓</div>
                    Complaint Management
                </div>

                <div class="feature">
                    <div class="check">✓</div>
                    Maintenance Billing
                </div>

            </div>

        </div>

        <!-- LOGIN CARD -->

        <div class="login-card">

            <div class="logo">
                <div class="logo-icon">🏢</div>
                <h2>SocietyPro</h2>
            </div>

            <h3>Welcome Back 👋</h3>

            <p>
                Sign in to access your society dashboard.
            </p>

            <form id="loginForm">

                <div class="form-group">
                    <label>Mobile Number</label>
                    <input
                        type="text"
                        id="mobile"
                        class="form-control"
                        placeholder="Enter mobile number"
                        maxlength="10"
                        inputmode="numeric"
                        autocomplete="off"
                        required
                    >
                </div>

                <div class="form-group">
                    <label>Password</label>

                    <div class="input-wrapper">

                        <input type="password" id="password" class="form-control" placeholder="Enter password" required>

                        <span class="password-toggle" onclick="togglePassword()">
                            <i id="eyeIcon" class="fa-solid fa-eye-slash"></i>
                        </span>

                    </div>

                </div>

                <div class="options">
                    <a href="#">Forgot Password?</a>
                </div>

                <button type="submit" class="btn-login">
                    Log In
                </button>

            </form>
        </div>

    </div>

    <script>

        /* ── Mobile: digits only ── */

        const mobileInput = document.getElementById('mobile');

        // Block non-digit keypresses
        mobileInput.addEventListener('keypress', function (e) {
            if (!/[0-9]/.test(e.key)) {
                e.preventDefault();
            }
        });

        // Strip any non-digit that slips in (autofill, drag-drop, etc.)
        mobileInput.addEventListener('input', function () {
            this.value = this.value.replace(/[^0-9]/g, '');
        });

        // Intercept paste — keep digits only
        mobileInput.addEventListener('paste', function (e) {
            e.preventDefault();
            const pasted = (e.clipboardData || window.clipboardData).getData('text');
            const digitsOnly = pasted.replace(/[^0-9]/g, '').slice(0, 10);
            this.value = digitsOnly;
        });

        /* ── Password toggle ── */

        function togglePassword() {

            const password = document.getElementById('password');
            const eyeIcon  = document.getElementById('eyeIcon');

            if (password.type === 'password') {
                password.type = 'text';
                eyeIcon.classList.remove('fa-eye-slash');
                eyeIcon.classList.add('fa-eye');
            } else {
                password.type = 'password';
                eyeIcon.classList.remove('fa-eye');
                eyeIcon.classList.add('fa-eye-slash');
            }
        }

        /* ── Login validation ── */

        document.getElementById('loginForm').addEventListener('submit', function (e) {

            e.preventDefault();

            const mobile   = document.getElementById('mobile').value.trim();
            const password = document.getElementById('password').value;

            if (mobile === '9999999999' && password === '1234') {

                Swal.fire({
                    icon: 'success',
                    title: 'Login Successful',
                    text: 'Redirecting...',
                    timer: 2000,
                    showConfirmButton: false,
                    width: '320px',
                    padding: '1.2rem',
                    customClass: { popup: 'small-swal' }
                }).then(() => {
                    window.location.href = 'society_onboarding_form.php';
                });

            } else {

                Swal.fire({
                    icon: 'error',
                    title: 'Invalid Credentials',
                    text: 'The mobile number or password you entered is incorrect.',
                    confirmButtonText: 'Try Again',
                    confirmButtonColor: '#22c55e',
                    width: '340px',
                    padding: '1.2rem',
                    customClass: { popup: 'small-swal' }
                });

            }

        });

    </script>
</body>

</html>