@extends('layouts.guest')

@section('title', 'Register Free — Swagvio')

@section('header-right')
    Already registered? <a href="{{ route('login') }}">Sign In</a>
@endsection

@section('content')
<div class="auth-card">
    <div class="auth-title">Create your account</div>
    <div class="auth-subtitle">It's free — join thousands of users in India</div>

    @if($errors->any())
        <div class="alert alert-error"><i class="fi fi-rr-triangle-warning"></i> {{ $errors->first() }}</div>
    @endif

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

        <div class="form-row">
            <div class="form-group">
                <label class="form-label">Name</label>
                <input type="text" name="name" id="name" class="form-control {{ $errors->has('name') ? 'is-invalid' : '' }}"
                    placeholder="Your name" value="{{ old('name') }}" required>
                @error('name')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="form-group">
                <label class="form-label">Phone</label>
                <input type="tel" name="phone" id="phone" class="form-control {{ $errors->has('phone') ? 'is-invalid' : '' }}"
                    placeholder="+91 98765…" value="{{ old('phone') }}">
                @error('phone')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
        </div>

        <div class="form-group">
            <label class="form-label">Email</label>
            <input type="email" name="email" id="email" class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}"
                placeholder="you@example.com" value="{{ old('email') }}" required>
            @error('email')<div class="invalid-feedback">{{ $message }}</div>@enderror
        </div>

        <div class="form-group">
            <label class="form-label">City</label>
            <select name="city" id="city" class="form-control">
                <option value="">Select your city…</option>
                @foreach(['Mumbai','Delhi','Bangalore','Hyderabad','Pune','Chennai','Kolkata','Jaipur','Ahmedabad','Goa'] as $city)
                    <option value="{{ $city }}" {{ old('city') == $city ? 'selected' : '' }}>{{ $city }}</option>
                @endforeach
            </select>
        </div>

        <div class="form-row">
            <div class="form-group">
                <label class="form-label">Password</label>
                <input type="password" name="password" id="password" class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
                    placeholder="Min. 8 characters" required>
                @error('password')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="form-group">
                <label class="form-label">Confirm Password</label>
                <input type="password" name="password_confirmation" id="password_confirmation"
                    class="form-control" placeholder="Repeat password" required>
            </div>
        </div>

        <label class="age-check">
            <input type="checkbox" name="age_confirm" required>
            <span>I confirm I am <strong>18 years or older</strong> and agree to <a href="#">Terms of Service</a> and <a href="#">Privacy Policy</a>. I understand this platform contains adult content.</span>
        </label>

        <button type="submit" class="btn btn-pink">Create Account</button>
    </form>

    <div class="auth-switch">
        Already have an account? <a href="{{ route('login') }}">Sign In →</a>
    </div>

    <div class="terms-note">
        <i class="fi fi-rr-lock"></i> Your data is encrypted and never shared with third parties.
    </div>
</div>
@endsection
