/* ============================================================
   EHR Mirror — Unified data-browser navigation
   Conceptual neighbor: cross-page navigation (the section
   switcher rendered above every EHR mirror page).
   Loaded by: templates/base/bundles/css.html (always — the
   nav partial is included on every EHR mirror page, so the
   stylesheet ships in the global bundle).
   Consumer: templates/ehr_mirror/partials/_ehr_nav.html
   plus the patient banner / "view all" link helpers used by
   patient_detail.html.

   Visual language deliberately mirrors the chip strip in
   ehr-mirror.css (same radii, borders, shadow) so the nav
   reads as a sibling of the filter bar instead of a separate
   paradigm.

   BEM:
     .ehr-nav                       — outer card
     .ehr-nav__group                — one labelled section
     .ehr-nav__group--active        — section containing the current page
     .ehr-nav__group-label          — "Directory", "Activity", etc.
     .ehr-nav__links                — flex row of pill links
     .ehr-nav__link                 — individual link
     .ehr-nav__link--active         — currently-rendered page
     .ehr-detail-viewall            — "View all in browser →" link on
                                      patient_detail section headers
     .ehr-patient-banner            — "Filtered to: <patient>" banner
   ============================================================ */

/* ── Outer container ────────────────────────────────────── */
.ehr-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 1rem;
    background: var(--ehr-bg);
    border: 1px solid var(--ehr-border);
    border-radius: var(--ehr-radius-sm);
    box-shadow: var(--ehr-shadow-sm);
}

/* ── Groups ─────────────────────────────────────────────── */
.ehr-nav__group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.15rem 0.6rem 0.15rem 0;
    border-right: 1px dashed var(--ehr-border);
}

.ehr-nav__group:last-child {
    border-right: 0;
    padding-right: 0;
}

.ehr-nav__group-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ehr-text-muted);
    white-space: nowrap;
}

.ehr-nav__group-label i {
    font-size: 0.82rem;
    opacity: 0.8;
}

.ehr-nav__group--active .ehr-nav__group-label {
    color: var(--ehr-primary);
}

/* ── Link row ───────────────────────────────────────────── */
.ehr-nav__links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ehr-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ehr-text-sub);
    background: var(--ehr-chip-bg);
    border: 1px solid var(--ehr-chip-border);
    border-radius: var(--ehr-radius-pill);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 120ms ease, border-color 120ms ease,
                color 120ms ease, transform 120ms ease;
}

.ehr-nav__link:hover,
.ehr-nav__link:focus-visible {
    color: var(--ehr-text);
    border-color: var(--ehr-border-strong);
    background: var(--ehr-bg-soft);
    transform: translateY(-1px);
}

.ehr-nav__link i {
    font-size: 0.9em;
    opacity: 0.85;
}

.ehr-nav__link--active {
    color: #fff;
    background: var(--ehr-primary);
    border-color: var(--ehr-primary);
    box-shadow: 0 1px 3px rgba(0, 105, 166, 0.25);
}

.ehr-nav__link--active:hover,
.ehr-nav__link--active:focus-visible {
    color: #fff;
    background: var(--ehr-primary);
    border-color: var(--ehr-primary);
    transform: none;
}

.ehr-nav__link--active i {
    opacity: 1;
}

/* ── Mobile collapse — stack groups vertically ──────────── */
@media (max-width: 575.98px) {
    .ehr-nav__group {
        width: 100%;
        border-right: 0;
        border-bottom: 1px dashed var(--ehr-border);
        padding-bottom: 0.5rem;
    }
    .ehr-nav__group:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }
}

/* ── patient_detail "View all in browser →" link ────────── */
.ehr-detail-viewall {
    color: var(--ehr-primary);
    font-weight: 500;
    transition: color 120ms ease, transform 120ms ease;
}

.ehr-detail-viewall:hover,
.ehr-detail-viewall:focus-visible {
    color: var(--ehr-primary);
    text-decoration: underline !important;
}

.ehr-detail-viewall i {
    transition: transform 120ms ease;
}

.ehr-detail-viewall:hover i {
    transform: translateX(2px);
}

/* ── Patient filter banner (cross-link landing state) ──── */
.ehr-patient-banner {
    border-radius: var(--ehr-radius-sm);
    border: 1px solid var(--ehr-primary);
    background: var(--ehr-primary-soft);
    color: var(--ehr-text);
    padding: 0.55rem 0.85rem;
}

.ehr-patient-banner i.bi-funnel-fill {
    color: var(--ehr-primary);
}

.ehr-patient-banner a:not(.btn) {
    color: var(--ehr-primary);
}
