<?php
// Auto-detect path prefix for sub-directories
$isSubDir = (strpos($_SERVER['PHP_SELF'], '/patient/') !== false || strpos($_SERVER['PHP_SELF'], '/doctor/') !== false || strpos($_SERVER['PHP_SELF'], '/admin/') !== false);
$base = $isSubDir ? '../' : '';
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<style>
.site-footer {
  background: linear-gradient(135deg, #4D8DFF 0%, #1E63E9 45%, #0E3FAE 100%);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 56px 0 0;
  font-family: 'Poppins', sans-serif;
}
.site-footer .footer-logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
  margin-bottom: 14px;
  display: block;
}
.site-footer .footer-desc {
  color: #cce4ff;
  font-size: 13px;
  line-height: 1.75;
  max-width: 260px;
  margin-bottom: 16px;
}
.site-footer .footer-socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.site-footer .footer-socials a {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  display: grid;
  place-items: center;
  color: #94a3b8;
  text-decoration: none;
  transition: all .2s;
  font-size: 12px;
}
.site-footer .footer-socials a:hover { background: rgba(168,85,247,.3); color: #c084fc; }
.site-footer .footer-col-title {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-family: 'Poppins', sans-serif;
}
.site-footer .footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-footer .footer-links a {
  color: #cce4ff;
  text-decoration: none;
  font-size: 13px;
  transition: color .2s;
}
.site-footer .footer-links a:hover,
.site-footer .footer-links a.active-link { color: #c084fc; }
.site-footer .footer-divider {
  border-color: rgba(255,255,255,.08);
  margin: 32px 0 0;
}
.site-footer .footer-bottom {
  padding: 18px 0 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.site-footer .footer-copy {
  color: #e2e8f0;
  font-size: 12px;
  margin: 0 0 6px;
  text-align: center;
}
.site-footer .footer-trademark {
  color: rgba(255,255,255,.45);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto 8px;
}
.site-footer .footer-disclaimer {
  color: rgba(255,255,255,.35);
  font-size: 10.5px;
  text-align: center;
  line-height: 1.65;
  max-width: 820px;
  margin: 0 auto;
}
/* Override index.php global CSS that inflates footer text */
.site-footer p,
.site-footer .footer-desc {
  font-family: 'Poppins', sans-serif !important;
  font-size: 13px !important;
  line-height: 1.75 !important;
  color: #cce4ff !important;
}
.site-footer .footer-copy  { font-size: 12px !important; color: #ffffff !important; margin: 0 !important; font-weight:600 !important; }
.site-footer .footer-trademark { font-size: 12px !important; color: #ffffff !important; margin: 0 !important; font-weight:600 !important; text-align:right !important; white-space:nowrap !important; }
.site-footer .footer-disclaimer { font-size: 10.5px !important; color: rgba(255,255,255,.65) !important; margin: 0 !important; text-align:left !important; line-height:1.7 !important; }
.site-footer h2, .site-footer h3, .site-footer h4, .site-footer h5, .site-footer h6 {
  font-size: unset !important;
  color: #fff !important;
}
.site-footer .footer-col-title {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  margin-bottom: 14px !important;
}
.site-footer .footer-links a {
  font-size: 14px !important;
  color: #cce4ff !important;
}
.site-footer .footer-links a:hover,
.site-footer .footer-links a.active-link { color: #c084fc !important; }
@media (max-width: 767px) {
  .site-footer { padding: 36px 0 0; }
  .site-footer .footer-desc { max-width: 100%; }
  .site-footer .footer-col { margin-bottom: 28px; }
  .site-footer .footer-col:last-child { margin-bottom: 0; }
  .site-footer .container { padding-left: 20px !important; padding-right: 20px !important; }
  .site-footer .footer-logo { padding-left: 12px; }
}
</style>

<footer class="site-footer">
  <div class="container" style="max-width:1140px;">
    <div class="row g-4">

      <!-- Logo + About -->
      <div class="col-12 col-md-4 footer-col">
        <div class="footer-logo">
          <a href="<?= $base ?>index.php">
            <img src="<?= $base ?>DRM.png" alt="DRM HealthLink">
          </a>
        </div>
        <p class="footer-desc">A global healthcare platform powered by CarePoint AI<sup class="tm">™</sup> connecting patients and doctors worldwide through intelligent, accessible care.</p>
        <div class="footer-socials">
          <?php foreach(['fa-facebook-f','fa-twitter','fa-instagram','fa-linkedin-in'] as $ic): ?>
          <a href="#"><i class="fab <?= $ic ?>"></i></a>
          <?php endforeach; ?>
        </div>
      </div>

      <!-- Platform -->
      <div class="col-6 col-md-3 footer-col">
        <div class="footer-col-title">Platform</div>
        <ul class="footer-links">
          <li><a href="<?= $base ?>index.php#concept">The Concept</a></li>
          <li><a href="<?= $base ?>index.php#kiosk">DRM CarePoint<sup class="tm">™</sup> Kiosk</a></li>
          <li><a href="<?= $base ?>index.php#tests">What We Test</a></li>
          <li><a href="<?= $base ?>index.php#technology">DRM CarePoint AI<sup class="tm">™</sup></a></li>
          <li><a href="<?= $base ?>solutions.php" class="<?= $currentPage==='solutions.php'?'active-link':'' ?>">Solutions</a></li>
        </ul>
      </div>

      <!-- Solutions -->
      <div class="col-6 col-md-2 footer-col">
        <div class="footer-col-title">Solutions</div>
        <ul class="footer-links">
          <li><a href="<?= $base ?>solutions.php">Deployment Models</a></li>
          <li><a href="<?= $base ?>solutions.php#serve">Who We Serve</a></li>
          <li><a href="<?= $base ?>contact.php" class="<?= $currentPage==='contact.php'?'active-link':'' ?>">Partner With Us</a></li>
        </ul>
      </div>

      <!-- Legal -->
      <div class="col-6 col-md-3 footer-col">
        <div class="footer-col-title">Legal</div>
        <ul class="footer-links">
          <li><a href="<?= $base ?>privacy.php" class="<?= $currentPage==='privacy.php'?'active-link':'' ?>">Privacy Policy</a></li>
          <li><a href="<?= $base ?>terms.php" class="<?= $currentPage==='terms.php'?'active-link':'' ?>">Terms &amp; Conditions</a></li>
          <li><a href="<?= $base ?>contact.php" class="<?= $currentPage==='contact.php'?'active-link':'' ?>">Contact Us</a></li>
        </ul>
      </div>

    </div>

    <!-- Bottom bar -->
    <div class="footer-bottom mt-4">
      <!-- Row 1: copyright left, trademark right -->
      <div style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:12px;">
        <p class="footer-copy">&copy; <?= date('Y') ?> DRM HealthLink<sup class="tm">™</sup>. All Rights Reserved.</p>
        <p class="footer-trademark">DRM HealthLink<sup class="tm">™</sup>, DRM CarePoint<sup class="tm">™</sup> and DRM CarePoint AI<sup class="tm">™</sup> are trademarks of DRM Pharma &amp; Diagnostic GmbH Germany.</p>
      </div>
      <!-- Row 2: disclaimer full width left-aligned -->
      <p class="footer-disclaimer">DRM HealthLink CarePoint<sup class="tm">™</sup> screening supports early detection and preventive care. It does not replace professional medical diagnosis or emergency services. If you are experiencing a medical emergency, contact your local emergency number immediately. Health data is processed in accordance with our Privacy Policy, the EU General Data Protection Regulation (GDPR), and internationally recognised safeguards aligned with standards such as HIPAA.</p>
    </div>
  </div>
</footer>
