/* layout/shell.css — The frame every page shares: a dark command bar across the top, a scrolling
   work area, and a dark status bar along the bottom. Linked by base.html, so the standalone pages
   (file, user annotations) get the same frame as the app (index) — see templates/partials/shell/. */

body { height: 100vh; overflow: hidden; }

.app-frame { display: flex; flex-direction: column; height: 100vh; width: 100%; min-width: 0; }
.app-main  { flex: 1; min-height: 0; overflow-y: auto; background: var(--nccr-bg); }

/* Work-area width: wide for data grids, narrower for single-object pages */
.page-container, .view-content { max-width: 1480px; margin: 0 auto; padding: 20px 24px 36px; }
.page-container.is-narrow, .view-content.is-narrow { max-width: 1180px; }
.view-scroll { flex: 1; width: 100%; min-height: 0; overflow-y: auto; background: var(--nccr-bg); }

/* ── Command bar ─────────────────────────────────────────────────────────── */
.top-header {
    position: relative; z-index: 20; flex: none;
    display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
    height: var(--shell-h); padding: 0 20px;
    background: var(--shell-bg); color: var(--shell-fg);
    border-bottom: 1px solid var(--shell-border);
}

.top-header-logo { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--shell-fg); font-weight: 500; }
.top-header-logo i { font-size: 1.3em; color: var(--shell-accent); }
/* The logo is black line-work + blue word-mark on transparency: inverted it reads on the dark bar and keeps its blue. */
.brand-logo { height: 26px; width: auto; display: block; filter: invert(1) hue-rotate(180deg) saturate(1.25) brightness(1.08); }

/* "VoCallBase | NCCR Evolving Language": the logo, a divider, the affiliation. */
.top-header-affiliation {
    display: flex; align-items: center; height: 26px;
    padding-left: 14px; border-left: 1px solid var(--shell-border);
    text-decoration: none; white-space: nowrap;
}
.top-header-affiliation .aff-name { font-size: var(--fs-sm); font-weight: 400; letter-spacing: 0.01em; color: var(--shell-muted); transition: color var(--ui-dur) var(--ui-ease); }
.top-header-affiliation:hover { text-decoration: none; }
.top-header-affiliation:hover .aff-name { color: var(--shell-fg); }

/* Back link in the bar (standalone pages) */
.top-header-back {
    display: inline-flex; align-items: center; gap: 7px; align-self: center;
    padding: 5px 10px; border: 1px solid var(--shell-border); border-radius: var(--ui-radius-sm);
    color: var(--shell-muted); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; white-space: nowrap;
    transition: color var(--ui-dur) var(--ui-ease), border-color var(--ui-dur) var(--ui-ease);
}
.top-header-back:hover { color: var(--shell-fg); border-color: var(--shell-subtle); text-decoration: none; }

.top-header-right { display: flex; align-items: stretch; gap: 14px; min-width: 0; }

/* ── Primary navigation: flat tabs with an amber underline ────────────────── */
.top-tabs { display: flex; align-items: stretch; gap: 2px; }
.top-tab {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    padding: 0 14px;
    border: none; background: transparent;
    color: var(--shell-muted);
    font-size: var(--fs-md); font-weight: 500; letter-spacing: 0.01em;
    cursor: pointer; user-select: none;
    transition: color var(--ui-dur) var(--ui-ease);
}
.top-tab::after {
    content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
    background: transparent; transition: background var(--ui-dur) var(--ui-ease);
}
.top-tab:hover { color: var(--shell-fg); }
.top-tab.active { color: #fff; }
.top-tab.active::after { background: var(--shell-accent); }
.top-tab i { font-size: 1em; opacity: 0.9; }
.top-tab .admin-chevron { font-size: 0.72em !important; margin-left: 2px; transition: transform 0.2s var(--ui-ease); }
.top-tab .admin-chevron.open { transform: rotate(180deg); }

/* Identity badge (shown when signed in) */
.top-header-user-badge {
    display: none; align-items: center; gap: 8px; align-self: center;
    margin-right: 2px; padding: 3px 11px 3px 4px;
    background: var(--shell-bg-2); border: 1px solid var(--shell-border); border-radius: var(--ui-radius-pill);
    color: var(--shell-fg); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--ui-dur) var(--ui-ease);
}
.top-header-user-badge:hover { border-color: var(--shell-subtle); }
.top-header-user-badge.visible { display: flex; }
.top-header-user-badge .badge-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--nccr-success-emph); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
}

/* ── Account menu: a dark popover hanging off the bar ─────────────────────── */
.account-dropdown-wrapper { position: relative; display: flex; }
.admin-dropdown-menu {
    display: none;
    position: absolute; top: 100%; right: 0;
    min-width: 232px; padding: 6px;
    background: var(--shell-bg-2);
    border: 1px solid var(--shell-border); border-top: none;
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
    box-shadow: var(--ui-shadow-3);
    z-index: 9999;
}
.admin-dropdown-menu.open { display: block; animation: dropdownFadeIn 0.14s var(--ui-ease); }
@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.admin-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px;
    border-radius: var(--ui-radius-sm);
    color: var(--shell-fg);
    font-size: var(--fs-sm); font-weight: 500;
    cursor: pointer;
    transition: background var(--ui-dur) var(--ui-ease);
}
.admin-dropdown-item i { width: 16px; text-align: center; color: var(--shell-muted); }
.admin-dropdown-item:hover { background: var(--shell-bg-3); color: #fff; }
.admin-dropdown-item:hover i { color: var(--shell-accent); }
.admin-dropdown-divider { border-top: 1px solid var(--shell-border); margin: 6px 4px; }
.admin-logout-item { color: #f2857a !important; }
.admin-logout-item i { color: #f2857a !important; }
.admin-logout-item:hover { background: rgba(242, 133, 122, 0.12) !important; }
.account-menu-header { padding: 8px 10px 10px; margin: 0 0 6px; border-bottom: 1px solid var(--shell-border); }
.account-menu-header .acct-name {
    color: #fff; font-weight: 500; font-size: var(--fs-md);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.account-role-badge {
    display: inline-block; margin-top: 5px; padding: 1px 7px;
    border-radius: var(--ui-radius-sm);
    background: rgba(var(--shell-accent-rgb), 0.16); color: var(--shell-accent);
    font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}

/* ── Tab panes: only the active one is shown; each scrolls on its own ─────── */
.top-tab-content { display: none; flex: 1; min-height: 0; overflow: hidden; }
.top-tab-content.active { display: flex; }

/* ── Status bar ──────────────────────────────────────────────────────────── */
.app-statusbar {
    flex: none;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    height: var(--statusbar-h); padding: 0 16px;
    background: var(--shell-bg); color: var(--shell-muted);
    border-top: 1px solid var(--shell-border);
    font-size: var(--fs-xs); letter-spacing: 0.02em;
}
.statusbar-group { display: flex; align-items: center; gap: 14px; min-width: 0; flex: none; }
.statusbar-group.is-ticker { flex: 1; overflow: hidden; }
.statusbar-mark { flex: none; width: 28px; height: 4px; border-radius: 2px; background: var(--nccr-brand-stripe); }
.statusbar-item {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--shell-muted); text-decoration: none; white-space: nowrap;
    transition: color var(--ui-dur) var(--ui-ease);
}
a.statusbar-item:hover, button.statusbar-item:hover { color: var(--shell-fg); text-decoration: none; }
button.statusbar-item { background: none; border: none; padding: 0; font: inherit; letter-spacing: inherit; cursor: pointer; }
.statusbar-item strong { color: var(--shell-fg); font-weight: 500; }
.statusbar-item .ti { font-size: 1.15em; }
.statusbar-sep { color: var(--shell-subtle); }
/* Catalogue ticker: counts in mono, uppercase */
.statusbar-ticker {
    display: inline-flex; align-items: center; gap: 10px; min-width: 0;
    font-family: var(--nccr-font-mono); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--shell-muted); white-space: nowrap; overflow: hidden;
}
.statusbar-ticker b { color: var(--shell-fg); font-weight: 700; }
.statusbar-live { display: inline-flex; align-items: center; gap: 6px; color: var(--shell-accent); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.statusbar-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--shell-accent); box-shadow: 0 0 0 3px rgba(var(--shell-accent-rgb), 0.22); }
.app-statusbar .theme-toggle {
    position: static; width: 22px; height: 22px; font-size: 12px;
    border: 1px solid var(--shell-border); background: transparent; color: var(--shell-muted); box-shadow: none;
}
.app-statusbar .theme-toggle:hover { color: var(--shell-fg); border-color: var(--shell-subtle); }

@media (max-width: 1240px) { .statusbar-item.is-contact > span { display: none; } }   /* keep the icon, drop the address */
@media (max-width: 900px) {
    .top-header { padding: 0 12px; }
    .top-header-affiliation { display: none; }
    .top-tab { padding: 0 10px; }
    .top-tab > span { display: none; }
    .statusbar-group.is-secondary { display: none; }
    .page-container, .view-content { padding: 16px 14px 28px; }
}
