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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SSO Login — Synergo</title>
    <meta name="description" content="Sign in to Synergo SSO — Single Sign-On identity platform">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>
        *, *::before, *::after {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f0f4f8;
            overflow: hidden;
            position: relative;
        }

        /* Decorative background blobs */
        body::before {
            content: '';
            position: fixed;
            top: -80px;
            right: -80px;
            width: 280px;
            height: 280px;
            background: rgba(59, 130, 246, 0.06);
            border-radius: 50%;
            z-index: 0;
        }

        body::after {
            content: '';
            position: fixed;
            bottom: -60px;
            left: -60px;
            width: 220px;
            height: 220px;
            background: rgba(59, 130, 246, 0.05);
            border-radius: 50%;
            z-index: 0;
        }

        .blob-accent {
            position: fixed;
            width: 160px;
            height: 160px;
            background: rgba(16, 185, 129, 0.05);
            border-radius: 50%;
            z-index: 0;
        }

        .blob-accent-1 {
            top: 30%;
            left: -40px;
        }

        .blob-accent-2 {
            bottom: 20%;
            right: 10%;
        }

        .blob-accent-3 {
            top: 10%;
            left: 40%;
            width: 100px;
            height: 100px;
            background: rgba(251, 191, 36, 0.06);
        }

        /* Decorative dots */
        .dots {
            position: fixed;
            z-index: 0;
            opacity: 0.4;
        }

        .dots-1 {
            top: 15%;
            right: 8%;
        }

        .dots-2 {
            bottom: 12%;
            left: 5%;
        }

        .login-card {
            position: relative;
            z-index: 1;
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 24px;
            padding: 48px 40px;
            width: 100%;
            max-width: 400px;
            box-shadow:
                0 4px 6px -1px rgba(0, 0, 0, 0.04),
                0 10px 40px -4px rgba(0, 0, 0, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.6);
            animation: cardSlideUp 0.6s ease-out;
        }

        @keyframes cardSlideUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .illustration-wrapper {
            text-align: center;
            margin-bottom: 24px;
        }

        .illustration-wrapper img {
            width: 200px;
            height: auto;
            animation: floatIllustration 4s ease-in-out infinite;
        }

        @keyframes floatIllustration {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-8px); }
        }

        .login-card h1 {
            font-size: 26px;
            font-weight: 700;
            color: #111827;
            text-align: center;
            margin-bottom: 8px;
        }

        .login-card .subtitle {
            font-size: 14px;
            color: #6b7280;
            text-align: center;
            margin-bottom: 32px;
            line-height: 1.5;
        }

        /* Alert/Error */
        .alert-error {
            background: #fef2f2;
            border: 1px solid #fecaca;
            border-radius: 12px;
            padding: 12px 16px;
            margin-bottom: 20px;
            animation: shake 0.4s ease-in-out;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-4px); }
            75% { transform: translateX(4px); }
        }

        .alert-error ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .alert-error li {
            font-size: 13px;
            color: #dc2626;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .alert-error li::before {
            content: '';
            width: 6px;
            height: 6px;
            background: #dc2626;
            border-radius: 50%;
            flex-shrink: 0;
        }

        /* Input groups */
        .input-group {
            position: relative;
            margin-bottom: 16px;
        }

        .input-group .input-icon {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            color: #9ca3af;
            pointer-events: none;
            transition: color 0.2s;
        }

        .input-group input {
            width: 100%;
            padding: 14px 16px 14px 48px;
            border: 1.5px solid #e5e7eb;
            border-radius: 12px;
            font-size: 15px;
            font-family: 'Inter', sans-serif;
            color: #374151;
            background: #fff;
            transition: all 0.25s ease;
            outline: none;
        }

        .input-group input::placeholder {
            color: #9ca3af;
        }

        .input-group input:focus {
            border-color: #3b82f6;
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
        }

        .input-group input:focus + .input-icon,
        .input-group input:focus ~ .input-icon {
            color: #3b82f6;
        }

        /* Password toggle */
        .password-toggle {
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            cursor: pointer;
            color: #9ca3af;
            padding: 4px;
            transition: color 0.2s;
        }

        .password-toggle:hover {
            color: #6b7280;
        }

        /* Row between remember & forgot */
        .form-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            margin-top: 4px;
        }

        .remember-label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
            color: #6b7280;
            cursor: pointer;
        }

        .remember-label input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: #3b82f6;
            cursor: pointer;
        }

        .forgot-link {
            font-size: 14px;
            color: #3b82f6;
            text-decoration: none;
            font-weight: 500;
            transition: color 0.2s;
        }

        .forgot-link:hover {
            color: #2563eb;
        }

        /* Submit button */
        .btn-login {
            width: 100%;
            padding: 14px 24px;
            background: #2563eb;
            color: #fff;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .btn-login:hover {
            background: #1d4ed8;
            transform: translateY(-1px);
            box-shadow: 0 8px 24px -4px rgba(37, 99, 235, 0.4);
        }

        .btn-login:active {
            transform: translateY(0);
        }

        /* Footer */
        .card-footer {
            text-align: center;
            margin-top: 28px;
            font-size: 13px;
            color: #9ca3af;
        }

        /* Responsive */
        @media (max-width: 480px) {
            .login-card {
                margin: 16px;
                padding: 36px 24px;
                border-radius: 20px;
            }

            .illustration-wrapper img {
                width: 160px;
            }
        }
    </style>
</head>

<body>
    <!-- Decorative blobs -->
    <div class="blob-accent blob-accent-1"></div>
    <div class="blob-accent blob-accent-2"></div>
    <div class="blob-accent blob-accent-3"></div>

    <!-- Decorative dots -->
    <svg class="dots dots-1" width="48" height="48" viewBox="0 0 48 48" fill="none">
        <circle cx="4" cy="4" r="3" fill="#d1d5db"/><circle cx="16" cy="4" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="4" r="3" fill="#d1d5db"/><circle cx="40" cy="4" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="16" r="3" fill="#d1d5db"/><circle cx="16" cy="16" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="16" r="3" fill="#d1d5db"/><circle cx="40" cy="16" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="28" r="3" fill="#d1d5db"/><circle cx="16" cy="28" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="28" r="3" fill="#d1d5db"/><circle cx="40" cy="28" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="40" r="3" fill="#d1d5db"/><circle cx="16" cy="40" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="40" r="3" fill="#d1d5db"/><circle cx="40" cy="40" r="3" fill="#d1d5db"/>
    </svg>
    <svg class="dots dots-2" width="48" height="48" viewBox="0 0 48 48" fill="none">
        <circle cx="4" cy="4" r="3" fill="#d1d5db"/><circle cx="16" cy="4" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="4" r="3" fill="#d1d5db"/><circle cx="40" cy="4" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="16" r="3" fill="#d1d5db"/><circle cx="16" cy="16" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="16" r="3" fill="#d1d5db"/><circle cx="40" cy="16" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="28" r="3" fill="#d1d5db"/><circle cx="16" cy="28" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="28" r="3" fill="#d1d5db"/><circle cx="40" cy="28" r="3" fill="#d1d5db"/>
        <circle cx="4" cy="40" r="3" fill="#d1d5db"/><circle cx="16" cy="40" r="3" fill="#d1d5db"/>
        <circle cx="28" cy="40" r="3" fill="#d1d5db"/><circle cx="40" cy="40" r="3" fill="#d1d5db"/>
    </svg>

    <div class="login-card">
        <!-- Illustration -->
        <div class="illustration-wrapper">
            <img src="{{ asset('images/login-illustration.png') }}" alt="Sign In Illustration">
        </div>

        <!-- Heading -->
        <h1>Sign In</h1>
        <p class="subtitle">Enter valid email & password to continue</p>

        <!-- Success Message -->
        @if (session('status'))
            <div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:12px;padding:12px 16px;margin-bottom:20px;font-size:13px;color:#16a34a;">
                {{ session('status') }}
            </div>
        @endif

        <!-- Error Messages -->
        @if ($errors->any())
            <div class="alert-error">
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <!-- Login Form -->
        <form method="POST" action="{{ route('login') }}" id="loginForm">
            @csrf
            @if(isset($redirect) || request('redirect'))
                <input type="hidden" name="redirect" value="{{ $redirect ?? request('redirect') }}">
            @endif

            <!-- Email -->
            <div class="input-group">
                <input type="email" id="email" name="email" placeholder="Email address" required
                    value="{{ old('email') }}" autocomplete="email">
                <svg class="input-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
                    <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
                    <circle cx="12" cy="7" r="4"/>
                </svg>
            </div>

            <!-- Password -->
            <div class="input-group">
                <input type="password" id="password" name="password" placeholder="Password" required
                    autocomplete="current-password">
                <svg class="input-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
                    <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
                    <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
                </svg>
                <button type="button" class="password-toggle" onclick="togglePassword()" aria-label="Toggle password visibility">
                    <svg id="eyeIcon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
                        <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
                        <circle cx="12" cy="12" r="3"/>
                    </svg>
                </button>
            </div>

            <!-- Options Row -->
            <div class="form-options">
                <label class="remember-label">
                    <input type="checkbox" id="remember" name="remember">
                    Remember me
                </label>
                <a href="{{ route('password.forgot') }}" class="forgot-link">Forget password</a>
            </div>

            <!-- Submit -->
            <button type="submit" class="btn-login" id="loginButton">Login</button>
        </form>

        <div class="card-footer">
            Synergo Identity Platform
        </div>
    </div>

    <script>
        function togglePassword() {
            const passwordInput = document.getElementById('password');
            const eyeIcon = document.getElementById('eyeIcon');
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                eyeIcon.innerHTML = '<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/>';
            } else {
                passwordInput.type = 'password';
                eyeIcon.innerHTML = '<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>';
            }
        }
    </script>
</body>

</html>