@extends('layouts.app')

@section('title', 'Submission Status')

@section('content')
<!-- Page Header -->
<section class="bg-gradient-to-r from-primary-600 to-primary-700 py-16">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <h1 class="text-3xl md:text-4xl font-bold text-white">Submission Status</h1>
        <p class="text-primary-100 mt-2">Your submission details</p>
    </div>
</section>

<section class="py-12">
    <div class="max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="bg-white rounded-xl shadow-sm p-6 lg:p-8">
            <!-- Status Badge -->
            <div class="text-center mb-8">
                @php
                    $statusColors = [
                        'submitted' => 'bg-yellow-100 text-yellow-800',
                        'under_review' => 'bg-blue-100 text-blue-800',
                        'revision' => 'bg-orange-100 text-orange-800',
                        'accepted' => 'bg-green-100 text-green-800',
                        'rejected' => 'bg-red-100 text-red-800',
                    ];
                    $statusLabels = [
                        'submitted' => 'Submitted',
                        'under_review' => 'Under Review',
                        'revision' => 'Revision Required',
                        'accepted' => 'Accepted',
                        'rejected' => 'Rejected',
                    ];
                @endphp
                <span class="inline-block px-4 py-2 rounded-full text-lg font-semibold {{ $statusColors[$submission->status] ?? 'bg-gray-100 text-gray-800' }}">
                    {{ $statusLabels[$submission->status] ?? ucfirst($submission->status) }}
                </span>
            </div>

            <!-- Submission Details -->
            <div class="space-y-4">
                <div class="grid grid-cols-2 gap-4 p-4 bg-gray-50 rounded-lg">
                    <div>
                        <p class="text-sm text-gray-500">Submission Code</p>
                        <p class="font-semibold text-gray-900">{{ $submission->submission_code }}</p>
                    </div>
                    <div>
                        <p class="text-sm text-gray-500">Type</p>
                        <p class="font-semibold text-gray-900">{{ ucfirst(str_replace('_', ' ', $submission->type)) }}</p>
                    </div>
                </div>

                <div class="p-4 bg-gray-50 rounded-lg">
                    <p class="text-sm text-gray-500">Paper Title</p>
                    <p class="font-semibold text-gray-900">{{ $submission->title }}</p>
                </div>

                <div class="grid grid-cols-2 gap-4 p-4 bg-gray-50 rounded-lg">
                    <div>
                        <p class="text-sm text-gray-500">Author</p>
                        <p class="font-semibold text-gray-900">{{ $submission->author_name }}</p>
                    </div>
                    <div>
                        <p class="text-sm text-gray-500">Institution</p>
                        <p class="font-semibold text-gray-900">{{ $submission->institution }}</p>
                    </div>
                </div>

                <div class="p-4 bg-gray-50 rounded-lg">
                    <p class="text-sm text-gray-500">Submitted At</p>
                    <p class="font-semibold text-gray-900">{{ $submission->created_at->format('F d, Y H:i') }}</p>
                </div>

                @if($submission->reviewer_notes)
                <div class="p-4 bg-blue-50 rounded-lg">
                    <p class="text-sm text-blue-600 font-medium">Reviewer Notes</p>
                    <p class="text-gray-700 mt-1">{{ $submission->reviewer_notes }}</p>
                </div>
                @endif

                @if($submission->status === 'accepted' && $submission->registration_code)
                <div class="p-4 bg-green-50 rounded-lg">
                    <p class="text-sm text-green-600 font-medium">Registration Code</p>
                    <p class="text-2xl font-bold text-green-700">{{ $submission->registration_code }}</p>
                    <p class="text-sm text-green-600 mt-2">Use this code when registering for the conference.</p>
                </div>
                @endif
            </div>

            <!-- Actions -->
            <div class="mt-8 flex flex-col sm:flex-row gap-4">
                @if($submission->status === 'accepted' && !$submission->full_paper_file)
                <a href="{{ route('submission.full-paper') }}" class="flex-1 py-3 bg-primary-600 text-white text-center font-semibold rounded-lg hover:bg-primary-700 transition">
                    Submit Full Paper
                </a>
                @endif
                @if($submission->status === 'accepted' && $submission->registration_code)
                <a href="{{ route('registration.form') }}" class="flex-1 py-3 bg-green-600 text-white text-center font-semibold rounded-lg hover:bg-green-700 transition">
                    Register Now
                </a>
                @endif
                <a href="{{ route('submission.check') }}" class="flex-1 py-3 border border-gray-300 text-gray-700 text-center font-semibold rounded-lg hover:bg-gray-50 transition">
                    Check Another
                </a>
            </div>
        </div>
    </div>
</section>
@endsection
