@extends('layouts.app')

@section('title', 'Registration Successful')

@section('content')
<div class="container mt-5 mb-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card border-success shadow-lg">
                <div class="card-header bg-success text-white">
                    <h4 class="mb-0">
                        <i class="fas fa-check-circle"></i> Registration Successful
                    </h4>
                </div>

                <div class="card-body text-center p-5">
                    <div class="mb-4">
                        <i class="fas fa-certificate text-success" style="font-size: 4rem;"></i>
                    </div>
                    <h5 class="mb-3">You have successfully registered for the event!</h5>
                    <p class="text-muted mb-4">
                        Your registration has been confirmed. A confirmation email will be sent shortly.
                    </p>

                    @if($registration)
                        <div class="alert alert-light" role="alert">
                            <h6 class="alert-heading mb-3">Your Registration Details</h6>
                            <div class="row text-start small">
                                <div class="col-md-6 mb-3">
                                    <strong>Registration ID:</strong><br>
                                    <code class="text-primary fs-6">{{ $registration->reg_id }}</code>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Status:</strong><br>
                                    <span class="badge bg-success fs-6">{{ ucfirst($registration->status) }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Student Name:</strong><br>
                                    <span class="fs-6">{{ $registration->name }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Parent Name:</strong><br>
                                    <span class="fs-6">{{ $registration->parent }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Email:</strong><br>
                                    <span class="fs-6">{{ $registration->email }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Phone:</strong><br>
                                    <span class="fs-6">{{ $registration->phone }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Event:</strong><br>
                                    <span class="fs-6">{{ $registration->event->Name }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Fee:</strong><br>
                                    <strong class="text-success fs-6">
                                        @if($registration->amount == 0)
                                            FREE
                                        @else
                                            ₹{{ number_format($registration->amount, 2) }}
                                        @endif
                                    </strong>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Payment Mode:</strong><br>
                                    <span class="badge bg-info fs-6">{{ $registration->paymentmode }}</span>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <strong>Registration Date:</strong><br>
                                    <span class="fs-6">{{ $registration->datecreated->format('d M Y H:i:s') }}</span>
                                </div>
                                @if($registration->datepaid)
                                    <div class="col-md-6 mb-3">
                                        <strong>Payment Date:</strong><br>
                                        <span class="fs-6">{{ $registration->datepaid->format('d M Y H:i:s') }}</span>
                                    </div>
                                @endif
                            </div>
                        </div>

                        <div class="alert alert-info" role="alert">
                            <i class="fas fa-envelope"></i>
                            A confirmation email has been sent to <strong>{{ $registration->email }}</strong>.<br>
                            <small>Please check your inbox and spam folder if you don't see it.</small>
                        </div>
                    @endif

                    <h6 class="mt-4 mb-3">What's Next?</h6>
                    <ul class="text-start small text-muted mb-4">
                        <li>Check your email for confirmation and event details</li>
                        <li>Save your Registration ID: <code>{{ $registration->reg_id }}</code></li>
                        <li>Note the event date: <strong>{{ $registration->event->EventDate->format('d M Y') }}</strong></li>
                        <li>Prepare and attend the event on the scheduled date</li>
                    </ul>
                </div>

                <div class="card-footer bg-light">
                    <div class="d-grid gap-2">
                        <a href="{{ route('registration.create') }}" class="btn btn-primary">
                            <i class="fas fa-plus-circle"></i> Register for Another Event
                        </a>
                        <a href="/" class="btn btn-outline-secondary">
                            <i class="fas fa-home"></i> Back to Home
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
