<?php
/**
 * Franchisee Enquiry Page — Gmind Institute
 *
 * Benefits section, franchisee enquiry form with CSRF protection.
 *
 * Expected PHP variables:
 *   $csrfToken  — CSRF token string
 *   $currentPage — string 'franchisee'
 *   $title      — page title
 *   $errors     — array of validation errors (optional)
 *   $old        — array of old input values (optional)
 */

$errors    = $errors    ?? [];
$old       = $old       ?? [];
$csrfToken = $csrfToken ?? '';
?>

<?php include __DIR__ . '/../layouts/header.php'; ?>

<!-- ============================================================
     Page Banner
     ============================================================ -->
<section class="page-banner" aria-label="Page heading">
    <div class="container">
        <h1>Partner With Gmind Institute</h1>
        <p>Join our growing network and bring quality computer education to your city</p>
        <nav class="breadcrumb" aria-label="Breadcrumb">
            <a href="<?= url('/') ?>">Home</a>
            <span aria-hidden="true">/</span>
            <span>Franchisee</span>
        </nav>
    </div>
</section>

<!-- ============================================================
     Benefits Section
     ============================================================ -->
<section class="franchisee-benefits section-white" aria-label="Franchisee benefits">
    <div class="container">
        <div class="section-heading">
            <h2>Why Become a Gmind Franchisee?</h2>
            <p>Unlock a world of opportunities with India's trusted computer education brand</p>
        </div>

        <div class="benefits-grid">
            <div class="benefit-card animate-on-scroll">
                <div class="benefit-icon icon-navy" aria-hidden="true">
                    <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
                </div>
                <h3>Established Brand</h3>
                <p>Leverage the trust and recognition of the Gmind Institute brand — already known across India for quality computer education.</p>
            </div>

            <div class="benefit-card animate-on-scroll" data-delay="100">
                <div class="benefit-icon icon-scarlet" aria-hidden="true">
                    <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"/></svg>
                </div>
                <h3>High ROI</h3>
                <p>Low investment, high returns. Our franchisee model is designed for profitability with multiple revenue streams from courses and certifications.</p>
            </div>

            <div class="benefit-card animate-on-scroll" data-delay="200">
                <div class="benefit-icon icon-gold" aria-hidden="true">
                    <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/></svg>
                </div>
                <h3>Complete Support</h3>
                <p>From setup to daily operations — get full support including marketing material, faculty training, course curriculum, and technical infrastructure.</p>
            </div>

            <div class="benefit-card animate-on-scroll" data-delay="300">
                <div class="benefit-icon icon-navy" aria-hidden="true">
                    <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
                </div>
                <h3>Digital Infrastructure</h3>
                <p>Access our proprietary online exam portal, student management system, and digital certificate platform — all included with your franchise.</p>
            </div>
        </div>
    </div>
</section>

<!-- ============================================================
     Franchisee Form Section
     ============================================================ -->
<section class="franchisee-form-section section-offwhite" aria-label="Franchisee enquiry form">
    <div class="container">
        <div class="section-heading">
            <h2>Submit Your Enquiry</h2>
            <p>Fill in the form below and our team will get in touch with you</p>
        </div>

        <div class="franchisee-form-wrapper">
            <?php if (!empty($errors)): ?>
            <div class="alert alert-error" role="alert">
                <strong>Please fix the following errors:</strong>
                <ul>
                    <?php foreach ($errors as $error): ?>
                    <li><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <?php endif; ?>

            <form method="POST" action="<?= url('/franchisee') ?>" class="admission-form" novalidate>
                <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($csrfToken, ENT_QUOTES, 'UTF-8') ?>">

                <div class="form-grid">
                    <div class="form-group">
                        <label for="name">Full Name <span class="required">*</span></label>
                        <input type="text" id="name" name="name" required placeholder="Enter your full name" value="<?= htmlspecialchars($old['name'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
                    </div>
                    <div class="form-group">
                        <label for="email">Email Address <span class="required">*</span></label>
                        <input type="email" id="email" name="email" required placeholder="Enter your email" value="<?= htmlspecialchars($old['email'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
                    </div>
                    <div class="form-group">
                        <label for="phone">Phone Number <span class="required">*</span></label>
                        <input type="tel" id="phone" name="phone" required placeholder="Enter your phone number" value="<?= htmlspecialchars($old['phone'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
                    </div>
                    <div class="form-group">
                        <label for="city">City <span class="required">*</span></label>
                        <input type="text" id="city" name="city" required placeholder="Enter your city" value="<?= htmlspecialchars($old['city'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
                    </div>
                    <div class="form-group">
                        <label for="state">State <span class="required">*</span></label>
                        <input type="text" id="state" name="state" required placeholder="Enter your state" value="<?= htmlspecialchars($old['state'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
                    </div>
                    <div class="form-group">
                        <label for="investment_range">Investment Range <span class="required">*</span></label>
                        <select id="investment_range" name="investment_range" required>
                            <option value="">-- Select Range --</option>
                            <option value="below_5l" <?= ($old['investment_range'] ?? '') === 'below_5l' ? 'selected' : '' ?>>Below ₹5 Lakhs</option>
                            <option value="5l_10l" <?= ($old['investment_range'] ?? '') === '5l_10l' ? 'selected' : '' ?>>₹5 - ₹10 Lakhs</option>
                            <option value="10l_20l" <?= ($old['investment_range'] ?? '') === '10l_20l' ? 'selected' : '' ?>>₹10 - ₹20 Lakhs</option>
                            <option value="above_20l" <?= ($old['investment_range'] ?? '') === 'above_20l' ? 'selected' : '' ?>>Above ₹20 Lakhs</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="message">Message</label>
                    <textarea id="message" name="message" rows="5" placeholder="Tell us about your interest, location preference, or any queries..."><?= htmlspecialchars($old['message'] ?? '', ENT_QUOTES, 'UTF-8') ?></textarea>
                </div>

                <button type="submit" class="btn-primary btn-submit">Submit Enquiry</button>
            </form>
        </div>
    </div>
</section>

<?php include __DIR__ . '/../layouts/footer.php'; ?>
