@page "/auth/forgot-password-new"
@using WebClientTpos.Client.Components.Auth
@inherits AuthBase

@*
    EN: Forgot password page — centered card, email/phone input → sends reset link.
    VI: Trang quên mật khẩu — card giữa, input email/SĐT → gửi link đặt lại.
    Design: pencil-design/src/pages/tPOS/auth/forgot-password/desktop.pen
*@

<PageTitle>@L["Auth_Forgot_PageTitle"]</PageTitle>

<div class="auth-page">
    @if (!_resetSent)
    {
        <AuthCard Title="@L["Auth_Forgot_Title"]"
                  Subtitle="@L["Auth_Forgot_Subtitle"]"
                  Icon="key-round"
                  IconClass="auth-icon--orange"
                  BackLink="/auth/login/branch"
                  BackLinkText="@L["Auth_Forgot_BackLink"]"
                  Compact="true">
            <ChildContent>
                <div class="auth-form">
                    <AuthInput Label="@L["Auth_Forgot_InputLabel"]"
                               InputType="text"
                               Placeholder="@L["Auth_Forgot_InputPlaceholder"]"
                               PrefixIcon="mail"
                               InputId="forgot-email" />
                </div>
                
                <AuthButton Variant="orange" OnClick="HandleSubmit">
                    @L["Auth_Forgot_Submit"]
                </AuthButton>
            </ChildContent>
        </AuthCard>
    }
    else
    {
        <AuthCard Title="@L["Auth_Forgot_SentTitle"]"
                  Subtitle="@L["Auth_Forgot_SentSubtitle"]"
                  Icon="mail-check"
                  IconClass="auth-icon--success">
            <ChildContent>
                <span class="auth-highlight">user@example.com</span>
                
                <AuthButton Variant="orange" IconName="external-link">
                    @L["Auth_Forgot_OpenEmail"]
                </AuthButton>
                
                <AuthButton Variant="outline">
                    @L["Auth_Forgot_ResendEmail"]
                </AuthButton>
            </ChildContent>
            <FooterContent>
                <span class="auth-footer-text">
                    @L["Auth_Forgot_NotReceived"]
                </span>
                <span class="auth-footer-text">
                    @L["Auth_Forgot_CheckSpam"] <a href="/auth/forgot-password-new">@L["Auth_Forgot_TryAnother"]</a>
                </span>
            </FooterContent>
        </AuthCard>
    }
</div>

@code {
    private bool _resetSent = false;

    private void HandleSubmit()
    {
        _resetSent = true;
    }
}
