@using Microsoft.Extensions.Localization
@inject IStringLocalizer<QRRapidoApp.Resources.SharedResource> Localizer
@{
    ViewData["Title"] = "Login";
    var returnUrl = ViewBag.ReturnUrl ?? "/";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-6 col-lg-4">
            <div class="card shadow-sm">
                <div class="card-header bg-primary text-white text-center">
                    <h4 class="mb-0">
                        <i class="fas fa-sign-in-alt"></i> @Localizer["Login"]
                    </h4>
                </div>
                <div class="card-body">
                    <div class="text-center mb-4">
                        <p class="text-muted">@Localizer["LoginAndGet"]</p>
                        
                        <div class="alert alert-warning border-0 shadow-sm" style="background-color: #fff3cd;">
                            <ul class="list-unstyled mb-0 text-start d-inline-block">
                                <li class="mb-2"><i class="fas fa-crown text-warning me-2"></i> @Localizer["ThirtyDaysNoAds"]</li>
                                <li class="mb-2"><i class="fas fa-infinity text-primary me-2"></i> @Localizer["FiftyQRCodesPerDay"]</li>
                                <li class="mb-0"><i class="fas fa-history text-info me-2"></i> @Localizer["QRCodeHistory"]</li>
                            </ul>
                        </div>
                    </div>

                    <div class="d-grid gap-3">
                        <a href="/Account/LoginGoogle?returnUrl=@returnUrl" class="btn btn-danger btn-lg">
                            <i class="fab fa-google"></i> @Localizer["LoginWithGoogle"]
                        </a>
                        
                        <a href="/Account/LoginMicrosoft?returnUrl=@returnUrl" class="btn btn-primary btn-lg">
                            <i class="fab fa-microsoft"></i> @Localizer["LoginWithMicrosoft"]
                        </a>
                    </div>

                    <hr class="my-4">
                    
                    <div class="text-center">
                        <h6 class="text-success">
                            <i class="fas fa-gift"></i> @Localizer["SpecialOfferLogin"]
                        </h6>
                        <p class="small text-muted">
                            @Localizer["LoginAutomaticallyGain"] <strong>@Localizer["ThirtyDaysNoAds"]</strong> 
                            @Localizer["AndCanGenerate"] <strong>@Localizer["FiftyQRCodesPerDay"]</strong> @Localizer["ForFree"]
                        </p>
                    </div>

                    <div class="text-center mt-3">
                        <small class="text-muted">
                            @Localizer["NoRegisterWithoutPermission"] <br>
                            <a href="@Url.Action("Privacy", "Home")" class="text-primary">@Localizer["PrivacyPolicy"]</a>
                        </small>
                    </div>
                </div>
            </div>
            
            <div class="text-center mt-3">
                <a href="/" class="text-muted">
                    <i class="fas fa-arrow-left"></i> @Localizer["BackToGenerator"]
                </a>
            </div>
        </div>
    </div>
</div>

@section Scripts {
    <script>
        // Track login attempts
        document.querySelectorAll('[href*="Login"]').forEach(link => {
            link.addEventListener('click', () => {
                if (typeof gtag !== 'undefined') {
                    gtag('event', 'login_attempt', {
                        'event_category': 'Authentication',
                        'method': link.textContent.includes('Google') ? 'google' : 'microsoft'
                    });
                }
            });
        });
    </script>
}