<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** PAYMENT RESULT — Expects: $paid, $ticket, $event. */
?>
<section class="page-hero" style="text-align:center;">
	<div class="container">
		<div class="page-hero-inner" data-reveal style="margin:0 auto;">
			<div style="width:80px;height:80px;border-radius:50%;margin:0 auto 22px;display:grid;place-items:center;background:<?= $paid ? '#25D366' : 'rgba(255,255,255,.12)' ?>;color:#fff;">
				<?= bloom_icon($paid ? 'check' : 'close', 40) ?>
			</div>
			<h1><?= $paid ? 'Payment Confirmed' : 'Payment Failed' ?></h1>
			<p><?= $paid
				? 'Your ticket has been confirmed and emailed to you.'
				: 'We could not confirm your payment. No charge was completed.' ?></p>
		</div>
	</div>
</section>

<section class="section">
	<div class="container" style="max-width:560px;">
		<div class="form-card text-center" data-reveal>
			<?php if ($paid): ?>
				<span class="eyebrow" style="justify-content:center;">Your Ticket</span>
				<div style="font-family:var(--font-display);font-size:2rem;font-weight:600;color:var(--plum);letter-spacing:3px;margin:16px 0;">
					<?= html_escape($ticket['ticket_code']) ?>
				</div>
				<div style="padding:20px;border-radius:var(--radius);background:var(--cream-deep);text-align:left;">
					<p><strong>Event:</strong> <?= html_escape($event['title']) ?></p>
					<p><strong>Date:</strong> <?= nice_date($event['event_date'], 'l, d M Y') ?></p>
					<p><strong>Location:</strong> <?= html_escape($event['location']) ?></p>
					<p><strong>Tickets:</strong> <?= (int) $ticket['quantity'] ?> · <strong>Paid:</strong> <?= money($ticket['amount']) ?></p>
				</div>
				<p style="color:var(--ink-soft);margin:18px 0;font-size:.92rem;">Present this code at the entrance. A copy has been sent to <?= html_escape($ticket['email']) ?>.</p>
				<a href="<?= base_url('events') ?>" class="btn btn-primary">Browse More Events</a>
			<?php else: ?>
				<p style="color:var(--ink-soft);margin-bottom:18px;">If you believe this is an error, please try again or contact us.</p>
				<div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap;">
					<a href="<?= base_url('events/view/'.$event['slug']) ?>" class="btn btn-primary">Try Again</a>
					<a href="<?= base_url('contact') ?>" class="btn btn-ghost">Contact Us</a>
				</div>
			<?php endif; ?>
		</div>
	</div>
</section>
