<?php $__env->startSection('title', ($event->seo_title ?: $event->title) . ' - ' . config('app.name')); ?>
<?php $__env->startSection('meta_description', $event->seo_description ?: ($event->excerpt ?: 'Event details')); ?>

<?php $__env->startPush('styles'); ?>
<style>
    .event-wrap { max-width: 1120px; margin: 0 auto; }
    .event-pill { border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
    .event-form-input { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
    .event-form-input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent); border-color: var(--brand-primary); }
    .event-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 24px; box-shadow: 0 12px 28px rgba(15,23,42,.07); }
    .event-section-title { font-size: 34px; line-height: 1.1; font-weight: 900; color: var(--brand-secondary); }
    .event-countdown { background: var(--page-head-gradient); color: #fff; border-radius: 16px; padding: 14px 18px; margin-bottom: 24px; }
    .event-countdown-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
    .event-countdown-label { font-weight: 700; }
    .event-countdown-grid { display: grid; grid-template-columns: repeat(4, minmax(68px, 1fr)); gap: 12px; text-align: center; }
    .event-countdown-value { font-size: 20px; line-height: 1; font-weight: 800; color: #fff; }
    .event-countdown-unit { font-size: 11px; font-weight: 600; color: #cbd5e1; margin-top: 4px; }
    @media (max-width: 992px) {
        .event-section-title { font-size: 30px; }
    }
    @media (max-width: 640px) {
        .event-countdown-grid { grid-template-columns: repeat(2, minmax(68px, 1fr)); width: 100%; }
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<section class="bg-gray-50 py-10 md:py-14">
    <div class="event-wrap px-4">
        <article class="event-card overflow-hidden">
            <?php if($event->cover_image): ?>
                <div class="h-56 md:h-72 bg-gray-100">
                    <img src="<?php echo e($event->cover_url); ?>" alt="<?php echo e($event->title); ?>" class="w-full h-full object-cover">
                </div>
            <?php endif; ?>

            <div class="p-5 md:p-8">
                <div class="event-countdown">
                    <div class="event-countdown-row">
                        <p class="event-countdown-label">Event Starts in:</p>
                        <div id="countdown" class="event-countdown-grid">
                            <div><p data-cd="days" class="event-countdown-value">00</p><p class="event-countdown-unit">Days</p></div>
                            <div><p data-cd="hours" class="event-countdown-value">00</p><p class="event-countdown-unit">Hours</p></div>
                            <div><p data-cd="minutes" class="event-countdown-value">00</p><p class="event-countdown-unit">Minutes</p></div>
                            <div><p data-cd="seconds" class="event-countdown-value">00</p><p class="event-countdown-unit">Seconds</p></div>
                        </div>
                    </div>
                </div>

                <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                    <div>
                        <p class="text-sm text-red-600 font-semibold mb-2 accent"><?php echo e($event->starts_at ? $event->starts_at->format('d M Y, h:i A') : 'Date coming soon'); ?></p>
                        <h1 class="event-section-title mb-4"><?php echo e($event->title); ?></h1>

                        <div class="text-gray-700 leading-relaxed whitespace-pre-line mb-5">
                            <?php echo e($event->content); ?>

                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-3 gap-3 mb-4">
                            <div class="event-pill p-3">
                                <p class="text-xs text-gray-400 uppercase">Date</p>
                                <p class="text-sm font-semibold text-gray-800"><?php echo e($event->starts_at ? $event->starts_at->format('d/m/Y') : '-'); ?></p>
                            </div>
                            <div class="event-pill p-3">
                                <p class="text-xs text-gray-400 uppercase">Time</p>
                                <p class="text-sm font-semibold text-gray-800"><?php echo e($event->starts_at ? $event->starts_at->format('h:i A') : '-'); ?></p>
                            </div>
                            <div class="event-pill p-3">
                                <p class="text-xs text-gray-400 uppercase">Venue</p>
                                <p class="text-sm font-semibold text-gray-800"><?php echo e($event->venue ?: '-'); ?></p>
                            </div>
                        </div>

                        <div class="text-sm text-gray-700">
                            <?php if($event->location): ?><p><strong>Location:</strong> <?php echo e($event->location); ?></p><?php endif; ?>
                            <?php if($event->excerpt): ?><p class="mt-2"><?php echo e($event->excerpt); ?></p><?php endif; ?>
                        </div>
                    </div>

                    <div>
                        <div class="bg-[#f7f7fb] border border-gray-200 rounded-2xl p-5">
                            <h2 class="text-2xl font-black text-gray-900 mb-4">Event Registration</h2>

                            <?php if(session('success')): ?>
                                <div class="mb-4 bg-green-50 border border-green-200 text-green-700 px-3 py-2 rounded-lg text-sm">
                                    <?php echo e(session('success')); ?>

                                </div>
                            <?php endif; ?>

                            <form method="POST" action="<?php echo e(route('events.register', $event->slug)); ?>" class="space-y-3">
                                <?php echo csrf_field(); ?>
                                <input type="text" name="full_name" value="<?php echo e(old('full_name')); ?>" required class="event-form-input <?php $__errorArgs = ['full_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> !border-red-400 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" placeholder="Full Name *">
                                <?php $__errorArgs = ['full_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-xs text-red-500"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                                <input type="email" name="email" value="<?php echo e(old('email')); ?>" required class="event-form-input <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> !border-red-400 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" placeholder="Email *">
                                <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-xs text-red-500"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                                <input type="tel" name="phone" value="<?php echo e(old('phone')); ?>" required data-phone-input autocomplete="tel" class="event-form-input <?php $__errorArgs = ['phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> !border-red-400 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" placeholder="Phone Number *">
                                <?php $__errorArgs = ['phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-xs text-red-500"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                                <select name="last_qualification" required class="event-form-input <?php $__errorArgs = ['last_qualification'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> !border-red-400 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                    <option value="">Last Academic Qualification *</option>
                                    <?php $__currentLoopData = ['SSC/O Level', 'HSC/A Level', 'Diploma', 'Bachelor', 'Masters/Professional']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($item); ?>" <?php echo e(old('last_qualification') === $item ? 'selected' : ''); ?>><?php echo e($item); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <?php $__errorArgs = ['last_qualification'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-xs text-red-500"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                                <input type="text" name="undergraduate_result" value="<?php echo e(old('undergraduate_result')); ?>" class="event-form-input" placeholder="Undergraduate Result (CGPA)">

                                <select name="ielts_status" class="event-form-input">
                                    <option value="">IELTS / PTE Status</option>
                                    <?php $__currentLoopData = ['Have Score', 'Booked Test Date', 'Planning To Take', 'Not Applicable']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($item); ?>" <?php echo e(old('ielts_status') === $item ? 'selected' : ''); ?>><?php echo e($item); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>

                                <input type="text" name="english_score" value="<?php echo e(old('english_score')); ?>" class="event-form-input" placeholder="Your English Proficiency Score">

                                <button type="submit" class="w-full bg-red-600 hover:bg-red-700 text-white font-semibold py-2.5 rounded-lg transition">
                                    Submit Registration
                                </button>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="mt-10">
                    <div class="text-center mb-4">
                        <h3 class="text-3xl font-black text-gray-900">Event Location</h3>
                        <p class="text-sm text-gray-500">Find us at this venue</p>
                    </div>
                    <?php $mapQuery = urlencode($event->location ?: ($event->venue ?: 'Dhaka')); ?>
                    <iframe
                        src="https://www.google.com/maps?q=<?php echo e($mapQuery); ?>&output=embed"
                        width="100%"
                        height="330"
                        style="border:0;border-radius:16px;"
                        loading="lazy"
                        referrerpolicy="no-referrer-when-downgrade">
                    </iframe>
                </div>
            </div>
        </article>
    </div>
</section>

<section class="py-14 bg-gray-50">
    <div class="event-wrap px-4">
        <div class="text-center mb-8">
            <h2 class="text-4xl font-black text-gray-900">Browse Other Events</h2>
        </div>
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            <?php $__currentLoopData = $otherEvents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <article class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden">
                    <a href="<?php echo e(route('events.show', $item->slug)); ?>">
                        <div class="h-44 bg-gray-100">
                            <?php if($item->cover_image): ?>
                                <img src="<?php echo e($item->cover_url); ?>" alt="<?php echo e($item->title); ?>" class="w-full h-full object-cover">
                            <?php endif; ?>
                        </div>
                    </a>
                    <div class="p-5">
                        <p class="text-xs text-red-600 font-semibold mb-2 accent"><?php echo e($item->starts_at ? $item->starts_at->format('d M Y, h:i A') : 'Date coming soon'); ?></p>
                        <h3 class="text-lg font-bold text-gray-900 mb-3"><?php echo e($item->title); ?></h3>
                        <a href="<?php echo e(route('events.show', $item->slug)); ?>" class="inline-flex items-center justify-center w-full border border-gray-300 rounded-full py-2.5 text-sm font-semibold text-gray-800 hover:bg-gray-50">View Details</a>
                    </div>
                </article>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
(() => {
    const startsAtRaw = <?php echo json_encode(optional($event->starts_at)->toIso8601String(), 15, 512) ?>;
    const cdRoot = document.getElementById('countdown');
    if (!cdRoot || !startsAtRaw) return;

    const target = new Date(startsAtRaw).getTime();
    const daysEl = cdRoot.querySelector('[data-cd="days"]');
    const hoursEl = cdRoot.querySelector('[data-cd="hours"]');
    const minsEl = cdRoot.querySelector('[data-cd="minutes"]');
    const secsEl = cdRoot.querySelector('[data-cd="seconds"]');

    function render() {
        const now = Date.now();
        let diff = Math.max(0, target - now);
        const d = Math.floor(diff / (1000 * 60 * 60 * 24));
        diff -= d * (1000 * 60 * 60 * 24);
        const h = Math.floor(diff / (1000 * 60 * 60));
        diff -= h * (1000 * 60 * 60);
        const m = Math.floor(diff / (1000 * 60));
        diff -= m * (1000 * 60);
        const s = Math.floor(diff / 1000);

        daysEl.textContent = String(d).padStart(2, '0');
        hoursEl.textContent = String(h).padStart(2, '0');
        minsEl.textContent = String(m).padStart(2, '0');
        secsEl.textContent = String(s).padStart(2, '0');
    }

    render();
    setInterval(render, 1000);
})();
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.public', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\gps-migration\resources\views\events\show.blade.php ENDPATH**/ ?>