<!doctype html>
<html lang="es">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?= e($title ?? config('app.name')) ?></title>
    <link rel="icon" type="image/png" href="<?= e(asset('img/veltrix-favicon.png')) ?>">
    <link rel="apple-touch-icon" href="<?= e(asset('img/veltrix-favicon.png')) ?>">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<?= e(asset('css/app.css')) ?>">
</head>
<body class="vx-auth-body">
<?php
$errorFlash = trim((string) (flash('error') ?? ''));
$successFlash = trim((string) (flash('success') ?? ''));
$guestColumnClass = trim((string) ($guest_column_class ?? 'col-lg-5'));
$guestContainerClass = trim((string) ($guest_container_class ?? ''));
$guestBrandLogo = trim((string) ($guest_brand_logo ?? ''));
$guestBrandAlt = trim((string) ($guest_brand_alt ?? config('app.name')));
$guestBrandTitle = trim((string) ($guest_brand_title ?? config('app.name')));
$guestBrandSubtitle = trim((string) ($guest_brand_subtitle ?? 'Panel de control para ventas, caja e inventario'));
$flashPayload = [
    'error' => $errorFlash,
    'success' => $successFlash,
];

$containerClasses = ['container', 'py-5'];
if ($guestContainerClass !== '') {
    $containerClasses[] = $guestContainerClass;
}
?>
<div class="vx-auth-shape vx-auth-shape-1"></div>
<div class="vx-auth-shape vx-auth-shape-2"></div>
<div class="<?= e(implode(' ', $containerClasses)) ?>">
    <div class="row justify-content-center align-items-center min-vh-100">
        <div class="<?= e($guestColumnClass) ?>">
            <div class="text-center mb-4 text-white vx-auth-brand">
                <?php if ($guestBrandLogo !== ''): ?>
                    <img src="<?= e($guestBrandLogo) ?>" alt="<?= e($guestBrandAlt) ?>" class="vx-auth-brand-logo">
                <?php elseif ($guestBrandTitle !== ''): ?>
                    <h1 class="h2 mb-2"><?= e($guestBrandTitle) ?></h1>
                <?php endif; ?>
                <?php if ($guestBrandSubtitle !== ''): ?>
                    <p class="mb-0 opacity-75"><?= e($guestBrandSubtitle) ?></p>
                <?php endif; ?>
            </div>
            <?= $content ?? '' ?>
        </div>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
    window.__veltrixFlash = <?= json_encode($flashPayload, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE) ?>;

    window.addEventListener('DOMContentLoaded', () => {
        const flash = window.__veltrixFlash || {};
        if (typeof window.Swal === 'undefined') {
            return;
        }

        if (typeof flash.error === 'string' && flash.error.trim() !== '') {
            window.Swal.fire({
                icon: 'error',
                title: 'Error',
                text: flash.error,
                confirmButtonText: 'Entendido',
            });
            return;
        }

        if (typeof flash.success === 'string' && flash.success.trim() !== '') {
            window.Swal.fire({
                icon: 'success',
                title: 'Listo',
                text: flash.success,
                confirmButtonText: 'Continuar',
            });
        }
    });
</script>
</body>
</html>
