<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Gracias por su pedido</title>
	<style>
		body { margin:0; font-family:Segoe UI, sans-serif; background:#f6f8fb; color:#0f172a; }
		.wrap { max-width:900px; margin:0 auto; padding:32px 16px; }
		.card { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:24px; box-shadow:0 10px 25px rgba(15,23,42,.06); text-align:center; }
		.logo { width:min(280px, 82vw); height:auto; object-fit:contain; margin:0 auto 14px; display:block; }
		h1 { color:#0f766e; font-size:34px; margin:0 0 8px; }
		p { margin:0 0 10px; }
		.actions { margin-top:16px; display:flex; justify-content:center; gap:10px; flex-wrap:wrap; }
		.btn { display:inline-block; text-decoration:none; border:none; border-radius:10px; padding:11px 16px; font:inherit; font-weight:700; cursor:pointer; }
		.btn-primary { background:#d62828; color:#fff; }
		.btn-outline { background:#fff; border:1px solid #cbd5e1; color:#1e293b; }
		.meta { color:#64748b; font-size:14px; }
	</style>
</head>
<body>
	<?php
		$download_href = isset($download_url)
			? (string) $download_url
			: site_url('catalog/l/'.rawurlencode($link['token']).'/download/'.(int)$order['id']);
		$back_href = isset($back_url)
			? (string) $back_url
			: site_url('catalog/l/'.rawurlencode($link['token']));
	?>
	<div class="wrap">
		<div class="card">
			<?php if (!empty($logo_file_id)): ?>
				<img class="logo" src="<?php echo site_url('catalog/image/'.(int)$logo_file_id); ?>" alt="Logo Gala">
			<?php endif; ?>
			<h1>Gracias por su pedido</h1>
			<p><?php echo nl2br(html_escape($thanks_message)); ?></p>
			<p class="meta">Pedido #<?php echo (int) $order['id']; ?></p>
			<div class="actions">
				<a class="btn btn-primary" href="<?php echo html_escape($download_href); ?>">Descargar recibo</a>
				<a class="btn btn-outline" href="<?php echo html_escape($back_href); ?>">Volver al catalogo</a>
			</div>
		</div>
	</div>
</body>
</html>
