<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= esc($title ?? 'TibaLeta') ?></title>
<meta name="description" content="<?= esc($metaDescription ?? 'TibaLeta connects patients with verified healthcare professionals for care at home.') ?>">
<meta name="theme-color" content="#087F75"><link rel="manifest" href="/manifest.webmanifest"><link rel="icon" href="/assets/images/tibaleta-mark.svg" type="image/svg+xml">
<meta property="og:title" content="<?= esc($title ?? 'TibaLeta') ?>"><meta property="og:description" content="<?= esc($metaDescription ?? 'Healthcare that comes to you.') ?>"><meta property="og:type" content="website">
<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@400;500;600;700&family=Manrope:wght@600;700;800&display=swap" rel="stylesheet">
<?php if(is_file(FCPATH.'assets/css/tailwind.build.css')): ?><link rel="stylesheet" href="/assets/css/tailwind.build.css"><?php else: ?><script src="https://cdn.tailwindcss.com"></script><script>tailwind.config={theme:{extend:{colors:{teal:{50:'#E8F7F3',600:'#087F75',700:'#076B63'},navy:'#102A43',cream:'#FAFAF7',coral:'#FF766D'},fontFamily:{sans:['Inter','sans-serif'],display:['Manrope','sans-serif']}}}}</script><?php endif; ?>
<link rel="stylesheet" href="/assets/css/tibaleta.css">
<script src="https://unpkg.com/lucide@0.468.0/dist/umd/lucide.min.js" defer></script>
<script src="/assets/js/tibaleta.js" defer></script>
<script type="application/ld+json"><?= json_encode(["@context"=>"https://schema.org","@type"=>"Organization","name"=>"TibaLeta","url"=>base_url(),"description"=>"A platform for coordinated healthcare at home.","logo"=>base_url('assets/images/tibaleta-mark.svg')], JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) ?></script>
</head>
<body class="antialiased">
<header class="sticky top-0 z-40 border-b border-slate-100 bg-white/95 backdrop-blur">
  <div class="mx-auto flex h-20 max-w-7xl items-center justify-between px-5 lg:px-8">
    <a href="/" class="flex items-center gap-2"><img src="/assets/images/tibaleta-mark.svg" class="h-10 w-10" alt="TibaLeta"><span class="font-display text-xl font-extrabold tracking-tight text-navy">TibaLeta</span></a>
    <nav class="hidden items-center gap-7 text-sm font-semibold text-slate-600 lg:flex">
      <a class="hover:text-teal-600" href="/">Home</a><a class="hover:text-teal-600" href="/find-care">Find Care</a><a class="hover:text-teal-600" href="/services">Services</a><a class="hover:text-teal-600" href="/how-it-works">How It Works</a><a class="hover:text-teal-600" href="/for-practitioners">For Practitioners</a><a class="hover:text-teal-600" href="/resources">Resources</a>
    </nav>
    <div class="flex items-center gap-3">
      <?php if($authUser ?? null): ?>
        <a href="<?= in_array($authUser['role'],['admin','operations'])?'/admin':($authUser['role']==='practitioner'?'/practitioner':($authUser['role']==='partner'?'/partner':'/patient')) ?>" class="hidden text-sm font-semibold text-slate-700 sm:block">Dashboard</a>
      <?php else: ?><a href="/login" class="hidden text-sm font-semibold text-slate-700 sm:block">Log in</a><?php endif; ?>
      <a href="<?= ($authUser['role'] ?? null)==='patient'?'/patient/request-care':'/find-care' ?>" class="rounded-xl bg-teal-600 px-4 py-2.5 text-sm font-bold text-white shadow-sm transition hover:bg-teal-700">Request Care</a>
    </div>
  </div>
</header>
<?php foreach(['success'=>'bg-emerald-50 text-emerald-800 border-emerald-200','warning'=>'bg-amber-50 text-amber-800 border-amber-200','error'=>'bg-rose-50 text-rose-800 border-rose-200'] as $type=>$classes): if(session()->getFlashdata($type)): ?>
<div role="alert" class="mx-auto mt-4 flex max-w-7xl items-center justify-between rounded-xl border px-4 py-3 text-sm <?= $classes ?>"><span><?= esc(session()->getFlashdata($type)) ?></span><button data-dismiss aria-label="Dismiss">×</button></div>
<?php endif; endforeach; ?>
<main><?= view($view, get_defined_vars()) ?></main>
<footer class="border-t border-slate-100 bg-navy text-white">
 <div class="mx-auto grid max-w-7xl gap-10 px-5 py-14 md:grid-cols-2 lg:grid-cols-5 lg:px-8">
  <div class="lg:col-span-2"><div class="flex items-center gap-2"><img src="/assets/images/tibaleta-mark.svg" class="h-10 w-10" alt=""><span class="font-display text-xl font-extrabold">TibaLeta</span></div><p class="mt-4 max-w-sm text-sm leading-6 text-slate-300">Professional healthcare at home, coordinated around patients and families.</p></div>
  <div><h3 class="font-bold">Care</h3><div class="mt-4 space-y-3 text-sm text-slate-300"><a class="block hover:text-white" href="/find-care">Find Care</a><a class="block hover:text-white" href="/services">Services</a><a class="block hover:text-white" href="/how-it-works">How it works</a></div></div>
  <div><h3 class="font-bold">TibaLeta</h3><div class="mt-4 space-y-3 text-sm text-slate-300"><a class="block hover:text-white" href="/about">About</a><a class="block hover:text-white" href="/for-practitioners">Practitioners</a><a class="block hover:text-white" href="/partners">Partners</a></div></div>
  <div><h3 class="font-bold">Support</h3><div class="mt-4 space-y-3 text-sm text-slate-300"><a class="block hover:text-white" href="/faq">FAQ</a><a class="block hover:text-white" href="/contact">Contact</a><a class="block hover:text-white" href="/privacy">Privacy</a><a class="block hover:text-white" href="/terms">Terms</a></div></div>
 </div><div class="border-t border-white/10"><div class="mx-auto flex max-w-7xl flex-col gap-2 px-5 py-6 text-xs text-slate-400 sm:flex-row sm:items-center sm:justify-between lg:px-8"><span>© <?= date('Y') ?> TibaLeta. All rights reserved.</span><span>Routine home care is not a substitute for emergency services.</span></div></div>
</footer>
<script>window.addEventListener('DOMContentLoaded',()=>{if(window.lucide) lucide.createIcons()})</script>
</body></html>
