<?php

/**
 * Workspace — Created (Step 1.5/2 Confirmation Preview)
 */

/** @var array $workspace */
$commercialPlans = [
    1 => 'Starter',
    2 => 'Pro',
    3 => 'Custom'
];
$planName = $commercialPlans[(int) $workspace['commercial_plan_id']] ?? 'Unknown';
$limitText = ((int) $workspace['commercial_plan_id'] === 3) ? ($workspace['custom_guest_limit'] . ' (Custom)') : ($workspace['commercial_plan_id'] == 1 ? '150' : '500');

?>

<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">

    <!-- Step Wizard Progress Indicator -->
    <div class="mb-8">
        <div class="flex items-center justify-between">
            <h2 class="text-2xl font-bold leading-7 text-slate-900 sm:text-3xl tracking-tight">
                Workspace Configured
            </h2>
            <span class="text-xs font-bold text-slate-400">Step 2 of 5</span>
        </div>
        <div class="mt-4 bg-slate-200 h-1.5 rounded-full overflow-hidden">
            <div class="h-full rounded-full transition-all duration-300" style="background-color: var(--brand-charcoal); width: 40%;"></div>
        </div>
        <div class="flex justify-between text-[10px] font-bold text-slate-400 mt-2">
            <span class="text-slate-650">1. Basic Info</span>
            <span style="color: var(--brand-charcoal); font-weight: 800;">2. Preview Config</span>
            <span>3. Couple Owner</span>
            <span>4. Assign Crew</span>
            <span>5. Finish & Review</span>
        </div>
    </div>

    <!-- Main Content Card -->
    <div class="card p-0 overflow-hidden bg-white border border-slate-150 rounded-2xl shadow-sm">
        
        <div class="bg-slate-50 px-6 py-4 border-b border-slate-150">
            <h3 class="text-sm font-bold text-slate-800">2. Configured Settings</h3>
            <p class="text-xxs text-slate-450 mt-0.5">Please review the temporary configurations before creating the couple account.</p>
        </div>

        <div class="p-6 space-y-6">
            
            <div class="rounded-xl p-5 space-y-4" style="background-color: var(--brand-ivory-warm); border: 1px solid var(--brand-ivory-dark);">
                <div class="grid grid-cols-2 md:grid-cols-4 gap-4 text-xs">
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Groom Name</span>
                        <span class="text-slate-800 font-bold mt-1 block"><?= escape_html($workspace['groom_name']) ?></span>
                    </div>
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Bride Name</span>
                        <span class="text-slate-800 font-bold mt-1 block"><?= escape_html($workspace['bride_name']) ?></span>
                    </div>
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Event Date</span>
                        <span class="font-mono text-slate-800 font-bold mt-1 block"><?= escape_html($workspace['wedding_date']) ?></span>
                    </div>
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">URL Slug</span>
                        <span class="font-mono text-slate-800 font-bold mt-1 block">/i/<?= escape_html($workspace['slug']) ?></span>
                    </div>
                </div>

                <div class="pt-4 grid grid-cols-2 md:grid-cols-4 gap-4 text-xs" style="border-top: 1px solid var(--brand-ivory-dark);">
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Commercial Plan</span>
                        <span class="font-bold text-slate-800 mt-1 block"><?= escape_html($planName) ?></span>
                    </div>
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Guest Limit</span>
                        <span class="font-mono text-slate-800 font-bold mt-1 block"><?= escape_html($limitText) ?></span>
                    </div>
                    <div>
                        <span class="block text-[10px] text-slate-450 font-bold uppercase tracking-wider">Event Type ID</span>
                        <span class="font-bold text-slate-800 mt-1 block"><?= (int) $workspace['event_type_id'] === 1 ? 'Wedding (1)' : 'Engagement (2)' ?></span>
                    </div>
                </div>
            </div>

            <!-- Actions Footer -->
            <div class="flex items-center justify-end gap-3 pt-6 border-t border-slate-100">
                <a
                    href="<?= url('/app/admin/workspaces/create') ?>"
                    class="btn btn-secondary text-xs font-bold px-4 py-2 rounded-xl"
                >
                    Back to Edit
                </a>
                <a
                    href="<?= url('/app/admin/workspaces/create-owner') ?>"
                    class="btn btn-primary text-xs font-bold px-6 py-2.5 rounded-xl flex items-center gap-1"
                >
                    Create Couple Account <i class="fa-solid fa-arrow-right text-[10px]"></i>
                </a>
            </div>

        </div>

    </div>

</div>
