<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Verify OTP - Credora Microfinance</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

    <style>
        :root {
            --primary-green: #198754;
            --primary-yellow: #ffc107;
            --green-light: #38ef7d;
            --green-dark: #11998e;
            --yellow-light: #ffda6a;
            --text-dark: #333;
            --text-light: #6c757d;
            --white: #fff;
        }

        body {
            min-height: 100vh;
            margin: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-container {
            background: var(--white);
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            overflow: hidden;
            width: 100%;
            max-width: 600px;
            display: flex;
            flex-direction: column;
            min-height: auto;
        }

        .login-image {
            background: linear-gradient(135deg, var(--primary-green) 0%, var(--green-dark) 100%);
            padding: 30px 40px;
            text-align: center;
            color: white;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            position: relative;
            overflow: hidden;
        }

        .login-image::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 100%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
            transform: rotate(45deg);
        }

        .brand-section {
            position: relative;
            z-index: 2;
        }

        .brand-logo {
            width: 160px;
            height: 160px;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 10px;
            box-shadow: none;
            overflow: hidden;
            border-radius: 50%;
            padding: 15px;
            position: relative;
        }

        .brand-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .brand-text {
            font-size: 2.5rem;
            font-weight: 800;
            margin-bottom: 15px;
            letter-spacing: 3px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .tagline {
            font-size: 1.3rem;
            margin-bottom: 40px;
            opacity: 0.9;
            font-weight: 300;
        }

        .features-list {
            text-align: left;
            margin: 40px 0;
        }

        .feature-item {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            font-size: 1.1rem;
        }

        .feature-item i {
            color: var(--primary-yellow);
            margin-right: 15px;
            font-size: 1.3rem;
        }

        .contact-info {
            margin-top: 50px;
            font-size: 0.95rem;
            opacity: 0.9;
            position: relative;
            z-index: 2;
        }

        .login-form {
            padding: 60px 50px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            background: var(--white);
        }

        .form-control {
            border: 2px solid #e9ecef;
            border-radius: 12px;
            padding: 15px 20px;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .form-control:focus {
            border-color: var(--primary-green);
            box-shadow: 0 0 0 0.3rem rgba(25, 135, 84, 0.15);
        }

        .input-group-text {
            border: 2px solid #e9ecef;
            background-color: #f8f9fa;
        }

        .input-group .form-control {
            border-left: none;
        }

        .input-group .form-control:focus {
            border-left: none;
        }

        .btn-login {
            background: linear-gradient(135deg, var(--primary-green) 0%, var(--green-dark) 100%);
            border: none;
            padding: 15px;
            font-weight: 600;
            letter-spacing: 0.5px;
            color: var(--white);
            border-radius: 12px;
            font-size: 1.1rem;
            transition: all 0.3s ease;
            box-shadow: 0 5px 15px rgba(25, 135, 84, 0.3);
        }

        .btn-login:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(25, 135, 84, 0.4);
        }

        .form-check-input:checked {
            background-color: var(--primary-green);
            border-color: var(--primary-green);
        }

        .login-header {
            text-align: center;
            margin-bottom: 40px;
        }

        .login-title {
            font-size: 2.2rem;
            font-weight: 700;
            color: var(--primary-green);
            margin-bottom: 10px;
        }

        .login-subtitle {
            color: var(--text-light);
            font-size: 1.1rem;
        }

        .otp-input {
            text-align: center;
            font-size: 1.5rem;
            font-weight: bold;
            letter-spacing: 8px;
        }

        .email-display {
            background: linear-gradient(135deg, rgba(25, 135, 84, 0.05) 0%, rgba(17, 153, 142, 0.05) 100%);
            border-radius: 12px;
            padding: 20px;
            margin: 20px 0 30px;
            text-align: center;
            border: 1px solid rgba(25, 135, 84, 0.2);
        }

        .email-display i {
            color: var(--primary-green);
        }

        .email-display strong {
            color: var(--primary-green);
            background-color: rgba(25, 135, 84, 0.1);
            padding: 3px 8px;
            border-radius: 6px;
        }

        .alert {
            border-radius: 12px;
            padding: 15px 20px;
        }

        .alert ul {
            padding-left: 20px;
            margin-bottom: 0;
        }

        /* Mobile responsiveness */
        @media (max-width: 576px) {
            body {
                padding: 10px;
            }

            .login-container {
                border-radius: 15px;
            }

            .login-image {
                padding: 30px 20px;
            }

            .login-form {
                padding: 30px 20px;
            }

            .brand-text {
                font-size: 2rem;
            }

            .login-title {
                font-size: 2rem;
            }

            .brand-logo {
                width: 140px;
                height: 140px;
                padding: 12px;
            }

            .tagline {
                font-size: 1.1rem;
                margin-bottom: 20px;
            }

            .login-header {
                margin-bottom: 25px;
            }

            .form-control {
                padding: 12px 15px;
            }

            .btn-login {
                padding: 12px;
            }

            .otp-input {
                font-size: 1.2rem;
                letter-spacing: 5px;
            }

            .email-display {
                padding: 15px;
                font-size: 0.95rem;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <!-- Branding Section -->
        <div class="login-image">
            <div class="brand-section">
                <div class="brand-logo">
                    <img src="{{ asset('images/melsoft-logo.jpg') }}" alt="Melsoft Logo">
                </div>

                <div class="brand-text">CREDORA</div>
                <div class="tagline">Easy, Efficient, Empowering</div>
            </div>
        </div>

        <!-- Verify OTP Form -->
        <div class="login-form">
            <div class="login-header">
                <h1 class="login-title">Verify OTP</h1>
                <p class="login-subtitle">Enter the OTP sent to your email</p>
            </div>

            @if (session('message'))
                <div class="alert alert-info border-0 shadow-sm alert-dismissible fade show" role="alert">
                    <i class="fas fa-info-circle me-2"></i>{{ session('message') }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
            @endif

            @if ($errors->any())
                <div class="alert alert-danger border-0 shadow-sm alert-dismissible fade show" role="alert">
                    <i class="fas fa-exclamation-circle me-2"></i>
                    <ul class="mb-0">
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
            @endif

            <form method="POST" action="{{ route('password.verify.post') }}">
                @csrf
                <input type="hidden" name="email" value="{{ $email }}">

                <div class="email-display">
                    <i class="fas fa-envelope me-2"></i>
                    Check your email <strong>{{ $email }}</strong> for the 6-digit OTP
                </div>

                <div class="mb-4">
                    <label class="form-label fw-semibold text-dark">Enter OTP</label>
                    <div class="input-group">
                        <span class="input-group-text bg-light border-end-0">
                            <i class="fas fa-key text-muted"></i>
                        </span>
                        <input type="text" name="otp" class="form-control border-start-0 otp-input"
                               maxlength="6" required autofocus placeholder="000000" pattern="[0-9]{6}" inputmode="numeric">
                    </div>
                    <small class="text-muted mt-2 d-block">
                        <i class="fas fa-info-circle me-1"></i>Enter the 6-digit verification code
                    </small>
                </div>

                <button type="submit" class="btn btn-login btn-lg w-100 mb-3">
                    <i class="fas fa-check-circle me-2"></i>Verify OTP
                </button>

                <div class="text-center">
                    <a href="{{ route('auth.forgotPassword') }}" class="text-decoration-none text-primary">
                        <i class="fas fa-arrow-left me-1"></i>Back to Email
                    </a>
                </div>

                <div class="text-center mt-4 pt-3 border-top">
                    <small class="text-muted">&copy; {{ date('Y') }} Melsoft (Pvt) Ltd. All rights reserved.</small>
                </div>
            </form>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Auto-submit when OTP is complete (optional enhancement)
        document.addEventListener('DOMContentLoaded', function() {
            const otpInput = document.querySelector('input[name="otp"]');

            otpInput.addEventListener('input', function(e) {
                // Only allow numbers
                this.value = this.value.replace(/[^0-9]/g, '');

                // Auto-submit when 6 digits are entered
                if (this.value.length === 6) {
                    // Optional: You can uncomment the next line to auto-submit
                    // this.form.submit();
                }
            });
        });
    </script>
</body>
</html>
