<?php
/**
 * Public Website Header — shared across all public pages.
 * Usage: Set $pageTitle before including, then call getSetting() anywhere.
 */
// settings-helper.php is auto-prepended by .htaccess/.user.ini — fallback if not
if (!function_exists('getSetting')) { require_once __DIR__ . '/settings-helper.php'; }
$siteName = getSetting('site_name', 'Deutsche Bank Holdings Delaware');
$logo = getSetting('logo_path', 'logo.png');
$favicon = getSetting('favicon_path', 'logo.png');
$logoVersion = file_exists($logo) ? '?v=' . filemtime($logo) : '';
$securityNotice = getSetting('security_notice', 'We will never ask for your password, PIN, or one-time code via phone, email, or text.');
?><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><?= htmlspecialchars($pageTitle ?? $siteName) ?></title>
  <link rel="icon" type="image/png" href="<?= htmlspecialchars($favicon) ?>">
  <meta name="theme-color" content="#033d75">
  <link rel="stylesheet" href="plugin/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" href="plugin/fontawesome/css/all.min.css">
  <link rel="stylesheet" href="assets/css/landing.css">
  <?php
  $orgName = getSetting('site_name', 'Deutsche Bank Holdings Delaware');
  $orgPhone = getSetting('contact_phone', '+1 (800) 555-0199');
  $orgEmail = getSetting('contact_email', 'support@whitestonetrustcu.com');
  $orgAddress = getSetting('office_address', '1209 Orange Street, Wilmington, DE 19801');
  ?>
  <script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "Organization",
    "name": "<?= htmlspecialchars($orgName, ENT_QUOTES, 'UTF-8') ?>",
    "url": "https://whitestonetrustcu.com",
    "logo": "https://whitestonetrustcu.com/logo.png",
    "contactPoint": {
      "@type": "ContactPoint",
      "telephone": "<?= htmlspecialchars($orgPhone, ENT_QUOTES, 'UTF-8') ?>",
      "contactType": "customer service",
      "email": "<?= htmlspecialchars($orgEmail, ENT_QUOTES, 'UTF-8') ?>"
    },
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "<?= htmlspecialchars($orgAddress, ENT_QUOTES, 'UTF-8') ?>"
    }
    <?php
    $socials = [];
    if (getSetting('facebook_url')) $socials[] = getSetting('facebook_url');
    if (getSetting('twitter_url')) $socials[] = getSetting('twitter_url');
    if (getSetting('linkedin_url')) $socials[] = getSetting('linkedin_url');
    if (getSetting('instagram_url')) $socials[] = getSetting('instagram_url');
    if (!empty($socials)) {
        echo ",\n    \"sameAs\": [\n";
        $last = array_pop($socials);
        foreach ($socials as $s) {
            echo '      "' . htmlspecialchars($s, ENT_QUOTES, 'UTF-8') . "\",\n";
        }
        echo '      "' . htmlspecialchars($last, ENT_QUOTES, 'UTF-8') . "\"\n    ]\n";
    }
    ?>
  }
  </script>
</head>
<body>
<div class="db-utility">
  <div class="db-utility-inner">
    <ul class="db-utility-links">
      <li><a href="personal-banking">Personal</a></li>
      <li><a href="business-banking">Business</a></li>
      <li><a href="help-centre">Help</a></li>
      <li><a href="security-centre">Security</a></li>
      <li><a href="contact">Contact</a></li>
    </ul>
    <div class="db-utility-right">
      <a href="about-us">About Us</a>
      <a href="careers">Careers</a>
      <a href="investor-relations">Investor Relations</a>
    </div>
  </div>
</div>

<header class="db-header" role="banner">
  <div class="db-header-inner">
    <a href="index" class="db-header-logo" aria-label="<?= htmlspecialchars($siteName) ?> - Home">
      <img src="<?= htmlspecialchars($logo) ?><?= $logoVersion ?>" alt="<?= htmlspecialchars($siteName) ?>" width="160" height="40">
    </a>
    <nav class="db-nav" aria-label="Main navigation">
      <ul class="db-nav-list">
        <li class="db-mega-toggle">
          <a href="personal-banking" class="db-nav-link">Personal</a>
          <div class="db-mega-panel">
            <div class="db-mega-grid">
              <div class="db-mega-col"><h4>Accounts</h4><ul><li><a href="accounts"><i class="fas fa-university"></i> Accounts Overview</a></li><li><a href="checking-account"><i class="fas fa-wallet"></i> Current Accounts</a></li><li><a href="savings-account"><i class="fas fa-piggy-bank"></i> Savings Accounts</a></li><li><a href="account-comparison"><i class="fas fa-balance-scale"></i> Compare Accounts</a></li><li><a href="open-account"><i class="fas fa-user-plus"></i> Open an Account</a></li></ul></div>
              <div class="db-mega-col"><h4>Payments &amp; Transfers</h4><ul><li><a href="transfers"><i class="fas fa-exchange-alt"></i> Money Transfers</a></li><li><a href="local-transfers"><i class="fas fa-arrow-right"></i> Local Transfers</a></li><li><a href="international-transfers"><i class="fas fa-globe"></i> International</a></li><li><a href="bill-payments"><i class="fas fa-file-invoice"></i> Bill Payments</a></li></ul></div>
              <div class="db-mega-col"><h4>Cards</h4><ul><li><a href="cards"><i class="fas fa-credit-card"></i> Cards Overview</a></li><li><a href="debit-cards"><i class="fas fa-credit-card"></i> Debit Cards</a></li><li><a href="virtual-cards"><i class="fas fa-mobile-alt"></i> Virtual Cards</a></li><li><a href="card-security"><i class="fas fa-shield-alt"></i> Card Security</a></li></ul></div>
            </div>
            <div class="db-mega-cta"><p>New to <?= htmlspecialchars($siteName) ?>?</p><a href="open-account" class="db-btn db-btn-primary db-btn-sm">Open an Account</a></div>
          </div>
        </li>
        <li class="db-mega-toggle">
          <a href="business-banking" class="db-nav-link">Business</a>
          <div class="db-mega-panel">
            <div class="db-mega-grid">
              <div class="db-mega-col"><h4>Business Banking</h4><ul><li><a href="business-banking"><i class="fas fa-briefcase"></i> Business Overview</a></li><li><a href="business-account"><i class="fas fa-building"></i> Business Accounts</a></li><li><a href="corporate-bank"><i class="fas fa-city"></i> Corporate Banking</a></li><li><a href="open-account"><i class="fas fa-user-plus"></i> Open an Account</a></li></ul></div>
              <div class="db-mega-col"><h4>Business Services</h4><ul><li><a href="transfers"><i class="fas fa-exchange-alt"></i> Business Transfers</a></li><li><a href="bill-payments"><i class="fas fa-file-invoice"></i> Payments</a></li></ul></div>
              <div class="db-mega-col"><h4>Support</h4><ul><li><a href="help-centre"><i class="fas fa-question-circle"></i> Help Centre</a></li><li><a href="customer-support"><i class="fas fa-headset"></i> Business Support</a></li></ul></div>
            </div>
          </div>
        </li>
        <li><a href="digital-banking" class="db-nav-link">Digital Banking</a></li>
        <li><a href="banking-insights" class="db-nav-link">Insights</a></li>
        <li><a href="security-centre" class="db-nav-link">Security</a></li>
        <li><a href="help-centre" class="db-nav-link">Help</a></li>
        <li><a href="about-us" class="db-nav-link">About</a></li>
      </ul>
    </nav>
    <div class="db-header-actions">
      <div class="db-search"><i class="fas fa-search"></i><input type="search" placeholder="Search..." aria-label="Search the website"></div>
      <a href="account/login" class="db-btn db-btn-outline db-btn-sm">Log In</a>
      <a href="account/register" class="db-btn db-btn-primary db-btn-sm">Open Account</a>
    </div>
    <button class="db-nav-toggle" aria-label="Toggle navigation menu" aria-expanded="false">
      <span></span><span></span><span></span>
    </button>
  </div>
</header>

<div class="db-mobile-menu" role="dialog" aria-label="Mobile navigation">
  <div class="db-mobile-nav-section"><button class="db-mobile-nav-title">Personal Banking <i class="fas fa-chevron-down"></i></button><div class="db-mobile-nav-links"><a href="personal-banking">Personal Overview</a><a href="accounts">Accounts</a><a href="transfers">Transfers</a><a href="cards">Cards</a><a href="open-account">Open an Account</a></div></div>
  <div class="db-mobile-nav-section"><button class="db-mobile-nav-title">Business Banking <i class="fas fa-chevron-down"></i></button><div class="db-mobile-nav-links"><a href="business-banking">Business Overview</a><a href="business-account">Business Accounts</a><a href="corporate-bank">Corporate Banking</a><a href="open-account">Open an Account</a></div></div>
  <a href="digital-banking" class="db-mobile-nav-title" style="display:flex;align-items:center;text-decoration:none;width:100%;border-bottom:1px solid var(--db-gray-100);">Digital Banking</a>
  <a href="banking-insights" class="db-mobile-nav-title" style="display:flex;align-items:center;text-decoration:none;width:100%;border-bottom:1px solid var(--db-gray-100);">Insights</a>
  <a href="security-centre" class="db-mobile-nav-title" style="display:flex;align-items:center;text-decoration:none;width:100%;border-bottom:1px solid var(--db-gray-100);">Security</a>
  <a href="help-centre" class="db-mobile-nav-title" style="display:flex;align-items:center;text-decoration:none;width:100%;border-bottom:1px solid var(--db-gray-100);">Help</a>
  <a href="about-us" class="db-mobile-nav-title" style="display:flex;align-items:center;text-decoration:none;width:100%;border-bottom:1px solid var(--db-gray-100);">About Us</a>
  <div class="db-header-actions" style="display:flex;flex-direction:column;margin-top:var(--db-space-6);padding:var(--db-space-6);gap:var(--db-space-3);">
    <a href="account/login" class="db-btn db-btn-outline" style="width:100%;justify-content:center;">Log In</a>
    <a href="account/register" class="db-btn db-btn-primary" style="width:100%;justify-content:center;">Open Account</a>
  </div>
</div>

<!-- Security Announcement -->
<div class="db-announcement">
  <span><i class="fas fa-shield-alt"></i> <strong>Security Notice:</strong> <?= htmlspecialchars($securityNotice) ?> <a href="scam-awareness">Learn how to stay safe</a>.</span>
  <button class="db-announcement-close" aria-label="Close announcement">&times;</button>
</div>
