<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sign In — OlaInvoice</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <style>
        * { box-sizing: border-box; }

        body {
            margin: 0;
            min-height: 100vh;
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: #f0fdf4;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
        }

        .auth-wrap {
            width: 100%;
            max-width: 420px;
        }

        .auth-card {
            background: white;
            border-radius: 16px;
            padding: 2.5rem 2rem;
            box-shadow: 0 4px 32px rgba(0,0,0,0.08);
        }

        .brand-mark {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 2rem;
            justify-content: center;
        }

        .brand-icon {
            width: 44px; height: 44px;
            background: #00a651;
            border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
        }

        .brand-icon svg { width: 26px; height: 26px; }

        .brand-icon-text {
            font-size: 1.4rem;
            font-weight: 800;
            color: #1e293b;
            letter-spacing: -0.5px;
        }

        .brand-icon-text span { color: #00a651; }

        h4 { font-size: 1.2rem; font-weight: 700; color: #1e293b; margin-bottom: 0.3rem; }
        p.sub { color: #64748b; font-size: 0.875rem; margin-bottom: 1.5rem; }

        .form-label { font-weight: 500; font-size: 0.85rem; color: #374151; margin-bottom: 5px; }

        .form-control {
            border-radius: 8px;
            border: 1.5px solid #e2e8f0;
            padding: 0.6rem 0.85rem;
            font-size: 0.9rem;
            transition: border-color 0.15s;
        }

        .form-control:focus {
            border-color: #00a651;
            box-shadow: 0 0 0 3px rgba(0,166,81,0.12);
        }

        .input-group-text {
            background: #f8fafc;
            border: 1.5px solid #e2e8f0;
            border-radius: 8px 0 0 8px;
        }

        .input-group .form-control { border-radius: 0 8px 8px 0; }

        .btn-main {
            background: #00a651;
            color: white;
            border: none;
            border-radius: 8px;
            font-weight: 600;
            padding: 0.65rem 1rem;
            font-size: 0.95rem;
            width: 100%;
            transition: background 0.15s, transform 0.1s;
        }

        .btn-main:hover { background: #007a3d; color: white; transform: translateY(-1px); }

        .demo-hint {
            background: #f0fdf4;
            border: 1px solid #bbf7d0;
            border-radius: 8px;
            padding: 0.65rem 1rem;
            font-size: 0.8rem;
            color: #15803d;
            margin-bottom: 1.25rem;
        }

        .auth-footer {
            text-align: center;
            margin-top: 2rem;
            font-size: 0.75rem;
            color: #94a3b8;
        }

        .auth-footer a {
            color: #00a651;
            text-decoration: none;
            font-weight: 500;
        }

        .auth-footer a:hover { text-decoration: underline; }
    </style>
</head>
<body>
<div class="auth-wrap">
    <div class="auth-card">

        {{-- Brand --}}
        <div class="brand-mark">
            <div class="brand-icon">
                <svg viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <rect x="8" y="6" width="46" height="58" rx="5" fill="white" opacity="0.95"/>
                    <polygon points="42,6 54,18 42,18" fill="white" opacity="0.65"/>
                    <rect x="15" y="26" width="28" height="3" rx="1.5" fill="#007a3d" opacity="0.6"/>
                    <rect x="15" y="34" width="22" height="3" rx="1.5" fill="#007a3d" opacity="0.4"/>
                    <rect x="15" y="42" width="25" height="3" rx="1.5" fill="#007a3d" opacity="0.4"/>
                    <circle cx="61" cy="61" r="16" fill="#00c96a"/>
                    <circle cx="61" cy="61" r="12" fill="#007a3d"/>
                    <text x="61" y="66" text-anchor="middle" font-size="15" font-weight="900" font-family="Arial,sans-serif" fill="white">₦</text>
                </svg>
            </div>
            <div class="brand-icon-text">Ola<span>Invoice</span></div>
        </div>

        <h4>Welcome back</h4>
        <p class="sub">Sign in to manage your invoices and payments</p>

        {{-- Demo hint --}}
        <div class="demo-hint">
            <i class="bi bi-info-circle me-1"></i>
            <strong>Demo:</strong> demo@olainvoice.ng &nbsp;/&nbsp; password
        </div>

        @if($errors->any())
            <div class="alert alert-danger rounded-3 small py-2 mb-3"
                 style="font-size:0.82rem;">
                <i class="bi bi-exclamation-circle me-1"></i>{{ $errors->first() }}
            </div>
        @endif

        @if(session('success'))
            <div class="alert alert-success rounded-3 small py-2 mb-3"
                 style="font-size:0.82rem;">
                <i class="bi bi-check-circle me-1"></i>{{ session('success') }}
            </div>
        @endif

        <form method="POST" action="{{ route('login') }}">
        @csrf

            <div class="mb-3">
                <label class="form-label">Email address</label>
                <input type="email" name="email" class="form-control"
                       value="{{ old('email', 'demo@olainvoice.ng') }}"
                       placeholder="you@yourbusiness.com"
                       autofocus required>
            </div>

            <div class="mb-2">
                <label class="form-label">Password</label>
                <div class="input-group">
                    <input type="password" name="password" id="pwdInput"
                           class="form-control border-end-0"
                           value="password" placeholder="Your password" required>
                    <button type="button"
                            class="input-group-text border-start-0"
                            style="cursor:pointer;background:white;border:1.5px solid #e2e8f0;"
                            onclick="togglePwd()">
                        <i id="pwdIcon" class="bi bi-eye text-muted" style="font-size:0.9rem;"></i>
                    </button>
                </div>
            </div>

            <div class="d-flex align-items-center justify-content-between mb-4">
                <div class="form-check mb-0">
                    <input type="checkbox" class="form-check-input" name="remember" id="remember">
                    <label class="form-check-label" for="remember"
                           style="font-size:0.82rem;color:#64748b;">
                        Keep me signed in
                    </label>
                </div>
                <a href="#" style="font-size:0.82rem;color:#00a651;text-decoration:none;">
                    Forgot password?
                </a>
            </div>

            <button type="submit" class="btn-main">
                Sign In <i class="bi bi-arrow-right ms-1"></i>
            </button>

        </form>

        <p style="text-align:center;margin-top:1.25rem;font-size:0.85rem;color:#64748b;margin-bottom:0;">
            New here?
            <a href="{{ route('register') }}"
               style="color:#00a651;font-weight:600;text-decoration:none;">
                Create a free account
            </a>
        </p>

    </div>

    <div class="auth-footer">
        &copy; {{ date('Y') }} OlaInvoice &nbsp;·&nbsp;
        Made by
        <a href="https://adeyemoportfolio.armitech.com.ng/about.php"
           target="_blank" rel="noopener">
            Adeyemo Olamilekan
        </a>
    </div>
</div>

<script>
function togglePwd() {
    const input = document.getElementById('pwdInput');
    const icon  = document.getElementById('pwdIcon');
    if (input.type === 'password') {
        input.type = 'text';
        icon.classList.replace('bi-eye', 'bi-eye-slash');
    } else {
        input.type = 'password';
        icon.classList.replace('bi-eye-slash', 'bi-eye');
    }
}
</script>
</body>
</html>
