/* ==========================================================================
   Modern theme: header and menus, shared components and page styling.
   Loaded last so it can refine style.css and responsive.css.
   ========================================================================== */

:root {
    --brand: #1a4d8c;
    --brand-dark: #0b2b4a;
    --brand-soft: #e9f0fa;
    --gold: #d4a017;
    --gold-dark: #b8860b;
    --ink: #1f2933;
    --muted: #5b6878;
    --surface: #ffffff;
    --soft: #f5f7fb;
    --line: #e3e9f1;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 18px 40px -18px rgba(15, 23, 42, 0.28);
}

/* ---------- Base typography and surfaces ---------- */
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { color: var(--brand-dark); font-weight: 700; letter-spacing: -0.015em; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid rgba(212, 160, 23, 0.6); outline-offset: 2px; border-radius: 4px; }
.lead { color: var(--muted); }
.text-muted { color: var(--muted) !important; }

.btn { border-radius: 10px; font-weight: 600; padding: 0.6rem 1.2rem; transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-accent {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none; color: #fff; font-weight: 600; border-radius: 10px;
    padding: 0.55rem 1.1rem;
}
.btn-accent:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(184, 134, 11, 0.6); }

.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.card.shadow-sm, .card.shadow { box-shadow: var(--shadow-sm) !important; }
.form-control, .form-select { border-radius: 10px; border-color: #cfd8e3; padding: 0.6rem 0.85rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(26, 77, 140, 0.12); }
.form-label { font-weight: 600; color: var(--brand-dark); }
.badge { font-weight: 600; letter-spacing: 0.01em; }
.alert { border-radius: 12px; border: 0; box-shadow: var(--shadow-sm); }

section .section-title, .section-title { position: relative; font-weight: 800; }
.section-title::after {
    content: ''; display: block; width: 56px; height: 4px; border-radius: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark)); margin: 0.75rem auto 0;
}
.text-start .section-title::after, .section-title.text-start::after { margin-left: 0; }

/* Headings on coloured or dark panels take the panel's text colour instead of the navy heading colour */
[style*="background"] :is(h1, h2, h3, h4, h5, h6),
[style*="color: white"] :is(h1, h2, h3, h4, h5, h6),
.text-white :is(h1, h2, h3, h4, h5, h6),
.bg-dark :is(h1, h2, h3, h4, h5, h6),
.bg-primary :is(h1, h2, h3, h4, h5, h6),
.footer :is(h1, h2, h3, h4, h5, h6) { color: inherit; }

/* Bootstrap's default blue becomes the hospital navy across the site */
.bg-primary { background-color: var(--brand) !important; }
.text-primary { color: var(--brand) !important; }
.border-primary { border-color: var(--brand) !important; }

/* ---------- Emergency strips ---------- */
.emergency-alert-bar { background: linear-gradient(135deg, #dc3545 0%, #ff6b6b 100%); border-bottom: 3px solid #ffc107; color: #fff; }

/* ---------- Header ---------- */
.site-header { z-index: 1030; background: var(--surface); transition: box-shadow 0.3s ease; }
.site-header.scrolled { box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.35); }

.topbar {
    background: linear-gradient(90deg, var(--brand-dark) 0%, var(--brand) 100%);
    color: #dbe7f5; font-size: 0.85rem;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { color: var(--gold); }
.topbar .pill {
    background: rgba(255, 255, 255, 0.12); border-radius: 999px;
    padding: 0.3rem 0.8rem; display: inline-flex; align-items: center; gap: 0.4rem;
}
.topbar .pill strong { color: #ffd76a; }

.site-nav { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--brand-dark); line-height: 1.15; min-width: 0; }
.brand img { height: 44px; width: auto; flex-shrink: 0; }
.brand-text { font-weight: 800; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-toggle {
    display: inline-flex; align-items: center; gap: 0.45rem;
    border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
    padding: 0.5rem 0.9rem; font-weight: 600; color: var(--brand-dark);
}
.nav-toggle:hover { background: var(--soft); }

/* Menu list, shared by the mobile drawer and the desktop bar */
.site-menu .nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.site-menu .menu-link,
.site-menu .menu-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    width: 100%; padding: 0.75rem 0.95rem; border: 0; background: none; border-radius: 12px;
    color: var(--ink); font-weight: 600; text-decoration: none; text-align: left; font-size: 1rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.site-menu .menu-link:hover,
.site-menu .menu-toggle:hover { background: var(--soft); color: var(--brand); }
.site-menu .menu-link.active,
.site-menu .menu-toggle.active { color: var(--brand); background: var(--brand-soft); }
.site-menu .menu-link.active::after { content: ''; }
.site-menu .menu-toggle .chev { font-size: 0.7rem; color: var(--muted); transition: transform 0.25s ease; }
.site-menu .has-dropdown.open > .menu-toggle .chev { transform: rotate(180deg); }
.site-menu .menu-toggle .label { display: flex; align-items: center; gap: 0.65rem; }
.site-menu .menu-toggle .label i,
.site-menu .menu-link i { width: 18px; text-align: center; color: var(--brand); }

.site-menu .dropdown-panel { display: none; list-style: none; margin: 0.15rem 0 0.4rem; padding: 0; }
.site-menu .has-dropdown.open > .dropdown-panel { display: block; animation: menuIn 0.2s ease; }
.site-menu .dropdown-panel a {
    display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.95rem 0.55rem 2.6rem;
    border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.site-menu .dropdown-panel a i { width: 18px; text-align: center; color: var(--brand); }
.site-menu .dropdown-panel a:hover { background: var(--soft); color: var(--brand); }
.site-menu .dropdown-panel a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.site-menu .menu-footer { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.site-menu .menu-footer .contact-line { display: flex; gap: 0.6rem; align-items: center; color: var(--muted); font-size: 0.92rem; margin-bottom: 0.5rem; }
.site-menu .menu-footer .contact-line i { color: var(--brand); width: 18px; text-align: center; }

/* Mobile and tablet drawer */
.site-menu.offcanvas-end { width: min(88vw, 360px); border-left: 0; box-shadow: var(--shadow-md); }
.site-menu .offcanvas-header { border-bottom: 1px solid var(--line); padding: 1rem 1.2rem; }
.site-menu .offcanvas-title { font-weight: 800; color: var(--brand-dark); }
.site-menu .offcanvas-body { padding: 0.9rem 0.9rem 1.5rem; }

@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Desktop: inline menu with floating dropdown panels */
@media (min-width: 992px) {
    .site-nav .container { flex-wrap: nowrap; }
    /* Bootstrap 5.3.0 only clears the drawer background here, so reset its fixed positioning too. */
    .site-menu.offcanvas-lg {
        position: static; visibility: visible; transform: none; transition: none;
        width: auto; height: auto; max-width: none; flex-grow: 1; border: 0; box-shadow: none; z-index: auto;
    }
    .site-menu.offcanvas-lg .offcanvas-body { display: flex; align-items: center; justify-content: flex-end; padding: 0; }
    .site-menu .nav-list { flex-direction: row; align-items: center; gap: 0.1rem; }
    .site-menu .has-dropdown { position: relative; }
    .site-menu .menu-link,
    .site-menu .menu-toggle { width: auto; padding: 0.55rem 0.8rem; font-size: 0.95rem; border-radius: 10px; }
    .site-menu .menu-link.active::after,
    .site-menu .menu-toggle.active::after {
        content: ''; position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.1rem; height: 2px;
        border-radius: 2px; background: var(--gold);
    }
    .site-menu .menu-toggle, .site-menu .menu-link { position: relative; }
    .site-menu .dropdown-panel {
        position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; z-index: 1040;
        background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow-md); padding: 0.5rem; margin: 0;
    }
    .site-menu .dropdown-panel a { padding: 0.6rem 0.8rem; }
    .site-menu .menu-footer { display: none; }
    .site-menu .offcanvas-header { display: none; }
}

/* ---------- Footer ---------- */
.footer {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
    color: rgba(255, 255, 255, 0.82); margin-top: 0; padding-top: 3.5rem;
}
.footer h5 { color: #fff; font-weight: 700; }
.footer p { color: rgba(255, 255, 255, 0.78); }
.footer a { text-decoration: none; color: rgba(255, 255, 255, 0.82); transition: color 0.2s ease; }
.footer a:hover { color: var(--gold) !important; }
.footer ul li { margin-bottom: 0.45rem; }
.footer .text-white-50 { color: rgba(255, 255, 255, 0.7) !important; }
.footer .border-top, .footer hr { border-color: rgba(255, 255, 255, 0.15) !important; }

.back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; width: 46px; height: 46px; border-radius: 50%; border: 0;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--shadow-md); z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%); transform: translateY(-3px); color: #fff; }

/* ---------- Page-level polish ---------- */
main section:first-of-type { scroll-margin-top: 90px; }
img { border-radius: 0; }
.card img, .img-fluid { border-radius: 0; }
.card-img-top { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
