<?php
session_start();
include 'includes/db.php';

$id = intval($_GET['id'] ?? 0);
$is_admin = isset($_SESSION['admin_logged_in']);

// Fetch Company
$stmt = $conn->prepare("SELECT * FROM companies WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
$comp = $stmt->get_result()->fetch_assoc();

// If not found or draft (and not admin)
if (!$comp || (!$is_admin && $comp['status'] !== 'Published')) {
    include 'includes/header.php';
    ?>
    <div class="container" style="padding: 100px 20px; text-align: center;">
        <div style="background: #fff; border-radius: 16px; padding: 50px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); max-width: 600px; margin: 0 auto;">
            <i class="fas fa-building" style="font-size: 64px; color: #cbd5e1; margin-bottom: 20px;"></i>
            <h2 style="color: var(--dark-blue, #003366); font-size: 28px; margin-bottom: 12px;">Company Profile Not Found</h2>
            <p style="color: #64748b; font-size: 16px; margin-bottom: 24px;">The company profile you are looking for is currently unavailable, archived, or undergoing review.</p>
            <a href="/bm/contact" style="display: inline-block; padding: 10px 24px; background: #003366; color: #fff; text-decoration: none; border-radius: 25px; font-weight: 600;">Back to Customers</a>
        </div>
    </div>
    <?php
    include 'includes/footer.php';
    exit;
}

// Fetch Founders
$f_stmt = $conn->prepare("SELECT * FROM founders WHERE company_id = ? " . ($is_admin ? "" : "AND status = 'Published'") . " ORDER BY display_order ASC, created_at ASC");
$f_stmt->bind_param("i", $id);
$f_stmt->execute();
$founders = $f_stmt->get_result();

// Fetch Directors
$d_stmt = $conn->prepare("SELECT * FROM directors WHERE company_id = ? " . ($is_admin ? "" : "AND status = 'Published'") . " ORDER BY display_order ASC, created_at ASC");
$d_stmt->bind_param("i", $id);
$d_stmt->execute();
$directors = $d_stmt->get_result();

// SEO Meta Variables
$page_title = htmlspecialchars($comp['company_name']) . " - Company Profile | BALIMEEN";
$meta_desc = !empty($comp['description']) ? htmlspecialchars(substr($comp['description'], 0, 160)) : "Complete company profile, leadership, services, and corporate details for " . htmlspecialchars($comp['company_name']);
$og_image = !empty($comp['banner']) ? '/bm/' . $comp['banner'] : (!empty($comp['logo']) ? '/bm/' . $comp['logo'] : '/bm/bmpl theme.jpg');

include 'includes/header.php';
?>

<!-- Link to specialized Company Profile stylesheet -->
<link rel="stylesheet" href="/bm/assets/css/company-profile.css">

<div class="cp-page-wrapper">
    <!-- Hero Banner with background image or gradient -->
    <div class="cp-hero-banner" style="<?php echo !empty($comp['banner']) ? "background-image: url('/bm/".htmlspecialchars($comp['banner'])."');" : ""; ?>">
        <div class="cp-hero-overlay"></div>
    </div>

    <div class="container" style="max-width: 1140px; margin: 0 auto; padding: 0 20px 80px;">
        <!-- Header Profile Card -->
        <div class="cp-header-card d-flex align-items-center gap-4 flex-wrap flex-md-nowrap">
            <div class="cp-logo-wrapper">
                <?php if (!empty($comp['logo'])): ?>
                    <img src="/bm/<?php echo htmlspecialchars($comp['logo']); ?>" alt="<?php echo htmlspecialchars($comp['company_name']); ?> Logo">
                <?php else: ?>
                    <div style="font-size: 40px; font-weight: 800; color: var(--cp-primary);">
                        <?php echo strtoupper(substr($comp['company_name'], 0, 1)); ?>
                    </div>
                <?php endif; ?>
            </div>

            <div style="flex-grow: 1;">
                <h1 class="cp-title"><?php echo htmlspecialchars($comp['company_name']); ?></h1>
                <?php if (!empty($comp['legal_name']) && $comp['legal_name'] !== $comp['company_name']): ?>
                    <div style="font-size: 15px; color: var(--cp-muted); margin-bottom: 6px; font-weight: 500;">
                        <i class="fas fa-certificate text-primary me-1"></i> Legal Entity: <?php echo htmlspecialchars($comp['legal_name']); ?>
                    </div>
                <?php endif; ?>

                <div class="cp-badge-list">
                    <?php if (!empty($comp['company_type'])): ?>
                        <span class="cp-badge"><i class="fas fa-building"></i> <?php echo htmlspecialchars($comp['company_type']); ?></span>
                    <?php endif; ?>
                    <?php if (!empty($comp['industry'])): ?>
                        <span class="cp-badge"><i class="fas fa-industry"></i> <?php echo htmlspecialchars($comp['industry']); ?></span>
                    <?php endif; ?>
                    <?php if (!empty($comp['year_established'])): ?>
                        <span class="cp-badge accent"><i class="fas fa-calendar-alt"></i> Estd. <?php echo htmlspecialchars($comp['year_established']); ?></span>
                    <?php endif; ?>
                    <?php if (!empty($comp['city'])): ?>
                        <span class="cp-badge"><i class="fas fa-map-marker-alt"></i> <?php echo htmlspecialchars($comp['city']); ?><?php echo !empty($comp['state']) ? ', '.htmlspecialchars($comp['state']) : ''; ?></span>
                    <?php endif; ?>
                </div>

                <?php if (!empty($comp['description'])): ?>
                    <p style="color: var(--cp-slate); font-size: 15.5px; line-height: 1.6; margin-bottom: 0;">
                        <?php echo nl2br(htmlspecialchars($comp['description'])); ?>
                    </p>
                <?php endif; ?>
            </div>

            <?php if (!empty($comp['website_url'])): ?>
                <div class="text-md-end text-center w-100 w-md-auto" style="min-width: 180px;">
                    <a href="<?php echo htmlspecialchars($comp['website_url']); ?>" target="_blank" rel="noopener noreferrer" class="showcase-btn" style="display: inline-flex;">
                        <i class="fas fa-globe"></i> Visit Website
                    </a>
                </div>
            <?php endif; ?>
        </div>

        <!-- Key Highlights Stats Row -->
        <?php if (!empty($comp['experience']) || !empty($comp['employees']) || !empty($comp['projects_completed']) || !empty($comp['turnover'])): ?>
            <div class="cp-stats-grid">
                <?php if (!empty($comp['experience'])): ?>
                    <div class="cp-stat-box">
                        <div class="cp-stat-number"><?php echo htmlspecialchars($comp['experience']); ?></div>
                        <div class="cp-stat-label">Industry Experience</div>
                    </div>
                <?php endif; ?>
                <?php if (!empty($comp['projects_completed'])): ?>
                    <div class="cp-stat-box accent">
                        <div class="cp-stat-number"><?php echo htmlspecialchars($comp['projects_completed']); ?></div>
                        <div class="cp-stat-label">Projects Completed</div>
                    </div>
                <?php endif; ?>
                <?php if (!empty($comp['employees'])): ?>
                    <div class="cp-stat-box">
                        <div class="cp-stat-number"><?php echo htmlspecialchars($comp['employees']); ?></div>
                        <div class="cp-stat-label">Workforce & Team</div>
                    </div>
                <?php endif; ?>
                <?php if (!empty($comp['turnover'])): ?>
                    <div class="cp-stat-box accent">
                        <div class="cp-stat-number"><?php echo htmlspecialchars($comp['turnover']); ?></div>
                        <div class="cp-stat-label">Annual Turnover</div>
                    </div>
                <?php endif; ?>
            </div>
        <?php endif; ?>

        <!-- 1. About Company -->
        <?php if (!empty($comp['about_company']) || !empty($comp['business_details'])): ?>
            <div class="cp-section">
                <h2 class="cp-section-title"><i class="fas fa-info-circle text-primary"></i> About <?php echo htmlspecialchars($comp['company_name']); ?></h2>
                <?php if (!empty($comp['about_company'])): ?>
                    <div style="font-size: 16px; line-height: 1.8; color: #334155; margin-bottom: 20px;">
                        <?php echo nl2br(htmlspecialchars($comp['about_company'])); ?>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['business_details'])): ?>
                    <h3 style="font-size: 18px; font-weight: 700; color: var(--cp-primary); margin-top: 24px; margin-bottom: 12px;">Business Operations & Scope</h3>
                    <div style="font-size: 15.5px; line-height: 1.7; color: #475569;">
                        <?php echo nl2br(htmlspecialchars($comp['business_details'])); ?>
                    </div>
                <?php endif; ?>
            </div>
        <?php endif; ?>

        <!-- 2. Services & Products -->
        <?php if (!empty($comp['services']) || !empty($comp['products'])): ?>
            <div class="cp-section">
                <h2 class="cp-section-title"><i class="fas fa-cogs text-primary"></i> Services & Offerings</h2>
                <div class="row" style="display: flex; flex-wrap: wrap; gap: 24px;">
                    <?php if (!empty($comp['services'])): ?>
                        <div style="flex: 1 1 300px;">
                            <h3 style="font-size: 17px; font-weight: 700; color: var(--cp-primary); margin-bottom: 14px;"><i class="fas fa-wrench text-warning me-2"></i> Key Services</h3>
                            <div class="cp-tag-cloud">
                                <?php 
                                $service_items = preg_split('/[\r\n,]+/', $comp['services']);
                                foreach($service_items as $si):
                                    $si = trim($si);
                                    if(!empty($si)): ?>
                                        <span class="cp-tag"><i class="fas fa-check-circle"></i> <?php echo htmlspecialchars($si); ?></span>
                                    <?php endif; endforeach; ?>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if (!empty($comp['products'])): ?>
                        <div style="flex: 1 1 300px;">
                            <h3 style="font-size: 17px; font-weight: 700; color: var(--cp-primary); margin-bottom: 14px;"><i class="fas fa-box-open text-primary me-2"></i> Products & Portfolio</h3>
                            <div class="cp-tag-cloud">
                                <?php 
                                $product_items = preg_split('/[\r\n,]+/', $comp['products']);
                                foreach($product_items as $pi):
                                    $pi = trim($pi);
                                    if(!empty($pi)): ?>
                                        <span class="cp-tag"><i class="fas fa-cube"></i> <?php echo htmlspecialchars($pi); ?></span>
                                    <?php endif; endforeach; ?>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>

        <!-- 3. Our Founder(s) Section -->
        <?php if ($founders && $founders->num_rows > 0): ?>
            <div class="cp-section">
                <h2 class="cp-section-title"><i class="fas fa-user-tie text-primary"></i> Our Founder<?php echo ($founders->num_rows > 1) ? 's' : ''; ?></h2>
                
                <?php while($f = $founders->fetch_assoc()): ?>
                    <div class="cp-founder-card">
                        <?php if (!empty($f['photo'])): ?>
                            <img src="/bm/<?php echo htmlspecialchars($f['photo']); ?>" alt="<?php echo htmlspecialchars($f['name']); ?>" class="cp-founder-photo">
                        <?php else: ?>
                            <div class="cp-founder-photo-placeholder">
                                <?php echo strtoupper(substr($f['name'], 0, 1)); ?>
                            </div>
                        <?php endif; ?>

                        <div class="cp-founder-info" style="flex-grow: 1;">
                            <h3><?php echo htmlspecialchars($f['name']); ?></h3>
                            <div class="designation"><?php echo htmlspecialchars($f['designation'] ?: 'Founder'); ?></div>

                            <div style="display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13.5px; color: #64748b;">
                                <?php if (!empty($f['experience'])): ?>
                                    <span><i class="fas fa-briefcase text-primary me-1"></i> <?php echo htmlspecialchars($f['experience']); ?></span>
                                <?php endif; ?>
                                <?php if (!empty($f['education'])): ?>
                                    <span><i class="fas fa-graduation-cap text-primary me-1"></i> <?php echo htmlspecialchars($f['education']); ?></span>
                                <?php endif; ?>
                            </div>

                            <?php if (!empty($f['short_bio'])): ?>
                                <p style="color: #475569; font-size: 15.5px; line-height: 1.7; margin-bottom: 16px;">
                                    <?php echo nl2br(htmlspecialchars($f['short_bio'])); ?>
                                </p>
                            <?php endif; ?>

                            <div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
                                <?php if (!empty($f['biography'])): ?>
                                    <button class="btn-small" style="padding: 6px 18px; font-size: 13.5px; cursor: pointer; border: none; background: var(--cp-primary); color: white; border-radius: 20px; font-weight: 600;" 
                                            onclick="openBioModal('<?php echo htmlspecialchars(addslashes($f['name'])); ?>', '<?php echo htmlspecialchars(addslashes($f['designation'])); ?>', '<?php echo htmlspecialchars(addslashes(nl2br($f['biography']))); ?>')">
                                        Read Full Biography <i class="fas fa-arrow-right ms-1"></i>
                                    </button>
                                <?php endif; ?>
                                <?php if (!empty($f['linkedin_url'])): ?>
                                    <a href="<?php echo htmlspecialchars($f['linkedin_url']); ?>" target="_blank" rel="noopener noreferrer" style="color: #0077b5; font-size: 20px; text-decoration: none; padding: 4px;" title="LinkedIn Profile">
                                        <i class="fab fa-linkedin"></i>
                                    </a>
                                <?php endif; ?>
                                <?php if (!empty($f['email'])): ?>
                                    <a href="mailto:<?php echo htmlspecialchars($f['email']); ?>" style="color: var(--cp-accent); font-size: 19px; text-decoration: none; padding: 4px;" title="Email">
                                        <i class="fas fa-envelope"></i>
                                    </a>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endwhile; ?>
            </div>
        <?php endif; ?>

        <!-- 4. Our Directors Section -->
        <?php if ($directors && $directors->num_rows > 0): ?>
            <div class="cp-section">
                <h2 class="cp-section-title"><i class="fas fa-users-cog text-primary"></i> Board of Directors</h2>
                
                <div class="cp-directors-grid">
                    <?php while($d = $directors->fetch_assoc()): ?>
                        <div class="cp-director-card">
                            <?php if (!empty($d['photo'])): ?>
                                <img src="/bm/<?php echo htmlspecialchars($d['photo']); ?>" alt="<?php echo htmlspecialchars($d['name']); ?>" class="cp-director-photo">
                            <?php else: ?>
                                <div class="cp-director-photo-placeholder">
                                    <?php echo strtoupper(substr($d['name'], 0, 1)); ?>
                                </div>
                            <?php endif; ?>

                            <h3 class="cp-director-name"><?php echo htmlspecialchars($d['name']); ?></h3>
                            <div class="cp-director-designation"><?php echo htmlspecialchars($d['designation'] ?: 'Director'); ?></div>
                            <?php if (!empty($d['director_type'])): ?>
                                <div><span class="cp-director-type"><?php echo htmlspecialchars($d['director_type']); ?></span></div>
                            <?php endif; ?>

                            <?php if (!empty($d['education']) || !empty($d['experience'])): ?>
                                <div style="font-size: 13px; color: #64748b; margin-bottom: 12px;">
                                    <?php if (!empty($d['education'])): ?>
                                        <div><i class="fas fa-graduation-cap me-1 text-primary"></i> <?php echo htmlspecialchars($d['education']); ?></div>
                                    <?php endif; ?>
                                    <?php if (!empty($d['experience'])): ?>
                                        <div><i class="fas fa-briefcase me-1 text-primary"></i> <?php echo htmlspecialchars($d['experience']); ?></div>
                                    <?php endif; ?>
                                </div>
                            <?php endif; ?>

                            <?php if (!empty($d['short_bio'])): ?>
                                <p style="color: #475569; font-size: 14px; line-height: 1.6; margin-bottom: 16px; flex-grow: 1;">
                                    <?php echo nl2br(htmlspecialchars($d['short_bio'])); ?>
                                </p>
                            <?php endif; ?>

                            <div style="margin-top: auto; display: flex; justify-content: center; gap: 10px; align-items: center;">
                                <?php if (!empty($d['biography'])): ?>
                                    <button style="padding: 6px 16px; font-size: 13px; cursor: pointer; border: 1px solid var(--cp-primary); background: transparent; color: var(--cp-primary); border-radius: 20px; font-weight: 600;"
                                            onclick="openBioModal('<?php echo htmlspecialchars(addslashes($d['name'])); ?>', '<?php echo htmlspecialchars(addslashes($d['designation'])); ?>', '<?php echo htmlspecialchars(addslashes(nl2br($d['biography']))); ?>')">
                                        View Biography
                                    </button>
                                <?php endif; ?>
                                <?php if (!empty($d['linkedin_url'])): ?>
                                    <a href="<?php echo htmlspecialchars($d['linkedin_url']); ?>" target="_blank" rel="noopener noreferrer" style="color: #0077b5; font-size: 18px;">
                                        <i class="fab fa-linkedin"></i>
                                    </a>
                                <?php endif; ?>
                            </div>
                        </div>
                    <?php endwhile; ?>
                </div>
            </div>
        <?php endif; ?>

        <!-- 5. Corporate & Legal Information -->
        <div class="cp-section">
            <h2 class="cp-section-title"><i class="fas fa-file-contract text-primary"></i> Corporate & Registration Details</h2>
            
            <div class="cp-info-grid">
                <?php if (!empty($comp['legal_name'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Full Legal Name</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['legal_name']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['company_type'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Company Type / Structure</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['company_type']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['cin'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Corporate Identification No. (CIN)</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['cin']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['registration_no'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Registration / ROC No.</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['registration_no']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['gst_no'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">GST Identification Number</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['gst_no']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['pan'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Permanent Account Number (PAN)</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['pan']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['tan'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Tax Deduction Account (TAN)</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['tan']); ?></div>
                    </div>
                <?php endif; ?>

                <?php if (!empty($comp['year_established'])): ?>
                    <div class="cp-info-item">
                        <div class="cp-info-label">Incorporation / Estd. Year</div>
                        <div class="cp-info-value"><?php echo htmlspecialchars($comp['year_established']); ?></div>
                    </div>
                <?php endif; ?>
            </div>
        </div>

        <!-- 6. Certifications & Recognitions -->
        <?php if (!empty($comp['certifications']) || !empty($comp['awards'])): ?>
            <div class="cp-section">
                <h2 class="cp-section-title"><i class="fas fa-award text-primary"></i> Certifications & Recognitions</h2>
                <div style="display: flex; flex-wrap: wrap; gap: 24px;">
                    <?php if (!empty($comp['certifications'])): ?>
                        <div style="flex: 1 1 300px; background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid #eef2f6;">
                            <h3 style="font-size: 16px; font-weight: 700; color: var(--cp-primary); margin-bottom: 10px;"><i class="fas fa-medal text-warning me-2"></i> Certifications</h3>
                            <p style="color: #475569; font-size: 15px; line-height: 1.6; margin-bottom: 0;">
                                <?php echo nl2br(htmlspecialchars($comp['certifications'])); ?>
                            </p>
                        </div>
                    <?php endif; ?>

                    <?php if (!empty($comp['awards'])): ?>
                        <div style="flex: 1 1 300px; background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid #eef2f6;">
                            <h3 style="font-size: 16px; font-weight: 700; color: var(--cp-accent); margin-bottom: 10px;"><i class="fas fa-trophy text-warning me-2"></i> Awards & Honors</h3>
                            <p style="color: #475569; font-size: 15px; line-height: 1.6; margin-bottom: 0;">
                                <?php echo nl2br(htmlspecialchars($comp['awards'])); ?>
                            </p>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>

        <!-- 7. Registered Office & Contact Details -->
        <div class="cp-section" style="background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);">
            <h2 class="cp-section-title"><i class="fas fa-map-marked-alt text-primary"></i> Official Contact Information</h2>
            
            <div style="display: flex; flex-wrap: wrap; gap: 24px;">
                <div style="flex: 1 1 320px;">
                    <div style="font-weight: 700; color: var(--cp-primary); margin-bottom: 6px;"><i class="fas fa-building me-2 text-primary"></i> Registered Office Address:</div>
                    <p style="color: #475569; font-size: 15.5px; line-height: 1.6; margin-bottom: 14px;">
                        <?php echo !empty($comp['address']) ? nl2br(htmlspecialchars($comp['address'])) : 'Corporate Headquarters'; ?>
                        <?php if(!empty($comp['city']) || !empty($comp['state']) || !empty($comp['pincode'])): ?>
                            <br>
                            <?php 
                            $loc = array_filter([$comp['city'], $comp['state'], $comp['country'], $comp['pincode']]);
                            echo htmlspecialchars(implode(', ', $loc));
                            ?>
                        <?php endif; ?>
                    </p>
                </div>

                <div style="flex: 1 1 280px;">
                    <?php if (!empty($comp['phone'])): ?>
                        <div style="margin-bottom: 12px;">
                            <div style="font-size: 12px; text-transform: uppercase; color: var(--cp-muted); font-weight: 600;">Phone / Contact</div>
                            <div style="font-size: 16px; font-weight: 700; color: var(--cp-dark);"><i class="fas fa-phone-alt text-success me-2"></i><?php echo htmlspecialchars($comp['phone']); ?></div>
                        </div>
                    <?php endif; ?>

                    <?php if (!empty($comp['email'])): ?>
                        <div style="margin-bottom: 12px;">
                            <div style="font-size: 12px; text-transform: uppercase; color: var(--cp-muted); font-weight: 600;">Official Email</div>
                            <div style="font-size: 16px; font-weight: 700; color: var(--cp-dark);"><i class="fas fa-envelope text-primary me-2"></i><a href="mailto:<?php echo htmlspecialchars($comp['email']); ?>" style="color: var(--cp-primary); text-decoration: none;"><?php echo htmlspecialchars($comp['email']); ?></a></div>
                        </div>
                    <?php endif; ?>

                    <?php if (!empty($comp['website_url'])): ?>
                        <div>
                            <div style="font-size: 12px; text-transform: uppercase; color: var(--cp-muted); font-weight: 600;">Official Website</div>
                            <div style="font-size: 16px; font-weight: 700;"><i class="fas fa-globe text-info me-2"></i><a href="<?php echo htmlspecialchars($comp['website_url']); ?>" target="_blank" style="color: var(--cp-accent); text-decoration: none;"><?php echo htmlspecialchars($comp['website_url']); ?></a></div>
                        </div>
                    <?php endif; ?>
                </div>

                <div style="flex: 1 1 200px; display: flex; align-items: center; justify-content: center;">
                    <a href="/bm/contact" class="showcase-btn" style="padding: 12px 28px; font-size: 15px;">
                        <i class="fas fa-paper-plane"></i> Contact Balimeen
                    </a>
                </div>
            </div>
        </div>

    </div>
</div>

<!-- Biography Detail Modal -->
<div class="cp-bio-modal" id="bioModal" onclick="closeBioModal(event)">
    <div class="cp-bio-modal-content" onclick="event.stopPropagation()">
        <button class="cp-bio-modal-close" onclick="closeBioModal(event)">&times;</button>
        <h3 id="modalLeaderName" style="color: var(--cp-primary); font-size: 24px; font-weight: 800; margin-bottom: 4px;"></h3>
        <div id="modalLeaderDesig" style="color: var(--cp-accent); font-size: 15px; font-weight: 600; margin-bottom: 20px;"></div>
        <div id="modalLeaderBio" style="color: #334155; font-size: 15.5px; line-height: 1.8; text-align: left;"></div>
    </div>
</div>

<script>
    function openBioModal(name, desig, bioHtml) {
        document.getElementById('modalLeaderName').textContent = name;
        document.getElementById('modalLeaderDesig').textContent = desig;
        document.getElementById('modalLeaderBio').innerHTML = bioHtml;
        
        let m = document.getElementById('bioModal');
        m.classList.add('active');
    }

    function closeBioModal(e) {
        if(e) e.preventDefault();
        let m = document.getElementById('bioModal');
        m.classList.remove('active');
    }
</script>

<?php include 'includes/footer.php'; ?>
