<?php
// Load site config — config.php lives one level up from /includes/
require_once dirname(__DIR__) . '/config.php';
$current_page = basename($_SERVER['PHP_SELF'], '.php');
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?php echo isset($page_title) ? $page_title : SITE_NAME . ' | ' . SITE_TAGLINE; ?></title>
  <meta name="description" content="<?php echo isset($page_desc) ? $page_desc : SITE_TAGLINE; ?>">
  <meta name="keywords" content="domain registration, domain registration india, low cost domain registration, domain registration company, IN accredited domain registrar">

  <?php
    $og_title = isset($page_title) ? $page_title : SITE_NAME . ' | ' . SITE_TAGLINE;
    $og_desc  = isset($page_desc)  ? $page_desc  : SITE_TAGLINE;
    $og_url   = SITE_URL . '/' . basename($_SERVER['PHP_SELF']);
    $og_image = defined('OG_IMAGE') ? OG_IMAGE : '';
  ?>
  <!-- Open Graph / Facebook / WhatsApp -->
  <meta property="og:type"        content="website">
  <meta property="og:site_name"   content="<?php echo SITE_NAME; ?>">
  <meta property="og:url"         content="<?php echo $og_url; ?>">
  <meta property="og:title"       content="<?php echo htmlspecialchars($og_title); ?>">
  <meta property="og:description" content="<?php echo htmlspecialchars($og_desc); ?>">
  <?php if($og_image): ?>
  <meta property="og:image"       content="<?php echo $og_image; ?>">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <?php endif; ?>

  <!-- Twitter Card -->
  <meta name="twitter:card"        content="summary_large_image">
  <meta name="twitter:title"       content="<?php echo htmlspecialchars($og_title); ?>">
  <meta name="twitter:description" content="<?php echo htmlspecialchars($og_desc); ?>">
  <?php if($og_image): ?>
  <meta name="twitter:image"       content="<?php echo $og_image; ?>">
  <?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=Nunito:wght@400;500;600;700;800&family=Open+Sans:ital,wght@0,400;0,500;0,700;1,600&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="page-wrapper">

<!-- Sticky Header -->
<header class="site-header" id="siteHeader">
  <div class="topbar">
    <div class="container">
      <div class="topbar-left">
        <p><i class="fas fa-check-circle me-1"></i><?php echo SITE_TAGLINE; ?> accredited by .IN Registry</p>
      </div>
      <div class="topbar-right">
        <a href="mailto:<?php echo EMAIL_SALES; ?>"><i class="fas fa-envelope"></i> <?php echo EMAIL_SALES; ?></a>
        <a href="<?php echo CLIENT_AREA_URL; ?>" target="_blank"><i class="fas fa-user"></i> Client Area</a>
      </div>
    </div>
  </div>
  <div id="header-wrap">
    <div class="container">
      <div class="row">
        <div class="col">
          <nav class="navbar navbar-expand-lg p-1 bg-white">
            <!-- Logo -->
            <a class="navbar-brand logo" href="index.php">
              <?php if(defined('LOGO_URL') && LOGO_URL !== ''): ?>
                <img src="<?php echo LOGO_URL; ?>" alt="<?php echo SITE_NAME; ?>" class="site-logo-img">
              <?php else: ?>
                <svg width="160" height="40" viewBox="0 0 160 40" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="<?php echo SITE_NAME; ?>">
                  <rect width="38" height="38" rx="9" fill="#1a56db"/>
                  <text x="7" y="28" font-family="Nunito,sans-serif" font-size="22" font-weight="800" fill="white">D</text>
                  <text x="44" y="28" font-family="Nunito,sans-serif" font-size="22" font-weight="800" fill="#1a56db">domains</text>
                </svg>
              <?php endif; ?>
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>
            <div class="in-accredited d-none d-sm-block ms-3">
              <small class="accredited-badge"><i class="fas fa-certificate me-1"></i>.IN Accredited Registrar</small>
            </div>
            <div class="collapse navbar-collapse" id="navbarNav">
              <ul class="navbar-nav ms-lg-auto">
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='index' ? 'active' : ''; ?>" href="index.php"><i class="fas fa-home me-1"></i>Home</a></li>
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='domain' ? 'active' : ''; ?>" href="domain.php"><i class="fas fa-globe me-1"></i>Domains</a></li>
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='web-hosting' ? 'active' : ''; ?>" href="web-hosting.php"><i class="fas fa-server me-1"></i>Web Hosting</a></li>
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='vps-hosting' ? 'active' : ''; ?>" href="vps-hosting.php"><i class="fas fa-hdd me-1"></i>VPS Hosting</a></li>
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='email-hosting' ? 'active' : ''; ?>" href="email-hosting.php"><i class="fas fa-envelope me-1"></i>eMail Hosting</a></li>
                <li class="nav-item"><a class="nav-link <?php echo $current_page=='contact' ? 'active' : ''; ?>" href="contact.php"><i class="fas fa-phone me-1"></i>Contact Us</a></li>
              </ul>
            </div>
          </nav>
        </div>
      </div>
    </div>
  </div>
</header>
<!-- Header End -->

<script>
  (function(){
    var header = document.getElementById('siteHeader');
    window.addEventListener('scroll', function(){
      header.classList.toggle('scrolled', window.pageYOffset > 60);
    }, { passive: true });
  })();
</script>
