<div class="page-banner">
    <div class="container">
        <h2><?= htmlspecialchars($workshop['title']) ?></h2>
        <div class="breadcrumb">
            <a href="/">Home</a>
            <span class="separator"><i class="fas fa-chevron-right"></i></span>
            <a href="/workshops">Workshops</a>
            <span class="separator"><i class="fas fa-chevron-right"></i></span>
            <span><?= htmlspecialchars($workshop['title']) ?></span>
        </div>
    </div>
</div>

<section class="page-content">
    <div class="container">
        <div class="workshop-detail-grid fade-in-up">
            <div class="workshop-detail-content">
                <h3>About This Workshop</h3>
                <p><?= nl2br(htmlspecialchars($workshop['description'] ?? '')) ?></p>

                <?php if (!empty($workshop['objectives'])): ?>
                <h3>Objectives</h3>
                <ul>
                    <?php foreach (explode(';', $workshop['objectives']) as $obj): ?>
                        <?php $obj = trim($obj); if ($obj): ?>
                        <li><?= htmlspecialchars($obj) ?></li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </ul>
                <?php endif; ?>

                <?php if (!empty($workshop['syllabus'])): ?>
                <h3>Syllabus</h3>
                <ul>
                    <?php foreach (explode(';', $workshop['syllabus']) as $item): ?>
                        <?php $item = trim($item); if ($item): ?>
                        <li><?= htmlspecialchars($item) ?></li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </ul>
                <?php endif; ?>

                <a href="/workshops" class="btn btn-secondary"><i class="fas fa-arrow-left"></i> Back to Workshops</a>
            </div>
            <div class="workshop-sidebar fade-in-right">
                <h3>Workshop Details</h3>
                <?php if (!empty($workshop['duration'])): ?>
                <div class="workshop-sidebar-item">
                    <div class="icon"><i class="fas fa-clock"></i></div>
                    <div>
                        <h4>Duration</h4>
                        <p><?= htmlspecialchars($workshop['duration']) ?></p>
                    </div>
                </div>
                <?php endif; ?>
                <?php if (!empty($workshop['price'])): ?>
                <div class="workshop-sidebar-item">
                    <div class="icon"><i class="fas fa-tag"></i></div>
                    <div>
                        <h4>Price</h4>
                        <p><?= htmlspecialchars($workshop['price']) ?></p>
                    </div>
                </div>
                <?php endif; ?>
                <?php if (!empty($workshop['location'])): ?>
                <div class="workshop-sidebar-item">
                    <div class="icon"><i class="fas fa-map-marker-alt"></i></div>
                    <div>
                        <h4>Location</h4>
                        <p><?= htmlspecialchars($workshop['location']) ?></p>
                    </div>
                </div>
                <?php endif; ?>
                <?php if (!empty($workshop['max_participants'])): ?>
                <div class="workshop-sidebar-item">
                    <div class="icon"><i class="fas fa-users"></i></div>
                    <div>
                        <h4>Max Participants</h4>
                        <p><?= htmlspecialchars($workshop['max_participants']) ?></p>
                    </div>
                </div>
                <?php endif; ?>
                <a href="#registration" class="btn btn-primary mt-3" style="width: 100%;">Register Now <i class="fas fa-paper-plane"></i></a>
            </div>
        </div>
    </div>
</section>

<section id="registration" class="sections-area bg-light">
    <div class="container">
        <div class="section-title fade-in-up">
            <h2>Register for This Workshop</h2>
            <p>Fill out the form below to secure your spot</p>
        </div>
        <div class="registration-form fade-in-up">
            <?php if (!empty($registrationMsg)): ?>
            <div class="registration-msg"><?= htmlspecialchars($registrationMsg) ?></div>
            <?php endif; ?>
            <form action="" method="post">
                <?= csrfField() ?>
                <div class="form-row">
                    <div class="form-group">
                        <label for="name">Full Name</label>
                        <input type="text" id="name" name="name" required placeholder="Your full name">
                    </div>
                    <div class="form-group">
                        <label for="email">Email Address</label>
                        <input type="email" id="email" name="email" required placeholder="your@email.com">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="phone">Phone Number</label>
                        <input type="tel" id="phone" name="phone" placeholder="Your phone number">
                    </div>
                    <div class="form-group">
                        <label for="organization">Organization</label>
                        <input type="text" id="organization" name="organization" placeholder="Your organization">
                    </div>
                </div>
                <div class="form-group">
                    <label for="message">Message</label>
                    <textarea id="message" name="message" rows="4" placeholder="Any additional information"></textarea>
                </div>
                <div class="form-group">
                    <label for="captcha">Security Check: <?= generateCaptcha() ?></label>
                    <input type="number" id="captcha" name="captcha" required placeholder="Enter the answer">
                </div>
                <button type="submit" class="btn btn-primary" style="width: 100%;">Register Now <i class="fas fa-paper-plane"></i></button>
            </form>
        </div>
    </div>
</section>
