<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title><?= htmlspecialchars($settings['site_name'] ?? 'Alpha Genomics') ?></title>
    <?php if (!empty($settings['site_favicon'])): ?>
    <link rel="icon" type="image/png" href="<?= htmlspecialchars($settings['site_favicon']) ?>">
    <link rel="shortcut icon" href="<?= htmlspecialchars($settings['site_favicon']) ?>">
    <?php endif; ?>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    <link rel="stylesheet" href="/assets/css/style.css">
</head>
<body>
    <div class="top-bar">
        <div class="container">
            <div class="top-bar-left">
                <span><i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($settings['address'] ?? '') ?></span>
                <span><i class="fas fa-envelope"></i> <a href="mailto:<?= htmlspecialchars($settings['email'] ?? '') ?>"><?= htmlspecialchars($settings['email'] ?? '') ?></a></span>
                <span><i class="fas fa-phone"></i> <?= htmlspecialchars($settings['phone'] ?? '') ?></span>
            </div>
            <div class="top-bar-right">
                <a href="<?= htmlspecialchars($settings['facebook_url'] ?? '#') ?>" title="Facebook" target="_blank" rel="noopener"><i class="fab fa-facebook-f"></i></a>
                <a href="<?= htmlspecialchars($settings['twitter_url'] ?? '#') ?>" title="Twitter" target="_blank" rel="noopener"><i class="fab fa-twitter"></i></a>
                <a href="<?= htmlspecialchars($settings['linkedin_url'] ?? '#') ?>" title="LinkedIn" target="_blank" rel="noopener"><i class="fab fa-linkedin-in"></i></a>
                <a href="<?= htmlspecialchars($settings['youtube_channel'] ?? '#') ?>" title="YouTube" target="_blank" rel="noopener"><i class="fab fa-youtube"></i></a>
                <a href="/admin/login" class="top-bar-admin" title="Admin Login"><i class="fas fa-lock"></i> ADMIN</a>
            </div>
        </div>
    </div>
    <header class="main-header">
        <div class="header-inner">
            <div class="container">
                <a href="/" class="logo">
                    <?php if (!empty($settings['site_logo'])): ?>
                    <img src="<?= htmlspecialchars($settings['site_logo']) ?>" alt="<?= htmlspecialchars($settings['site_name'] ?? 'Alpha Genomics') ?>" class="logo-img">
                    <?php else: ?>
                    <div class="logo-icon">AG</div>
                    <div class="logo-text">
                        <h1><?= htmlspecialchars($settings['site_name'] ?? 'Alpha Genomics') ?></h1>
                    </div>
                    <?php endif; ?>
                    <span class="logo-divider">|</span>
                    <span class="logo-tagline"><?= htmlspecialchars($settings['site_tagline'] ?? 'Transforming Life Sciences') ?></span>
                </a>
                <nav class="main-nav">
                    <button class="nav-toggle" aria-label="Toggle navigation"><i class="fas fa-bars"></i></button>
                    <ul>
                        <?php $menuItems = getMenuItems(); ?>
                        <?php foreach ($menuItems as $mi): ?>
                        <li class="<?= !empty($mi['children']) ? 'has-dropdown' : '' ?>">
                            <a href="<?= htmlspecialchars($mi['url']) ?>" 
                               target="<?= htmlspecialchars($mi['target'] ?? '_self') ?>"
                               class="<?= rtrim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/') === rtrim($mi['url'], '/') ? 'active' : '' ?>">
                                <?= htmlspecialchars($mi['title']) ?><?php if (!empty($mi['children'])): ?> <i class="fas fa-chevron-down nav-dd-arrow"></i><?php endif; ?>
                            </a>
                            <?php if (!empty($mi['children'])): ?>
                            <ul class="dropdown-menu">
                                <?php foreach ($mi['children'] as $child): ?>
                                <li><a href="<?= htmlspecialchars($child['url']) ?>" target="<?= htmlspecialchars($child['target'] ?? '_self') ?>"><?= htmlspecialchars($child['title']) ?></a></li>
                                <?php endforeach; ?>
                            </ul>
                            <?php endif; ?>
                        </li>
                        <?php endforeach; ?>
                    </ul>
                </nav>
            </div>
        </div>
        <div class="header-border"></div>
    </header>
    <div class="nav-backdrop"></div>
