<?php
    $brandLogo = asset('assets/brand/logo.png');
    $brandIcon = asset('assets/brand/favicon.png');
    $moduleLabels = [
        'bookings' => 'Reservas',
        'customers' => 'Clientes',
        'employees' => 'Empleados',
        'services' => 'Servicios',
        'schedules' => 'Horarios',
        'public_page' => 'Pagina publica',
        'reports' => 'Reportes',
        'promotions' => 'Promociones',
        'coupons' => 'Cupones',
        'gallery' => 'Galeria',
        'reminders' => 'Recordatorios',
        'notifications' => 'Notificaciones',
        'payments' => 'Pagos en linea',
        'invoicing' => 'Facturacion',
        'whatsapp' => 'WhatsApp',
        'pwa' => 'PWA',
        'branding' => 'Personalizacion visual',
        'clinical_history' => 'Historial clinico',
        'digital_consents' => 'Consentimientos',
        'client_files' => 'Archivos del cliente',
        'advanced_agenda' => 'Agenda avanzada',
        'cash_register' => 'Caja',
    ];
    $allFeatureKeys = array_keys($moduleLabels);
    $selectedPlan = $selectedPlan ?? null;
    $billingCycle = old('billing_cycle', 'monthly');

    $formatMoney = fn ($value) => '$'.number_format((float) $value, 0, ',', '.');
    $planAmount = function ($plan, string $cycle) {
        if ($cycle === 'yearly') {
            return (float) ($plan->effectivePriceYearly() ?: $plan->effectivePriceMonthly() * 12);
        }

        return (float) $plan->effectivePriceMonthly();
    };
?>

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Planes y suscripcion - AsignaPro</title>
    <meta name="description" content="Elige un plan de AsignaPro y activa tu plataforma de reservas en minutos.">
    <link rel="icon" type="image/png" href="<?php echo e(asset('favicon.png')); ?>">
    <style>
        *, *::before, *::after { box-sizing: border-box; }
        :root {
            --ink: #0f172a;
            --ink-soft: #1e293b;
            --muted: #64748b;
            --line: #dbe4ef;
            --panel: #ffffff;
            --bg: #edf4fa;
            --cyan: #22c7d9;
            --cyan-soft: #dffaff;
            --green: #159a62;
            --red: #f04455;
            --blue: #1267ff;
            --shadow: 0 28px 80px rgba(15, 23, 42, .12);
            --radius: 26px;
        }
        body {
            margin: 0;
            min-height: 100vh;
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            color: var(--ink);
            background:
                radial-gradient(circle at top left, rgba(34, 199, 217, .14), transparent 34%),
                linear-gradient(180deg, #eef7fc 0%, #f8fbff 100%);
        }
        a { color: inherit; text-decoration: none; }
        button, input, select, textarea { font: inherit; }
        .page {
            width: min(1420px, calc(100% - 32px));
            margin: 34px auto;
        }
        .shell {
            overflow: hidden;
            border: 1px solid rgba(15, 23, 42, .08);
            border-radius: var(--radius);
            background: var(--panel);
            box-shadow: var(--shadow);
        }
        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            padding: 20px 24px;
            background: linear-gradient(135deg, #071226, #15233c);
            color: white;
        }
        .brand {
            display: flex;
            align-items: center;
            gap: 16px;
        }
        .brand-mark {
            display: grid;
            place-items: center;
            width: 54px;
            height: 54px;
            border-radius: 16px;
            background: rgba(255,255,255,.1);
            border: 1px solid rgba(255,255,255,.18);
            box-shadow: inset 0 0 0 3px rgba(255,255,255,.08);
        }
        .brand-mark img { width: 34px; height: 34px; object-fit: contain; }
        .brand img.logo { width: 180px; max-width: 40vw; height: auto; filter: brightness(0) invert(1); }
        .brand-title { font-size: 24px; font-weight: 900; letter-spacing: -.03em; }
        .brand-subtitle { margin-top: 2px; color: rgba(255,255,255,.65); font-size: 15px; }
        .login-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-height: 46px;
            padding: 0 20px;
            border: 1px solid rgba(255,255,255,.22);
            border-radius: 999px;
            color: white;
            font-weight: 800;
            background: rgba(255,255,255,.08);
        }
        .content { padding: 40px 36px 42px; }
        .section-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 24px;
            margin-bottom: 28px;
        }
        .eyebrow {
            margin: 0 0 8px;
            color: var(--blue);
            font-size: 12px;
            font-weight: 900;
            letter-spacing: .18em;
            text-transform: uppercase;
        }
        h1, h2, h3, p { margin: 0; }
        h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.04; letter-spacing: -.05em; }
        h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.08; letter-spacing: -.04em; }
        .lead { margin-top: 10px; color: var(--muted); font-size: 20px; line-height: 1.45; }
        .plans-grid {
            display: grid;
            grid-template-columns: repeat(<?php echo e(max(1, min(3, $plans->count()))); ?>, minmax(0, 1fr));
            gap: 30px;
            align-items: stretch;
        }
        .plan-card {
            position: relative;
            display: flex;
            min-height: 630px;
            flex-direction: column;
            border: 1.5px solid var(--line);
            border-radius: 22px;
            background: #fff;
            padding: 30px;
            box-shadow: 0 16px 44px rgba(15, 23, 42, .05);
        }
        .plan-card.recommended {
            border-color: var(--ink);
            box-shadow: 0 20px 60px rgba(15, 23, 42, .12);
        }
        .recommended-ribbon {
            position: absolute;
            inset: 0 0 auto;
            display: grid;
            height: 44px;
            place-items: center;
            border-radius: 20px 20px 0 0;
            background: var(--ink);
            color: #fff;
            font-size: 15px;
            font-weight: 900;
        }
        .plan-card.recommended .plan-body { padding-top: 52px; }
        .plan-body { display: flex; flex: 1; flex-direction: column; }
        .plan-name { font-size: 26px; font-weight: 950; letter-spacing: -.04em; }
        .plan-desc { margin-top: 8px; min-height: 50px; color: #4b5563; font-size: 17px; line-height: 1.4; }
        .promo-pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            margin: 18px 0 10px;
            padding: 8px 14px;
            border: 1px solid #7ee7f2;
            border-radius: 999px;
            background: var(--cyan-soft);
            font-size: 14px;
            font-weight: 900;
        }
        .price-box { margin: 28px 0; }
        .old-price {
            color: #6b7280;
            font-size: 17px;
            text-decoration: line-through;
        }
        .discount {
            margin-left: 8px;
            padding: 4px 10px;
            border-radius: 999px;
            background: var(--cyan-soft);
            font-size: 14px;
            font-weight: 950;
        }
        .price-main {
            display: flex;
            align-items: baseline;
            gap: 7px;
            margin-top: 4px;
            font-size: 31px;
            font-weight: 950;
            letter-spacing: -.04em;
        }
        .price-main span { color: var(--cyan); font-size: 15px; letter-spacing: 0; }
        .price-note { margin-top: 4px; color: var(--muted); font-size: 15px; }
        .save-pill {
            display: inline-flex;
            margin-top: 12px;
            padding: 6px 12px;
            border: 1px solid #7ee7f2;
            border-radius: 999px;
            color: var(--ink);
            background: #ecfeff;
            font-weight: 900;
        }
        .cta {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            min-height: 58px;
            border-radius: 13px;
            border: 0;
            background: var(--ink);
            color: white;
            font-size: 17px;
            font-weight: 950;
            cursor: pointer;
            box-shadow: 0 16px 34px rgba(15, 23, 42, .16);
        }
        .cta.cyan { background: linear-gradient(135deg, #22c7d9, #15b8cc); color: #00101f; }
        .divider { height: 1px; margin: 18px 0 12px; background: var(--line); }
        .features { display: grid; gap: 10px; margin-top: 4px; padding: 0; list-style: none; }
        .features li {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            color: #334155;
            font-size: 16px;
            line-height: 1.28;
        }
        .check, .x {
            display: inline-grid;
            flex: 0 0 19px;
            width: 19px;
            height: 19px;
            place-items: center;
            border-radius: 999px;
            border: 1.5px solid currentColor;
            font-size: 12px;
            font-weight: 950;
            line-height: 1;
        }
        .check { color: var(--green); }
        .x { color: var(--red); }
        .checkout-grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 390px;
            gap: 38px;
            align-items: start;
            max-width: 980px;
            margin: 0 auto;
        }
        .back {
            display: inline-flex;
            align-items: center;
            min-height: 52px;
            padding: 0 22px;
            border: 1.5px solid #cbd7e6;
            border-radius: 14px;
            color: #475569;
            font-weight: 900;
            background: #fff;
        }
        .form-card, .summary-card {
            border: 1.5px solid var(--line);
            border-radius: 22px;
            background: #fff;
            box-shadow: 0 16px 44px rgba(15, 23, 42, .05);
        }
        .form-card { padding: 0; border: 0; box-shadow: none; }
        .form-section { margin-top: 28px; }
        .section-title {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 18px;
            font-size: 18px;
            font-weight: 950;
        }
        .section-title .icon {
            display: grid;
            width: 30px;
            height: 30px;
            place-items: center;
            border-radius: 10px;
            background: var(--cyan-soft);
            color: #0c91a5;
        }
        .field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
        .field { display: grid; gap: 8px; }
        .field.full { grid-column: 1 / -1; }
        label {
            color: #64748b;
            font-size: 13px;
            font-weight: 950;
            letter-spacing: .06em;
            text-transform: uppercase;
        }
        input, select {
            width: 100%;
            height: 54px;
            border: 1.5px solid #d7e2ef;
            border-radius: 13px;
            outline: none;
            padding: 0 15px;
            color: var(--ink);
            background: #fff;
            font-size: 16px;
        }
        input:focus, select:focus {
            border-color: var(--cyan);
            box-shadow: 0 0 0 4px rgba(34,199,217,.13);
        }
        .error {
            margin-top: 6px;
            color: #e11d48;
            font-size: 12px;
            font-weight: 800;
        }
        .terms {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin: 28px 0 22px;
            color: #334155;
            font-size: 17px;
        }
        .terms input {
            width: 22px;
            height: 22px;
            margin-top: 2px;
            accent-color: var(--cyan);
        }
        .summary-card {
            position: sticky;
            top: 24px;
            padding: 24px;
        }
        .badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 28px;
            padding: 0 12px;
            border-radius: 999px;
            background: var(--blue);
            color: #fff;
            font-size: 13px;
            font-weight: 950;
        }
        .summary-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            padding: 7px 0;
            color: #334155;
            font-size: 16px;
        }
        .summary-row strong { color: var(--ink); }
        .summary-total {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            margin-top: 12px;
            padding-top: 16px;
            border-top: 1px solid var(--line);
            font-size: 20px;
            font-weight: 950;
        }
        .summary-total span:last-child { color: var(--blue); }
        .summary-features { margin-top: 20px; }
        .flash {
            margin-bottom: 20px;
            border-radius: 16px;
            border: 1px solid #fecdd3;
            background: #fff1f2;
            padding: 14px 16px;
            color: #be123c;
            font-size: 14px;
            font-weight: 800;
        }
        @media (max-width: 1100px) {
            .plans-grid { grid-template-columns: 1fr; }
            .plan-card { min-height: auto; }
            .checkout-grid { grid-template-columns: 1fr; }
            .summary-card { position: static; }
        }
        @media (max-width: 720px) {
            .page { width: min(100% - 16px, 720px); margin: 8px auto; }
            .topbar { align-items: flex-start; flex-direction: column; border-radius: 0; }
            .content { padding: 26px 18px 30px; }
            .section-head { flex-direction: column; }
            .field-grid { grid-template-columns: 1fr; }
            .brand img.logo { width: 150px; max-width: 70vw; }
            .login-link { width: 100%; }
        }
    </style>
</head>
<body>
    <main class="page">
        <section class="shell">
            <header class="topbar">
                <a href="<?php echo e(route('pricing')); ?>" class="brand">
                    <span class="brand-mark"><img src="<?php echo e($brandIcon); ?>" alt="AsignaPro"></span>
                    <span>
                        <img src="<?php echo e($brandLogo); ?>" class="logo" alt="AsignaPro">
                        <span class="brand-subtitle"><?php echo e($selectedPlan ? 'Checkout de suscripcion' : 'Elige el plan para tu empresa y activalo en minutos'); ?></span>
                    </span>
                </a>
                <a href="<?php echo e(route('login')); ?>" class="login-link">Ya tengo cuenta</a>
            </header>

            <div class="content">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($errors->any()): ?>
                    <div class="flash">
                        Revisa los campos marcados. Hay informacion pendiente o incorrecta.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! $selectedPlan): ?>
                    <div class="section-head">
                        <div>
                            <p class="eyebrow">Planes disponibles</p>
                            <h1>Adquiere AsignaPro</h1>
                            <p class="lead">Pago seguro en linea, activacion automatica y modulos administrables por plan.</p>
                        </div>
                        <a href="<?php echo e(route('login')); ?>" class="back">Ya tengo cuenta</a>
                    </div>

                    <div class="plans-grid">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <?php
                                $enabledModules = $plan->modules->where('pivot.is_enabled', true)->pluck('key')->all();
                                $monthly = $plan->effectivePriceMonthly();
                                $yearly = $plan->effectivePriceYearly();
                                $yearlyMonthly = $yearly ? $yearly / 12 : null;
                                $annualSavings = $yearly ? max(0, ($monthly * 12) - $yearly) : 0;
                                $limits = [
                                    ($plan->max_employees ? number_format($plan->max_employees, 0, ',', '.') : 'Ilimitados').' empleados',
                                    ($plan->max_customers ? number_format($plan->max_customers, 0, ',', '.') : 'Ilimitados').' clientes',
                                    ($plan->max_services ? number_format($plan->max_services, 0, ',', '.') : 'Ilimitados').' servicios',
                                    ($plan->max_bookings_month ? number_format($plan->max_bookings_month, 0, ',', '.') : 'Reservas ilimitadas').' reservas/mes',
                                ];
                            ?>
                            <article class="plan-card <?php echo e($plan->is_featured ? 'recommended' : ''); ?>">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($plan->is_featured): ?>
                                    <div class="recommended-ribbon">Recomendado</div>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                <div class="plan-body">
                                    <h2 class="plan-name"><?php echo e($plan->name); ?></h2>
                                    <p class="plan-desc"><?php echo e($plan->description ?: 'Plan flexible para negocios que quieren ordenar su agenda y crecer.'); ?></p>

                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($yearly && $annualSavings > 0): ?>
                                        <div class="promo-pill">✦ 12 meses con ahorro anual</div>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                    <div class="price-box">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($yearlyMonthly && $yearlyMonthly < $monthly): ?>
                                            <div>
                                                <span class="old-price"><?php echo e($formatMoney($monthly)); ?></span>
                                                <span class="discount"><?php echo e(round((1 - ($yearly / max(1, $monthly * 12))) * 100)); ?>% OFF</span>
                                            </div>
                                            <div class="price-main"><?php echo e($formatMoney($yearlyMonthly)); ?> <span>/mes*</span></div>
                                            <p class="price-note"><?php echo e($formatMoney($yearly)); ?> por 12 meses</p>
                                            <span class="save-pill">Ahorra <?php echo e($formatMoney($annualSavings)); ?></span>
                                        <?php else: ?>
                                            <div class="price-main"><?php echo e($formatMoney($monthly)); ?> <span>/mes</span></div>
                                            <p class="price-note">Facturacion mensual sin promocion</p>
                                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </div>

                                    <a href="<?php echo e(route('pricing', ['plan' => $plan->slug])); ?>" class="cta <?php echo e($plan->is_featured ? 'cyan' : ''); ?>">Contratar ahora</a>

                                    <div class="divider"></div>
                                    <ul class="features">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $limits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $limit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <li><span class="check">✓</span><?php echo e($limit); ?></li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = array_slice($allFeatureKeys, 0, 10); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php $included = in_array($key, $enabledModules, true); ?>
                                            <li>
                                                <span class="<?php echo e($included ? 'check' : 'x'); ?>"><?php echo e($included ? '✓' : '×'); ?></span>
                                                <?php echo e($moduleLabels[$key]); ?>

                                            </li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </ul>
                                </div>
                            </article>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <article class="plan-card">
                                <div class="plan-body">
                                    <h2 class="plan-name">Sin planes publicos</h2>
                                    <p class="plan-desc">Activa planes desde el super administrador para mostrarlos aqui.</p>
                                </div>
                            </article>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                <?php else: ?>
                    <?php
                        $enabledModules = $selectedPlan->modules->where('pivot.is_enabled', true)->pluck('key')->all();
                        $checkoutAmount = $planAmount($selectedPlan, $billingCycle);
                        $monthly = $selectedPlan->effectivePriceMonthly();
                        $yearly = $selectedPlan->effectivePriceYearly();
                        $yearlySavings = $yearly ? max(0, ($monthly * 12) - $yearly) : 0;
                        $summaryFeatures = [
                            ($selectedPlan->max_employees ? number_format($selectedPlan->max_employees, 0, ',', '.') : 'Ilimitados').' empleados',
                            ($selectedPlan->max_customers ? number_format($selectedPlan->max_customers, 0, ',', '.') : 'Ilimitados').' clientes',
                            ($selectedPlan->max_services ? number_format($selectedPlan->max_services, 0, ',', '.') : 'Ilimitados').' servicios',
                            ($selectedPlan->max_bookings_month ? number_format($selectedPlan->max_bookings_month, 0, ',', '.') : 'Reservas ilimitadas').' reservas/mes',
                        ];
                    ?>

                    <form method="POST" action="<?php echo e(route('pricing.checkout')); ?>">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="plan_id" value="<?php echo e($selectedPlan->id); ?>">

                        <div class="checkout-grid">
                            <section class="form-card">
                                <a href="<?php echo e(route('pricing')); ?>" class="back">← Volver a planes</a>

                                <div class="form-section">
                                    <div class="section-title"><span class="icon">▦</span>Datos de la empresa</div>
                                    <div class="field-grid">
                                        <div class="field full">
                                            <label>Nombre *</label>
                                            <input name="company_name" value="<?php echo e(old('company_name')); ?>" required autocomplete="organization">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Telefono</label>
                                            <input name="company_phone" value="<?php echo e(old('company_phone')); ?>" autocomplete="tel" placeholder="+57 300 000 0000">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Email</label>
                                            <input type="email" name="company_email" value="<?php echo e(old('company_email')); ?>" required autocomplete="email">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field full">
                                            <label>Direccion</label>
                                            <input name="company_address" value="<?php echo e(old('company_address')); ?>" autocomplete="street-address">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_address'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Pais *</label>
                                            <select name="company_country" required>
                                                <option value="Colombia" <?php if(old('company_country', 'Colombia') === 'Colombia'): echo 'selected'; endif; ?>>Colombia</option>
                                                <option value="Estados Unidos" <?php if(old('company_country') === 'Estados Unidos'): echo 'selected'; endif; ?>>Estados Unidos</option>
                                                <option value="Mexico" <?php if(old('company_country') === 'Mexico'): echo 'selected'; endif; ?>>Mexico</option>
                                                <option value="Otro" <?php if(old('company_country') === 'Otro'): echo 'selected'; endif; ?>>Otro</option>
                                            </select>
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_country'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Ciudad *</label>
                                            <input name="company_city" value="<?php echo e(old('company_city')); ?>" required autocomplete="address-level2">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['company_city'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-section">
                                    <div class="section-title"><span class="icon">▣</span>Administrador principal</div>
                                    <div class="field-grid">
                                        <div class="field">
                                            <label>Nombre *</label>
                                            <input name="admin_first_name" value="<?php echo e(old('admin_first_name')); ?>" required autocomplete="given-name">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['admin_first_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Apellido *</label>
                                            <input name="admin_last_name" value="<?php echo e(old('admin_last_name')); ?>" required autocomplete="family-name">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['admin_last_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field full">
                                            <label>Email de acceso *</label>
                                            <input type="email" name="admin_email" value="<?php echo e(old('admin_email')); ?>" required autocomplete="username">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['admin_email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Contrasena *</label>
                                            <input type="password" name="password" required autocomplete="new-password">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                        <div class="field">
                                            <label>Confirmar contrasena *</label>
                                            <input type="password" name="password_confirmation" required autocomplete="new-password">
                                        </div>
                                    </div>
                                </div>

                                <div class="form-section">
                                    <div class="section-title"><span class="icon">▤</span>Periodo de pago</div>
                                    <div class="field-grid">
                                        <div class="field">
                                            <label>Meses a pagar *</label>
                                            <select name="billing_cycle">
                                                <option value="monthly" <?php if($billingCycle === 'monthly'): echo 'selected'; endif; ?>>1 mes</option>
                                                <option value="yearly" <?php if($billingCycle === 'yearly'): echo 'selected'; endif; ?> <?php if(! $yearly): echo 'disabled'; endif; ?>>12 meses<?php echo e($yearlySavings > 0 ? ' - ahorro' : ''); ?></option>
                                            </select>
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['billing_cycle'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </div>
                                    </div>
                                </div>

                                <label class="terms">
                                    <input type="checkbox" name="terms" value="1" <?php if(old('terms')): echo 'checked'; endif; ?> required>
                                    <span>Acepto terminos y autorizo el cobro del plan seleccionado.</span>
                                </label>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['terms'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                <button class="cta" type="submit">▣ Continuar al pago seguro (<?php echo e($formatMoney($checkoutAmount)); ?>)</button>
                            </section>

                            <aside class="summary-card">
                                <span class="badge"><?php echo e($selectedPlan->name); ?></span>
                                <h2 style="margin-top:26px;font-size:24px;">Resumen de compra</h2>

                                <div style="margin-top:18px;">
                                    <div class="summary-row"><span>Plan</span><strong><?php echo e($selectedPlan->name); ?></strong></div>
                                    <div class="summary-row"><span>Precio mensual</span><strong><?php echo e($formatMoney($monthly)); ?></strong></div>
                                    <div class="summary-row"><span>Meses seleccionados</span><strong><?php echo e($billingCycle === 'yearly' ? '12 meses' : '1 mes'); ?></strong></div>
                                    <div class="summary-row"><span>Subtotal</span><strong><?php echo e($formatMoney($checkoutAmount)); ?></strong></div>
                                    <div class="summary-row"><span>Descuento</span><strong style="color:var(--green);">- <?php echo e($formatMoney($billingCycle === 'yearly' ? $yearlySavings : 0)); ?></strong></div>
                                </div>

                                <div class="summary-total">
                                    <span>Total a pagar hoy</span>
                                    <span><?php echo e($formatMoney($checkoutAmount)); ?></span>
                                </div>

                                <div class="summary-features">
                                    <p style="margin-bottom:10px;color:#64748b;">Incluye:</p>
                                    <ul class="features">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $summaryFeatures; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <li><span class="check">✓</span><?php echo e($feature); ?></li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = array_slice($allFeatureKeys, 0, 10); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php $included = in_array($key, $enabledModules, true); ?>
                                            <li>
                                                <span class="<?php echo e($included ? 'check' : 'x'); ?>"><?php echo e($included ? '✓' : '×'); ?></span>
                                                <?php echo e($moduleLabels[$key]); ?>

                                            </li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </ul>
                                </div>
                            </aside>
                        </div>
                    </form>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </section>
    </main>
</body>
</html>
<?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/CitasSoft/resources/views/public/pricing.blade.php ENDPATH**/ ?>