@extends('layouts.app-mobile')
@section('title', 'Sign up — Befikreyy App')
@section('apptitle', 'Create account')
@section('appheaderright')
<a href="{{ route('app.splash') }}" class="ah-back" aria-label="Back">‹</a>
@endsection

@section('content')
<div class="auth-screen">
    <div class="auth-hero">
        <img src="/assets/brand/logo.png" alt="Befikreyy" class="auth-logo">
        <h2 class="auth-title">Join Befikreyy</h2>
        <p class="auth-sub">Book services as a customer, or earn as a partner — same account.</p>
    </div>

    <div class="auth-card">
        @if($errors->any())
            <div class="app-alert app-alert-error">
                <span class="ic">!</span>
                <span>{{ $errors->first() }}</span>
            </div>
        @endif

        <form method="POST" action="{{ route('app.register.attempt') }}" class="app-form">
            @csrf

            <div class="role-toggle-app">
                <input type="radio" name="role" id="r-cust" value="customer" checked>
                <label for="r-cust">
                    <span class="rt-ic">🛒</span>
                    <span class="rt-tx">I need a service</span>
                </label>
                <input type="radio" name="role" id="r-part" value="partner">
                <label for="r-part">
                    <span class="rt-ic">🔧</span>
                    <span class="rt-tx">I want to be a partner</span>
                </label>
            </div>

            <div class="field-app">
                <label>Full name</label>
                <input type="text" name="name" required value="{{ old('name') }}" placeholder="e.g. Ankit Sharma" autocomplete="name">
            </div>

            <div class="field-app">
                <label>Mobile number</label>
                <div class="phone-wrap">
                    <span class="phone-prefix">+91</span>
                    <input type="tel" name="phone" required value="{{ old('phone') }}" minlength="10" maxlength="15" pattern="[0-9]+" inputmode="numeric" placeholder="9876543210" autocomplete="tel">
                </div>
            </div>

            <div class="field-app">
                <label>Email <span class="optional">(optional)</span></label>
                <input type="email" name="email" value="{{ old('email') }}" placeholder="you@example.com" autocomplete="email">
            </div>

            <div class="field-app">
                <label>Password</label>
                <div class="pwd-wrap">
                    <input type="password" name="password" id="rpwd" required minlength="6" autocomplete="new-password" placeholder="At least 6 characters">
                    <button type="button" class="pwd-toggle" onclick="var i=document.getElementById('rpwd');i.type=i.type==='password'?'text':'password';this.textContent=i.type==='password'?'Show':'Hide'">Show</button>
                </div>
            </div>

            <div class="field-app">
                <label>Confirm password</label>
                <input type="password" name="password_confirmation" required minlength="6" autocomplete="new-password" placeholder="Repeat your password">
            </div>

            <label class="checkbox-app checkbox-app-block">
                <input type="checkbox" name="terms" required>
                <span>I agree to the <a href="{{ route('terms') }}" target="_blank">Terms</a> &amp; <a href="{{ route('privacy') }}" target="_blank">Privacy Policy</a></span>
            </label>

            <button type="submit" class="btn-app btn-app-primary btn-app-full">Create account</button>
        </form>

        <div class="auth-divider"><span>or</span></div>

        <a href="{{ route('app.login') }}" class="btn-app btn-app-outline btn-app-full">I already have an account</a>
    </div>
</div>
@endsection