/* ═══════════════════════════════════════════════════════════════
   ehr_header.css — Desktop header + Mobile quick-button bar
   Load order: 3
   ═══════════════════════════════════════════════════════════════ */

/* ─── Desktop header (>980px) ─── */
.ehr-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--ehr-sidebar-width);
    height: var(--ehr-header-height);
    border-bottom: 1px solid var(--ehr-border);
    /* box-shadow: 0 1px 4px var(--ehr-shadow-color); */
    z-index: 1200;
    display: flex;
    align-items: center;
    padding: 0 20px;
    transition: left var(--ehr-transition);
    background: var(--ehr-surface-bg);
    isolation: isolate;
}

/* When sidebar is collapsed */
.ehr-sidebar.collapsed ~ .ehr-page-container .ehr-header {
    left: 0;
}

/* Sidebar toggle button — desktop */
.ehr-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--ehr-text-primary);
    transition: background var(--ehr-transition);
}

.ehr-sidebar-toggle:hover {
    background: var(--ehr-border);
}

.ehr-sidebar-toggle svg {
    width: 25px;
    height: 25px;
}

/* Header right area */
.ehr-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ehr-header-right a {
    color: var(--ehr-text-primary);
    font-weight: 500;
    transition: color var(--ehr-transition);
}

.ehr-header-right a:hover {
    color: var(--ehr-text-primary);
}

/* who is logged in (full-screen header only; the header is hidden at 768px and below) */
.ehr-header-stable {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--ehr-button-primary-bg);
    color: var(--ehr-button-primary-text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.3;
    max-width: 24ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ehr-header-divider {
    width: 1px;
    height: 20px;
    background: var(--ehr-border);
}

/* ─── Mobile top bar (≤768px) ─── */
.ehr-mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ehr-mobile-bar-height);
    background: var(--ehr-mobile-bar-bg);
    z-index: 1100;
}

.ehr-mobile-bar-inner {
    display: flex;
    align-items: stretch;
    height: 100%;
}

/* Quick buttons */
.ehr-quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ehr-theme-on-brand);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: background var(--ehr-transition);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ehr-quick-btn:hover,
.ehr-quick-btn:active,
.ehr-quick-btn.active,
.ehr-quick-btn:focus {
    background: var(--ehr-mobile-sub-bg);
}

/* Active indicator line */
/* .ehr-quick-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--ehr-theme-accent);
    border-radius: 1px;
} */

/* Quick button icons */
.ehr-quick-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.ehr-quick-btn.active svg {
    opacity: 1;
}

/* ─── Mobile sub-panel (dropdown under quick buttons) ─── */
.ehr-mobile-sub {
    display: none;
    position: fixed;
    top: var(--ehr-mobile-bar-height);
    left: 0;
    right: 0;
    background: var(--ehr-mobile-sub-bg);
    z-index: 1099;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.ehr-mobile-sub.open {
    display: block;
    max-height: 400px;
    /* MOBILEMENU_20261026 (run 450): the panel ends at the bottom of the screen and scrolls; at 400px with overflow hidden the
       last Misc links (Forums, BTB, Help, Contact Admin) could not be reached */
    max-height: calc(100vh - var(--ehr-mobile-bar-height));
    max-height: calc(100dvh - var(--ehr-mobile-bar-height));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ehr-mobile-sub-inner {
    padding: 8px 0;
}

.ehr-mobile-sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ehr-action);
}

/* Close button */
.ehr-mobile-sub-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    transition: background var(--ehr-transition), color var(--ehr-transition);
    font-size: 18px;
    line-height: 1;
}

.ehr-mobile-sub-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Sub-panel links */
.ehr-mobile-sub a {
    display: block;
    padding: .5em 1em;
    color: var(--ehr-theme-on-brand-muted);
    font-size: 14px;
    transition: background var(--ehr-transition);
}

.ehr-mobile-sub a:hover,
.ehr-mobile-sub a:active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

/* ─── Breakpoints ─── */
@media (max-width: 980px) {
    .ehr-header {
        display: none !important;
    }
    .ehr-mobile-bar {
        display: block;
    }
}
/* ─── REFRESHALL_20261018 (owner 10-18): the page refresh ─────────────────────────────────────────────────
   One button at the far right of the desktop header (page_top.j2) and of the phone bar (side_menu.j2). It reloads what is
   in the main area, never the whole site (ehr_refreshPage, js/incJS_01_core.js). */
.ehr-header-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    color: var(--ehr-text-primary);
    transition: background var(--ehr-transition);
}
.ehr-header-refresh:hover {
    background: var(--ehr-border);
    color: var(--ehr-text-primary);
}
.ehr-header-refresh svg {
    width: 20px;
    height: 20px;
}
/* phone bar: the refresh is a quick button like the others; a pressed look while the page reloads */
.ehr-quick-refresh:active svg {
    transform: rotate(90deg);
}
/* the Stable panel carries the account links under the stable ones (the Acct button is gone): a quiet label between them */
.ehr-mobile-sub-sep {
    margin: .4em 1em 0;
    padding-top: .5em;
    border-top: 1px solid currentColor;   /* the label colour, so the line shows in every theme */
    color: var(--ehr-theme-on-brand-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .7;
}
/* MOBILEMENU_20261026 (run 450, owner 10-26): the phone Misc panel in four labelled groups (Horses, Play, Players, Connect),
   two to a row, so the whole list fits on one screen (side_menu.j2) */
.ehr-mobile-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 4px;
}
.ehr-mobile-group {
    min-width: 0;
}
.ehr-mobile-group a {
    overflow-wrap: anywhere;
}
/* ─── SERVERCLOCK_20261115 (run list 700, owner 11-15): the database clock (game time, ~26-08-02 12:37 ET, ~ = approximately) ──
   Desktop header: beside the page refresh (page_top.j2). Side menu: a quiet line under the logo. Phone: in the Misc panel
   header row (the Help panel for a residency login) with a small refresh, so it takes no extra line (side_menu.j2). Empty (no
   clock yet) = hidden. ehr_clockRefresh (js/incJS_01_core.js) fills every copy again. */
/* FOURYEAR_20261115 (run list 701, owner 11-15: "bold the time ... or make it a bit more prominent"): bold, full text colour,
   a little larger, in all three places */
.ehr-header-clock {
    color: var(--ehr-text-primary);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-right: -10px;   /* close to the refresh beside it (the header gap is 16px) */
}
.ehr-header-clock:empty {
    display: none;
}
.ehr-sidebar-clock {
    margin-top: -.35em;
    text-align: center;
    color: var(--ehr-sidebar-text);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    white-space: nowrap;
}
.ehr-sidebar-clock:empty {
    display: none;
}
.ehr-mobile-clock {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    margin-right: 6px;
    color: var(--ehr-sidebar-text, #fff);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
}
.ehr-mobile-clock-t {
    font-variant-numeric: tabular-nums;
}
.ehr-mobile-clock:has(.ehr-mobile-clock-t:empty) {
    display: none;
}
.ehr-clock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    cursor: pointer;
}
.ehr-clock-btn svg {
    width: 14px;
    height: 14px;
}
.ehr-clock-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.ehr-clock-busy svg {
    opacity: .45;
}
