/* ============================================================================
   MIRA page header — the bar at the top of every page inside the app shell.
   Rendered by Views/Shared/_page_title.cshtml. See design/page-header-redesign.html.

   Deliberately NOT in app.min.css: that file is the vendor theme, and a theme
   update would take these rules with it.

   The shape is one line at every width. What changes between sizes is only what
   is SHOWN — nothing is repositioned, so the bar never changes height between
   pages and the content below it never jumps.
   ============================================================================ */

/* The theme sets .main-content{overflow:hidden}. `hidden` makes an element a scroll
   container, and a sticky descendant then sticks to THAT box — which never scrolls —
   so it silently never sticks. `clip` clips exactly the same pixels without creating
   the scroll container, which is the whole reason it exists. Nothing else changes. */
.main-content {
    overflow: clip;
}

.mira-ph {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 16px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--bs-border-color, #e9ecf3);
    border-radius: 12px;
    /* Sticks under the fixed 70px top bar. The container's own padding keeps page
       content inside this width, so nothing scrolls through the side gutters. */
    position: sticky;
    top: 78px;
    z-index: 100;
    transition: box-shadow .18s ease;
}

/* Set by a scroll listener once the bar is actually holding, so the shadow is a
   signal that something is pinned rather than permanent decoration. */
.mira-ph.is-stuck {
    box-shadow: 0 6px 16px -8px rgba(18, 38, 63, .28);
}

/* ── back ───────────────────────────────────────────────────────────────── */
.mira-ph .ph-back {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    border: 1px solid var(--bs-border-color, #e9ecf3);
    background: #fff;
    color: #74788d;
    display: grid;
    place-items: center;
    font-size: 15px;
    text-decoration: none;
    transition: border-color .16s, color .16s, transform .16s;
}
.mira-ph .ph-back:hover {
    border-color: #556ee6;
    color: #556ee6;
    transform: translateX(-2px);
}
.mira-ph .ph-back:focus-visible {
    outline: 2px solid #556ee6;
    outline-offset: 2px;
}

/* ── the path ───────────────────────────────────────────────────────────── */
.mira-ph .ph-path {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;      /* lets the title ellipsis instead of pushing the actions out */
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mira-ph .ph-path li {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
}
.mira-ph .ph-crumb {
    font-size: 12.5px;
    color: #74788d;
    text-decoration: none;
    white-space: nowrap;
    flex: none;
}
a.mira-ph-crumb:hover, .mira-ph a.ph-crumb:hover {
    color: #556ee6;
    text-decoration: underline;
}
.mira-ph .ph-sep {
    color: #c8cddc;
    font-size: 11px;
    flex: none;
}

/* The title IS the last crumb — never rendered twice. h1 because the bar is the
   page's real heading; several page bodies have no h1 of their own. */
.mira-ph .ph-title {
    font-size: 16px;
    font-weight: 600;
    color: #2a3042;
    letter-spacing: -.2px;
    line-height: 1.2;
    margin: 0;
    /* Sentence case on purpose. The theme forces uppercase on .page-title-box h4,
       which is ~20% wider for the same words and harder to scan on a phone. */
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ── actions ────────────────────────────────────────────────────────────── */
.mira-ph .ph-acts {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    flex: none;
}
/* Page buttons dropped into the slot inherit a consistent height without each
   page having to remember it. */
.mira-ph .ph-acts .btn {
    height: 34px;
    padding: 0 13px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mira-ph .ph-acts .form-control,
.mira-ph .ph-acts .form-select {
    height: 34px;
    border-radius: 9px;
    font-size: 12.5px;
}

/* ── tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .mira-ph { height: 48px; padding: 0 13px; }
    .mira-ph .ph-title { font-size: 15px; }
    /* Deep ancestors go first; the back arrow still covers "up one". */
    .mira-ph .ph-crumb.deep, .mira-ph .ph-sep.deep { display: none; }
}

/* ── phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .mira-ph {
        height: 48px;
        padding: 0 10px;
        gap: 8px;
        margin-bottom: 14px;
        border-radius: 10px;
        top: 74px;
    }
    /* 40px: a real thumb target. The old button was 30px next to a 14px title. */
    .mira-ph .ph-back { width: 40px; height: 40px; font-size: 16px; }
    .mira-ph .ph-title { font-size: 15px; }
    /* Ancestors hidden entirely — the arrow carries them, and the room goes to
       the one string that identifies the page. */
    .mira-ph .ph-crumb, .mira-ph .ph-sep { display: none; }
    /* Actions collapse to icons; a button that is only a label loses nothing
       because the label is what does not fit. */
    .mira-ph .ph-acts .btn { width: 40px; height: 40px; padding: 0; justify-content: center; }
    .mira-ph .ph-acts .btn .ph-lbl { display: none; }
    .mira-ph .ph-acts .btn i { margin: 0 !important; }
}

@media (max-width: 400px) {
    .mira-ph .ph-acts .btn:nth-child(n+3) { display: none; }   /* keep two, at most */
}

@media (prefers-reduced-motion: reduce) {
    .mira-ph, .mira-ph .ph-back { transition: none; }
    .mira-ph .ph-back:hover { transform: none; }
}
