<!DOCTYPE html>
<html lang="en">
<?php
$pagetitle = "Book a Free Strategy Call | Nesvra";
$subjectParam  = isset($_GET['subject']) ? htmlspecialchars(trim($_GET['subject'])) : '';
$productParam  = isset($_GET['product']) ? htmlspecialchars(trim($_GET['product'])) : '';
$planParam     = isset($_GET['plan']) ? htmlspecialchars(trim($_GET['plan'])) : '';
$interestParam = isset($_GET['interest']) ? htmlspecialchars(trim($_GET['interest'])) : '';

// Derive active display title if preset
$focusTitle = $subjectParam ?: ($productParam ? ucwords(str_replace('-', ' ', $productParam)) : '');
if ($planParam) {
    $focusTitle .= ($focusTitle ? ' (' . ucfirst($planParam) . ' Plan)' : ucfirst($planParam) . ' Plan');
}

include 'components/head.php';
?>
<body class="bg-[#F8F9FA]">
<?php include 'components/navbar.php'; ?>

<section class="min-h-screen w-full">
    <div class="max-w-[1240px] mx-auto px-4 md:px-[5%] py-12 md:py-20">

        <!-- Page heading -->
        <div class="mb-8" data-aos="fade-up">
            <a href="index.php" class="inline-flex items-center gap-2 font-mono text-[10px] uppercase tracking-widest text-soft hover:text-royal transition-colors mb-4 group">
                <i class="ri-arrow-left-line group-hover:-translate-x-1 transition-transform"></i> Back to Nesvra
            </a>

            <div class="flex flex-wrap items-center gap-2.5 mb-3">
                <span class="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-brandOrange/10 text-brandOrange font-mono text-[11px] font-semibold uppercase tracking-wider">
                    <span class="w-1.5 h-1.5 rounded-full bg-brandOrange animate-pulse"></span>
                    Free 30-Min Executive Session
                </span>
                <span class="inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-royal/5 border border-royal/10 text-royal font-mono text-[10px] font-semibold">
                    <i class="ri-shield-check-line text-electric"></i> NDA Protected
                </span>
            </div>

            <h1 class="text-4xl md:text-5xl lg:text-6xl font-[400] tracking-tighter text-royal leading-[1.1] mb-3">
                Book Your Free <span class="italic font-serif text-soft">Strategy Consultation</span>
            </h1>
            <p class="text-soft text-base md:text-lg leading-relaxed max-w-2xl border-l-2 border-electric pl-4">
                30 minutes with a senior solutions architect. Zero sales pressure. Just actionable technical clarity, architectural advice, and a custom roadmap for your launch.
            </p>

            <?php if (!empty($focusTitle)): ?>
                <!-- Pre-selected Focus Context Banner -->
                <div class="mt-6 p-4 rounded-2xl bg-royal text-white flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 shadow-lg shadow-royal/10 border border-white/10" id="focusBanner">
                    <div class="flex items-center gap-3">
                        <div class="w-10 h-10 rounded-xl bg-white/10 flex items-center justify-center text-brandOrange flex-shrink-0">
                            <i class="ri-focus-3-line text-xl"></i>
                        </div>
                        <div>
                            <span class="font-mono text-[9px] uppercase tracking-widest text-brandOrange font-semibold block">Configured Session Focus</span>
                            <p class="text-sm font-semibold text-white"><?= $focusTitle ?></p>
                        </div>
                    </div>
                    <span class="text-xs text-white/70 bg-white/10 px-3 py-1.5 rounded-full font-mono">
                        Auto-assigned to lead architect
                    </span>
                </div>
            <?php endif; ?>
        </div>

        <!-- Main grid -->
        <div class="grid lg:grid-cols-[60%_40%] gap-8 items-start" data-aos="fade-up">

            <!-- LEFT: Multi-step intake form -->
            <div class="bg-white border border-zinc-100 rounded-[32px] shadow-[0_20px_60px_-20px_rgba(8,31,92,0.1)] overflow-hidden">

                <!-- Step progress bar -->
                <div class="px-6 md:px-8 pt-8 pb-4 border-b border-zinc-50">
                    <div class="flex items-center justify-between gap-2" id="stepBar">
                        <?php
                        $steps = [
                            ["num"=>"1","icon"=>"ri-user-3-line",       "label"=>"Your Info"],
                            ["num"=>"2","icon"=>"ri-lightbulb-line",    "label"=>"Interest"],
                            ["num"=>"3","icon"=>"ri-calendar-todo-line","label"=>"Schedule & Brief"],
                        ];
                        foreach ($steps as $i => $s):
                        ?>
                            <div id="stepBadge<?= $s['num'] ?>"
                                 class="flex items-center gap-2 px-3.5 py-2 rounded-full font-semibold text-xs transition-all duration-300 <?= $i===0 ? 'bg-royal text-white' : 'bg-[#F8F9FA] text-soft border border-zinc-100' ?>">
                                <i class="<?= $s['icon'] ?> text-sm"></i>
                                <span class="hidden sm:inline"><?= $s['label'] ?></span>
                                <span class="sm:hidden font-mono"><?= $s['num'] ?></span>
                            </div>
                            <?php if ($i < 2): ?>
                                <div class="h-px flex-1 bg-zinc-100" id="stepLine<?= $i+1 ?>"></div>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </div>
                </div>

                <div class="p-6 md:p-8">
                    <form id="strategyForm" novalidate>
                        <input type="hidden" name="subject" id="subjectInput" value="<?= $focusTitle ?>" />
                        <input type="hidden" name="product" value="<?= $productParam ?>" />
                        <input type="hidden" name="plan" value="<?= $planParam ?>" />

                        <!-- STEP 1: About You -->
                        <div id="step1" class="form-step">
                            <div class="mb-6">
                                <span class="font-mono text-[10px] uppercase tracking-widest text-brandOrange font-semibold block mb-1">Step 1 of 3</span>
                                <h2 class="text-2xl font-[400] text-royal tracking-tight mb-1">Tell us about yourself & organization</h2>
                                <p class="text-soft text-xs leading-relaxed">We'll review your background beforehand to maximize the 30 minutes.</p>
                            </div>

                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-4">
                                <div class="form-group" data-field="s1name">
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Full Name <span class="text-brandOrange">*</span></label>
                                    <input type="text" name="s1name" id="s1name" required autocomplete="name"
                                           class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300"
                                           placeholder="e.g. Alex Johnson" />
                                    <p class="error-msg hidden text-[11px] text-red-500 mt-1"></p>
                                </div>
                                <div class="form-group" data-field="s1company">
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Company / Project Name</label>
                                    <input type="text" name="s1company" id="s1company" autocomplete="organization"
                                           class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300"
                                           placeholder="e.g. Acme Fintech or Stealth" />
                                </div>
                            </div>

                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-4">
                                <div class="form-group" data-field="s1email">
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Work Email Address <span class="text-brandOrange">*</span></label>
                                    <input type="email" name="s1email" id="s1email" required autocomplete="email"
                                           class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300"
                                           placeholder="alex@company.com" />
                                    <p class="error-msg hidden text-[11px] text-red-500 mt-1"></p>
                                </div>

                                <div class="form-group" data-field="s1phone">
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Phone / WhatsApp <span class="text-brandOrange">*</span></label>
                                    <input type="tel" name="s1phone" id="s1phone" required autocomplete="tel"
                                           class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300"
                                           placeholder="+1 555 019 2834" />
                                    <p class="error-msg hidden text-[11px] text-red-500 mt-1"></p>
                                </div>
                            </div>

                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6">
                                <div>
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Your Location / Country</label>
                                    <select name="s1country" id="s1country"
                                            class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark appearance-none bg-white">
                                        <option value="United States">United States</option>
                                        <option value="United Kingdom">United Kingdom</option>
                                        <option value="Canada">Canada</option>
                                        <option value="Nigeria">Nigeria</option>
                                        <option value="Ghana">Ghana</option>
                                        <option value="Kenya">Kenya</option>
                                        <option value="South Africa">South Africa</option>
                                        <option value="United Arab Emirates">United Arab Emirates</option>
                                        <option value="Germany">Germany</option>
                                        <option value="France">France</option>
                                        <option value="Singapore">Singapore</option>
                                        <option value="Australia">Australia</option>
                                        <option value="Other">Other Global</option>
                                    </select>
                                </div>
                                <div>
                                    <label class="block font-semibold text-dark text-xs mb-1.5">Role / Title</label>
                                    <input type="text" name="s1role" id="s1role"
                                           class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300"
                                           placeholder="e.g. Founder, CTO, Head of Product" />
                                </div>
                            </div>

                            <div class="flex justify-end pt-4 border-t border-zinc-100">
                                <button type="button" id="toStep2"
                                        class="inline-flex items-center gap-2 px-8 py-3.5 bg-royal text-white rounded-full font-semibold text-sm hover:bg-electric transition-colors shadow-md">
                                    Next: Select Topics <i class="ri-arrow-right-line"></i>
                                </button>
                            </div>
                        </div>

                        <!-- STEP 2: Interest -->
                        <div id="step2" class="form-step hidden">
                            <div class="mb-6">
                                <span class="font-mono text-[10px] uppercase tracking-widest text-brandOrange font-semibold block mb-1">Step 2 of 3</span>
                                <h2 class="text-2xl font-[400] text-royal tracking-tight mb-1">What would you like to focus on?</h2>
                                <p class="text-soft text-xs leading-relaxed">Select all areas of interest so we match you with the exact technical specialist.</p>
                            </div>

                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6" id="interestCards">
                                <?php
                                $interests = [
                                    ["id"=>"tech-team",  "val"=>"Tech Team Subscription",  "icon"=>"ri-team-line",           "sub"=>"Dedicated full-stack engineering squad"],
                                    ["id"=>"fintech",    "val"=>"Fintech Infrastructure",   "icon"=>"ri-bank-card-line",      "sub"=>"Wallet, cards, remittance, eSIM, payouts"],
                                    ["id"=>"systems",    "val"=>"Enterprise Systems & OS",  "icon"=>"ri-layout-masonry-line", "sub"=>"ERP, CRM, Ledger Accounting & Core OS"],
                                    ["id"=>"platform",   "val"=>"Custom Platform Build",    "icon"=>"ri-code-s-slash-line",   "sub"=>"Bespoke web/mobile system with 100% IP"],
                                    ["id"=>"compliance", "val"=>"Licensing & Compliance",   "icon"=>"ri-shield-keyhole-line", "sub"=>"MSB/MTL fast-track & regulatory setup"],
                                    ["id"=>"advisory",   "val"=>"Architecture & Strategy",  "icon"=>"ri-compass-3-line",      "sub"=>"Tech stack evaluation & roadmap design"],
                                ];

                                // Determine initial check based on focus title
                                foreach ($interests as $int):
                                    $isPrechecked = false;
                                    if (!empty($focusTitle)) {
                                        if (stripos($focusTitle, 'tech team') !== false && $int['id'] === 'tech-team') $isPrechecked = true;
                                        if ((stripos($focusTitle, 'wallet') !== false || stripos($focusTitle, 'remittance') !== false || stripos($focusTitle, 'card') !== false || stripos($focusTitle, 'fintech') !== false || stripos($focusTitle, 'infrastructure') !== false) && $int['id'] === 'fintech') $isPrechecked = true;
                                        if ((stripos($focusTitle, 'erp') !== false || stripos($focusTitle, 'crm') !== false || stripos($focusTitle, 'accounting') !== false || stripos($focusTitle, 'operating system') !== false) && $int['id'] === 'systems') $isPrechecked = true;
                                        if ((stripos($focusTitle, 'compliance') !== false || stripos($focusTitle, 'license') !== false) && $int['id'] === 'compliance') $isPrechecked = true;
                                    }
                                ?>
                                    <label class="interest-pill flex items-start gap-3 p-4 border border-zinc-100 rounded-[20px] cursor-pointer hover:border-electric/40 hover:bg-[#F8F9FA] transition-all duration-200 group bg-[#F8F9FA] <?= $isPrechecked ? 'selected border-electric bg-blue-50/50' : '' ?>">
                                        <input type="checkbox" name="interests[]" value="<?= $int['val'] ?>" <?= $isPrechecked ? 'checked' : '' ?> class="sr-only interest-checkbox" />
                                        <div class="w-8 h-8 rounded-[10px] bg-white border border-zinc-100 flex items-center justify-center flex-shrink-0">
                                            <i class="<?= $int['icon'] ?> text-soft group-hover:text-electric text-sm transition-colors"></i>
                                        </div>
                                        <div class="flex-1">
                                            <p class="font-semibold text-dark text-sm leading-tight"><?= $int['val'] ?></p>
                                            <p class="text-soft text-xs mt-0.5"><?= $int['sub'] ?></p>
                                        </div>
                                        <div class="w-4 h-4 rounded-full border-2 border-zinc-200 flex-shrink-0 mt-0.5 check-dot transition-all"></div>
                                    </label>
                                <?php endforeach; ?>
                            </div>

                            <div class="flex items-center justify-between pt-4 border-t border-zinc-100">
                                <button type="button" id="backTo1"
                                        class="inline-flex items-center gap-2 px-6 py-3 bg-[#F8F9FA] border border-zinc-200 text-dark rounded-full font-semibold text-xs hover:border-royal/30 transition-colors">
                                    <i class="ri-arrow-left-line"></i> Back
                                </button>
                                <button type="button" id="toStep3"
                                        class="inline-flex items-center gap-2 px-8 py-3.5 bg-royal text-white rounded-full font-semibold text-sm hover:bg-electric transition-colors shadow-md">
                                    Next: Pick Date & Time <i class="ri-arrow-right-line"></i>
                                </button>
                            </div>
                        </div>

                        <!-- STEP 3: Project Brief + Schedule + Submit -->
                        <div id="step3" class="form-step hidden">
                            <div class="mb-6">
                                <span class="font-mono text-[10px] uppercase tracking-widest text-brandOrange font-semibold block mb-1">Step 3 of 3</span>
                                <h2 class="text-2xl font-[400] text-royal tracking-tight mb-1">Schedule & project overview</h2>
                                <p class="text-soft text-xs leading-relaxed">Choose your preferred session slot and outline your goals.</p>
                            </div>

                            <!-- Preferred Meeting Day & Time Slot -->
                            <div class="p-4 rounded-2xl bg-[#F8F9FA] border border-zinc-100 mb-5 space-y-4">
                                <div class="flex items-center gap-2">
                                    <i class="ri-calendar-check-line text-brandOrange text-base"></i>
                                    <span class="font-semibold text-xs text-dark uppercase tracking-wider font-mono">Preferred Session Slot</span>
                                </div>

                                <div class="grid grid-cols-1 sm:grid-cols-3 gap-3">
                                    <div>
                                        <label class="block font-semibold text-dark text-xs mb-1">Preferred Date</label>
                                        <input type="date" name="preferred_date" id="preferredDate"
                                               value="<?= date('Y-m-d', strtotime('+1 weekday')) ?>"
                                               min="<?= date('Y-m-d') ?>"
                                               class="field w-full px-3 py-2.5 text-xs border border-zinc-200 rounded-[12px] bg-white text-dark outline-none focus:border-electric focus:ring-1 focus:ring-electric" />
                                    </div>
                                    <div>
                                        <label class="block font-semibold text-dark text-xs mb-1">Time Slot</label>
                                        <select name="preferred_time" id="preferredTime"
                                                class="field w-full px-3 py-2.5 text-xs border border-zinc-200 rounded-[12px] bg-white text-dark outline-none focus:border-electric focus:ring-1 focus:ring-electric">
                                            <option value="10:00 AM">10:00 AM (Morning)</option>
                                            <option value="12:00 PM">12:00 PM (Midday)</option>
                                            <option value="02:00 PM" selected>02:00 PM (Afternoon)</option>
                                            <option value="04:00 PM">04:00 PM (Late Afternoon)</option>
                                            <option value="06:00 PM">06:00 PM (Evening)</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block font-semibold text-dark text-xs mb-1">Timezone</label>
                                        <select name="timezone" id="timezoneSelect"
                                                class="field w-full px-3 py-2.5 text-xs border border-zinc-200 rounded-[12px] bg-white text-dark outline-none focus:border-electric focus:ring-1 focus:ring-electric">
                                            <option value="EST (UTC-5)">EST (New York / Miami)</option>
                                            <option value="PST (UTC-8)">PST (San Francisco / LA)</option>
                                            <option value="GMT/UTC (UTC+0)">GMT / UTC (London / Accra)</option>
                                            <option value="WAT (UTC+1)">WAT (Lagos / Luanda)</option>
                                            <option value="CET (UTC+1)">CET (Berlin / Paris)</option>
                                            <option value="GST (UTC+4)">GST (Dubai / Abu Dhabi)</option>
                                            <option value="SGT (UTC+8)">SGT (Singapore)</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="grid grid-cols-1 sm:grid-cols-2 gap-3 pt-2">
                                    <div>
                                        <label class="block font-semibold text-dark text-xs mb-1">Preferred Meeting Platform</label>
                                        <select name="meeting_platform" id="meetPlatform"
                                                class="field w-full px-3 py-2.5 text-xs border border-zinc-200 rounded-[12px] bg-white text-dark outline-none focus:border-electric focus:ring-1 focus:ring-electric">
                                            <option value="Google Meet">Google Meet (Default)</option>
                                            <option value="Zoom">Zoom</option>
                                            <option value="Microsoft Teams">Microsoft Teams</option>
                                            <option value="WhatsApp Call">WhatsApp Voice/Video Call</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block font-semibold text-dark text-xs mb-1">Estimated Budget / Scope</label>
                                        <select name="budget" id="budgetSelect"
                                                class="field w-full px-3 py-2.5 text-xs border border-zinc-200 rounded-[12px] bg-white text-dark outline-none focus:border-electric focus:ring-1 focus:ring-electric">
                                            <option value="Under $5k">&lt; $5,000</option>
                                            <option value="$5k – $15k">$5,000 – $15,000</option>
                                            <option value="$15k – $50k" selected>$15,000 – $50,000</option>
                                            <option value="$50k – $100k">$50,000 – $100,000</option>
                                            <option value="$100k+ Enterprise">$100,000+ Enterprise</option>
                                            <option value="Exploring Options">Exploring Options / Not Sure</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="mb-4">
                                <label class="block font-semibold text-dark text-xs mb-1.5">Project Timeline</label>
                                <select name="timeline" id="timelineSelect"
                                        class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark appearance-none bg-white">
                                    <option value="Ready to start immediately">Ready to start immediately (&lt; 2 weeks)</option>
                                    <option value="1–3 months">1–3 months</option>
                                    <option value="3–6 months">3–6 months</option>
                                    <option value="Just exploring architectural feasibility">Just exploring architectural feasibility</option>
                                </select>
                            </div>

                            <div class="mb-4">
                                <label class="block font-semibold text-dark text-xs mb-1.5">
                                    Brief Project Description or Key Questions
                                    <span class="text-zinc-300 font-[400]"> (optional)</span>
                                </label>
                                <textarea name="description" id="strategyDescription" rows="4"
                                          class="field w-full px-4 py-3 text-sm border border-zinc-200 rounded-[16px] outline-none focus:border-electric focus:ring-2 focus:ring-electric/10 transition-all font-[400] text-dark placeholder:text-zinc-300 resize-none"
                                          placeholder="Tell us about what you want to build, current challenges, or specific questions for the call..."><?= $focusTitle ? "Interested in discussing $focusTitle and exploring technical architecture & deployment." : '' ?></textarea>
                            </div>

                            <label class="flex items-start gap-3 cursor-pointer mb-6 p-3 rounded-xl bg-zinc-50 border border-zinc-100 hover:bg-zinc-100/50 transition-colors">
                                <input type="checkbox" id="scGdpr" checked required class="w-4 h-4 mt-0.5 rounded accent-royal flex-shrink-0" />
                                <span class="text-[11px] text-soft leading-relaxed">
                                    I agree to Nesvra's Terms & Data Privacy Policy. Your details are confidential and never shared with third parties.
                                </span>
                            </label>

                            <div class="flex items-center justify-between pt-4 border-t border-zinc-100">
                                <button type="button" id="backTo2"
                                        class="inline-flex items-center gap-2 px-6 py-3 bg-[#F8F9FA] border border-zinc-200 text-dark rounded-full font-semibold text-xs hover:border-royal/30 transition-colors">
                                    <i class="ri-arrow-left-line"></i> Back
                                </button>
                                <button type="submit" id="strategySubmitBtn"
                                        class="inline-flex items-center gap-2 px-8 py-3.5 bg-royal text-white rounded-full font-semibold text-sm hover:bg-brandOrange transition-all shadow-lg hover:shadow-brandOrange/20">
                                    <i class="ri-calendar-check-line"></i> Confirm & Book Free Call
                                </button>
                            </div>
                        </div>

                    </form>

                    <!-- Instant Booking Alternative -->
                    <div class="mt-8 pt-6 border-t border-zinc-100 text-center">
                        <p class="text-soft text-xs mb-3">✨ Need an immediate direct calendar confirmation?</p>
                        <a href="https://calendly.com/nesvra" target="_blank" rel="noopener noreferrer"
                           class="inline-flex items-center gap-2 px-5 py-2.5 bg-[#F8F9FA] border border-zinc-200 text-dark rounded-full text-xs font-semibold hover:border-electric hover:text-electric transition-all">
                            <i class="ri-calendar-event-line text-electric"></i> Open Live Calendly Schedule
                        </a>
                    </div>
                </div>
            </div>

            <!-- RIGHT: Trust & Authority Sidebar -->
            <div class="flex flex-col gap-6 lg:sticky lg:top-28">

                <!-- What to expect -->
                <div class="bg-white border border-zinc-100 rounded-[32px] p-7 shadow-sm" data-aos="fade-up">
                    <div class="flex items-center gap-2 mb-4">
                        <span class="w-2 h-2 rounded-full bg-brandOrange"></span>
                        <h3 class="text-base font-semibold text-royal tracking-tight">What to expect in 30 minutes</h3>
                    </div>
                    <div class="flex flex-col gap-4">
                        <?php
                        $expects = [
                            ["icon"=>"ri-compass-3-line",      "title"=>"Architectural Feasibility", "text"=>"Direct review of your stack, technical risks, and scaling bottlenecks."],
                            ["icon"=>"ri-file-code-line",      "title"=>"Ownership vs. Subscription", "text"=>"Honest breakdown of 100% source ownership vs. hiring a tech team."],
                            ["icon"=>"ri-roadmap-line",        "title"=>"Actionable Proposal in 48h", "text"=>"Transparent fixed pricing, milestone timelines, and zero ongoing lock-in."],
                        ];
                        foreach ($expects as $e):
                        ?>
                            <div class="flex items-start gap-3">
                                <div class="w-8 h-8 rounded-[12px] bg-electric/10 flex items-center justify-center flex-shrink-0 mt-0.5">
                                    <i class="<?= $e['icon'] ?> text-electric text-sm"></i>
                                </div>
                                <div>
                                    <p class="text-dark text-xs font-bold leading-tight"><?= $e['title'] ?></p>
                                    <p class="text-soft text-xs leading-relaxed mt-0.5"><?= $e['text'] ?></p>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>

                <!-- Your Lead Architect -->
                <div class="bg-white border border-zinc-100 rounded-[32px] p-6 shadow-sm flex items-center gap-4" data-aos="fade-up">
                    <div class="w-14 h-14 rounded-[20px] bg-royal flex items-center justify-center text-white font-bold text-lg flex-shrink-0 shadow-md shadow-royal/20">
                        TA
                    </div>
                    <div>
                        <p class="font-semibold text-royal text-sm">Hosted by <span class="text-dark">Tolani A. & Solutions Squad</span></p>
                        <p class="text-soft text-xs leading-relaxed mt-0.5">Principal Systems Architect · 10+ yrs scaling digital ecosystems</p>
                        <div class="flex items-center gap-1 mt-2">
                            <?php for ($i=0;$i<5;$i++): ?>
                                <i class="ri-star-fill text-brandOrange text-xs"></i>
                            <?php endfor; ?>
                            <span class="font-mono text-[10px] text-soft ml-1.5">4.9 / 5 (62+ enterprise calls)</span>
                        </div>
                    </div>
                </div>

                <!-- What happens next timeline -->
                <div class="bg-white border border-zinc-100 rounded-[32px] p-7 shadow-sm" data-aos="fade-up">
                    <h4 class="font-semibold text-royal text-sm mb-4 flex items-center gap-2">
                        <i class="ri-time-line text-brandOrange"></i> Post-Booking Timeline
                    </h4>
                    <div class="flex flex-col gap-3.5">
                        <?php
                        $nexts = [
                            ["n"=>"01","t"=>"Instant confirmation email & calendar invite with Google Meet / Zoom link."],
                            ["n"=>"02","t"=>"Pre-session technical brief reviewed by our architects."],
                            ["n"=>"03","t"=>"30-min focused strategy session + custom proposal delivered in 48 hrs."],
                        ];
                        foreach ($nexts as $n):
                        ?>
                            <div class="flex items-start gap-3">
                                <span class="w-6 h-6 rounded-full bg-[#F8F9FA] border border-zinc-100 flex items-center justify-center font-mono text-[10px] text-royal font-semibold flex-shrink-0"><?= $n['n'] ?></span>
                                <p class="text-soft text-xs leading-snug mt-0.5"><?= $n['t'] ?></p>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>

                <!-- Testimonial -->
                <div class="border-l-2 border-brandOrange pl-5 bg-white rounded-r-[24px] p-5 border border-l-0 border-zinc-100 shadow-sm" data-aos="fade-up">
                    <p class="text-dark font-[400] italic text-xs leading-relaxed mb-3">
                        "The strategy session saved us months of trial and error. We got total clarity on our digital wallet architecture and launched in 4 weeks."
                    </p>
                    <div class="flex items-center gap-3">
                        <div class="w-7 h-7 rounded-full bg-brandOrange/10 flex items-center justify-center text-brandOrange font-bold text-[10px]">MK</div>
                        <div>
                            <span class="font-semibold text-royal text-xs block">Mariam K.</span>
                            <span class="font-mono text-[9px] uppercase tracking-widest text-soft">COO, SwiftSave Fintech</span>
                        </div>
                    </div>
                </div>

                <!-- Trust badges -->
                <div class="flex flex-wrap gap-2" data-aos="fade-up">
                    <?php foreach (["Zero Obligation","100% IP Ownership Guarantee","SSL Encrypted","Direct Architect Access"] as $b): ?>
                        <span class="flex items-center gap-1.5 px-3 py-1.5 bg-white border border-zinc-100 rounded-full text-[11px] font-semibold text-dark shadow-2xs">
                            <span class="w-1.5 h-1.5 rounded-full bg-electric"></span><?= $b ?>
                        </span>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- ═══ SUCCESS MODAL WITH CALENDAR ACTIONS ═══ -->
<div id="scModal" class="fixed inset-0 z-[100] hidden items-center justify-center p-4">
    <!-- Backdrop -->
    <div class="absolute inset-0 bg-black/50 backdrop-blur-sm" id="scModalBackdrop"></div>
    <!-- Card -->
    <div class="relative bg-white rounded-[32px] shadow-[0_40px_80px_-20px_rgba(8,31,92,0.3)] w-full max-w-lg p-8 md:p-10 text-center z-10 animate-[scaleIn_0.3s_ease]">

        <div class="w-16 h-16 rounded-2xl bg-emerald-50 text-emerald-600 flex items-center justify-center mx-auto mb-4 border border-emerald-100 shadow-sm">
            <i class="ri-checkbox-circle-fill text-3xl"></i>
        </div>

        <span class="font-mono text-[10px] uppercase tracking-widest text-brandOrange font-semibold block mb-1">Booking Confirmed</span>
        <h2 class="text-2xl md:text-3xl font-[400] text-royal tracking-tighter mb-2">
            You're All Set, <span id="scModalName" class="italic font-serif text-brandOrange">Partner</span>!
        </h2>
        <p class="text-soft text-xs md:text-sm leading-relaxed mb-6">
            Your strategy consultation has been reserved. A confirmation email and calendar link from <strong class="text-dark">hello@nesvra.com</strong> is on its way.
        </p>

        <!-- Scheduled Session Summary Card -->
        <div class="bg-[#F8F9FA] border border-zinc-100 rounded-2xl p-4 text-left mb-6 space-y-2">
            <div class="flex justify-between items-center text-xs">
                <span class="text-soft font-mono uppercase text-[10px]">Reference ID:</span>
                <span class="font-mono font-bold text-royal" id="scModalRef">STRAT-892A</span>
            </div>
            <div class="flex justify-between items-center text-xs">
                <span class="text-soft font-mono uppercase text-[10px]">Target Date & Time:</span>
                <span class="font-semibold text-dark" id="scModalDateTime">Selected Date @ 02:00 PM</span>
            </div>
            <div class="flex justify-between items-center text-xs">
                <span class="text-soft font-mono uppercase text-[10px]">Platform:</span>
                <span class="font-semibold text-dark" id="scModalPlatform">Google Meet</span>
            </div>
        </div>

        <!-- Action Buttons -->
        <div class="flex flex-col gap-2.5">
            <a id="scGoogleCalBtn" href="https://calendar.google.com" target="_blank" rel="noopener noreferrer"
               class="w-full py-3.5 bg-royal text-white rounded-full text-xs font-bold uppercase tracking-wider hover:bg-brandOrange transition-all flex items-center justify-center gap-2 shadow-md">
                <i class="ri-google-fill"></i> Add to Google Calendar
            </a>

            <div class="flex flex-col sm:flex-row gap-2.5">
                <a href="https://wa.me/2348000000000?text=Hi%20Nesvra%20Team%2C%20I%20just%20booked%20a%20strategy%20call%20and%20wanted%20to%20connect%20directly." target="_blank"
                   class="flex-1 py-3 bg-[#E7F8EE] border border-emerald-200 text-emerald-800 rounded-full text-xs font-semibold hover:bg-emerald-600 hover:text-white transition-all flex items-center justify-center gap-1.5">
                    <i class="ri-whatsapp-line text-sm"></i> WhatsApp Connect
                </a>
                <a href="systems.php" class="flex-1 py-3 bg-[#F8F9FA] border border-zinc-200 text-dark rounded-full text-xs font-semibold hover:bg-white hover:border-royal/30 transition-all text-center">
                    Explore Systems →
                </a>
            </div>
            <button type="button" id="scModalCloseBtn" class="text-xs text-soft hover:text-royal mt-2 transition-colors">
                Close & Return
            </button>
        </div>
    </div>
</div>

<?php include 'components/Scroll-to-top.php'; ?>
<?php include 'components/footer.php'; ?>

<style>
    @keyframes scaleIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .interest-pill.selected { border-color: #3353E0 !important; background-color: #EEF2FF !important; }
    .interest-pill.selected .check-dot { background-color: #3353E0; border-color: #3353E0; }
    .interest-pill.selected i { color: #3353E0 !important; }
    .form-group.has-error .field { border-color: #ef4444 !important; background: #fff5f5 !important; }
    .form-group.has-success .field { border-color: #10b981 !important; }
</style>

<script>
document.addEventListener('DOMContentLoaded', () => {

    // ── Step navigation ────────────────────────────────────
    const steps = ['step1','step2','step3'];

    function goTo(n) {
        steps.forEach((id,i) => {
            const el = document.getElementById(id);
            if (el) el.classList.toggle('hidden', i !== n-1);
        });

        // Update step badges
        for (let i=1; i<=3; i++) {
            const badge = document.getElementById(`stepBadge${i}`);
            if (!badge) continue;
            if (i < n) {
                badge.className = 'flex items-center gap-2 px-3.5 py-2 rounded-full font-semibold text-xs transition-all duration-300 bg-emerald-600 text-white shadow-xs';
            } else if (i === n) {
                badge.className = 'flex items-center gap-2 px-3.5 py-2 rounded-full font-semibold text-xs transition-all duration-300 bg-royal text-white shadow-sm';
            } else {
                badge.className = 'flex items-center gap-2 px-3.5 py-2 rounded-full font-semibold text-xs transition-all duration-300 bg-[#F8F9FA] text-soft border border-zinc-100';
            }
        }
        window.scrollTo({ top: document.getElementById('strategyForm').getBoundingClientRect().top + window.scrollY - 100, behavior: 'smooth' });
    }

    // ── Validation ─────────────────────────────────────────
    function validateField(input) {
        const group = input.closest('.form-group');
        if (!group) return true;
        const err = group.querySelector('.error-msg');
        let valid = true, msg = '';

        if (input.required && !input.value.trim()) {
            valid = false;
            msg = 'This field is required.';
        } else if (input.type === 'email' && !/^\S+@\S+\.\S+$/.test(input.value.trim())) {
            valid = false;
            msg = 'Valid work email required.';
        } else if (input.type === 'tel' && input.value.trim().length < 6) {
            valid = false;
            msg = 'Valid phone number required.';
        }

        group.classList.toggle('has-error', !valid);
        group.classList.toggle('has-success', valid && !!input.value.trim());
        if (err) {
            err.textContent = msg;
            err.classList.toggle('hidden', valid);
        }
        return valid;
    }

    document.querySelectorAll('#strategyForm .field[required]').forEach(f => {
        f.addEventListener('blur',  () => validateField(f));
        f.addEventListener('input', () => {
            const g = f.closest('.form-group');
            g?.classList.remove('has-error');
            g?.querySelector('.error-msg')?.classList.add('hidden');
        });
    });

    // ── Step 1 → 2 ────────────────────────────────────────
    document.getElementById('toStep2')?.addEventListener('click', () => {
        const fields = ['s1name','s1email','s1phone'].map(id => document.getElementById(id)).filter(Boolean);
        const ok = fields.every(f => validateField(f));
        if (ok) goTo(2);
    });

    // ── Step 2 nav ─────────────────────────────────────────
    document.getElementById('backTo1')?.addEventListener('click', () => goTo(1));
    document.getElementById('toStep3')?.addEventListener('click', () => goTo(3));
    document.getElementById('backTo2')?.addEventListener('click', () => goTo(2));

    // ── Interest pill selection (clean change handler, avoiding double toggles) ──
    document.querySelectorAll('.interest-pill').forEach(pill => {
        const cb = pill.querySelector('.interest-checkbox');
        if (!cb) return;

        cb.addEventListener('change', () => {
            pill.classList.toggle('selected', cb.checked);
        });
    });

    // ── Form submit → API call & show modal ────────────────
    document.getElementById('strategyForm')?.addEventListener('submit', async e => {
        e.preventDefault();
        const gdpr = document.getElementById('scGdpr');
        if (gdpr && !gdpr.checked) {
            gdpr.closest('label').classList.add('border-red-400');
            return;
        }

        const btn = document.getElementById('strategySubmitBtn');
        const originalText = btn.innerHTML;
        btn.innerHTML = '<span class="inline-block w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"></span> Reserving your slot...';
        btn.disabled = true;

        const form = e.target;
        const formData = new FormData(form);

        let result = null;
        try {
            const response = await fetch('api/submit-strategy-call.php', {
                method: 'POST',
                body: formData
            });
            result = await response.json();
        } catch (err) {
            console.log('Submission fallback:', err);
        }

        const nameVal = document.getElementById('s1name')?.value.trim() || 'there';
        const firstName = result?.first_name || nameVal.split(' ')[0] || 'there';
        const leadRef = result?.lead_id || ('STRAT-' + Math.random().toString(36).substring(2, 7).toUpperCase());
        const dateVal = document.getElementById('preferredDate')?.value || 'Upcoming Date';
        const timeVal = document.getElementById('preferredTime')?.value || '02:00 PM';
        const tzVal   = document.getElementById('timezoneSelect')?.value || 'EST';
        const platVal = document.getElementById('meetPlatform')?.value || 'Google Meet';

        document.getElementById('scModalName').textContent = firstName;
        document.getElementById('scModalRef').textContent = leadRef;
        document.getElementById('scModalDateTime').textContent = `${dateVal} @ ${timeVal} (${tzVal})`;
        document.getElementById('scModalPlatform').textContent = platVal;

        // Generate Google Calendar Link
        const gCalTitle = encodeURIComponent('Nesvra Strategic Technology Consultation');
        const gCalDetails = encodeURIComponent(`Executive Strategy Session with Nesvra Solutions Architecture Team.\nReference ID: ${leadRef}\nPlatform: ${platVal}`);
        const gCalUrl = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${gCalTitle}&details=${gCalDetails}`;
        document.getElementById('scGoogleCalBtn').href = gCalUrl;

        btn.innerHTML = originalText;
        btn.disabled = false;

        const modal = document.getElementById('scModal');
        modal.classList.remove('hidden');
        modal.classList.add('flex');
        document.body.style.overflow = 'hidden';
    });

    // ── Close Modal ────────────────────────────────────────
    function closeStrategyModal() {
        const modal = document.getElementById('scModal');
        modal.classList.add('hidden');
        modal.classList.remove('flex');
        document.body.style.overflow = '';
    }

    document.getElementById('scModalBackdrop')?.addEventListener('click', closeStrategyModal);
    document.getElementById('scModalCloseBtn')?.addEventListener('click', closeStrategyModal);
});
</script>
</body>
</html>