/* shared/hub_topbar.css — the Hub's floating glass top bar, and the design tokens it uses.
   TASK-439 (owner, 2026-09-09): "Could it be possible that we have this Hub's header menu in every
   of our satellite apps, but it's automatically hidden on the top and just drops down when a user
   goes up with a mouse?" — so the bar (markup: shared/hub_topbar.php) and its CSS moved out of
   hub/www/hub_design.css into shared/, where every app can load them. hub_design.css keeps the
   rest of the Hub design and is loaded AFTER this file by hub/www/_hub_shell.php.

   Two modes, one markup:
     · Hub pages: sticky bar at the top of the page (as before)
     · satellite apps: `.hub-topbar--peek` — fixed, parked above the viewport, slides down while
       the pointer is at the top edge (`.hub-topbar__hot`) or on the bar; never on touch layouts
       (the shared bottom drawer owns ≤1024px).
   No app-specific rule belongs here (owner rule: one shared CSS source, no forks). */

/* ══════════════════════════════════════════════════════════════════════════════════════════
   0. TOKENS
   ══════════════════════════════════════════════════════════════════════════════════════════ */
:root {
    /* aliases the old inline styles used everywhere — kept so nothing page-local has to change */
    --primary:  var(--primary-color, #001f54);
    --accent:   var(--accent-color, #fd7e14);
    --success:  var(--success-color, #28a745);
    --danger:   var(--danger-color, #dc3545);
    --warning:  var(--warning-color, #f59e0b);
    --bg:       var(--bg-color, #f8fafc);

    /* Hub-scoped */
    --hub-ink:        #0b1a3a;
    --hub-ink-soft:   #475569;
    --hub-ink-muted:  #94a3b8;
    --hub-glass:      rgba(255, 255, 255, 0.78);
    --hub-glass-solid:rgba(255, 255, 255, 0.94);
    --hub-line:       rgba(15, 23, 42, 0.08);
    --hub-radius:     var(--border-radius-lg, 24px);
    --hub-radius-sm:  14px;
    --hub-radius-xs:  10px;
    --hub-shadow-1:   0 4px 14px rgba(0, 31, 84, 0.06), 0 1px 3px rgba(0, 31, 84, 0.04);
    --hub-shadow-2:   0 18px 45px rgba(0, 31, 84, 0.16), 0 4px 10px rgba(0, 31, 84, 0.06);
    --hub-shadow-3:   0 30px 70px rgba(0, 31, 84, 0.28);
    --hub-ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
    --hub-ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
    --hub-font:       'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --hub-topbar-h:   64px;
    --card-accent:    var(--primary);   /* every card may override this — it tints icon, CTA and glow */
}

/* ══════════════════════════════════════════════════════════════════════════════════════════
   2. TOP BAR — one floating glass bar for every Hub page (rendered by _hub_shell.php)
   ══════════════════════════════════════════════════════════════════════════════════════════ */
.hub-topbar {
    position: sticky;
    top: 0;
    z-index: 120;
    padding: 10px 18px 0;
}
.hub-topbar__inner {
    height: var(--hub-topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 0 16px;
    border-radius: 20px;
    background: var(--hub-glass);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--hub-shadow-1);
    animation: hub-bar-drop 0.55s var(--hub-ease-out) both;
}
@keyframes hub-bar-drop {
    from { transform: translateY(-24px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.hub-topbar__brand {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 6px;
}
.hub-topbar__brand img { height: 34px; width: auto; display: block; transition: transform 0.4s var(--hub-ease-spring); }
.hub-topbar__brand:hover img { transform: rotate(-6deg) scale(1.06); }

.hub-topbar__nav {
    display: flex; align-items: center; gap: 4px;
    flex: 1; min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;          /* NEVER scrolls sideways — items that do not fit move into "Mehr ▾" */
    padding: 4px 2px;
}
.hub-topbar__nav > * { flex-shrink: 0; }
/* [hidden] must beat the pill's own `display:inline-flex !important` — otherwise an item moved
   into "Mehr" keeps occupying the bar (measured: every item ended up in the menu). */
.hub-topbar__nav > [data-overflowed], .hub-topbar__nav > [hidden] { display: none !important; }
.hub-more { position: relative; }
/* the bar clips its overflow, so the menu is FIXED and placed under its button by the shell script */
.hub-more__menu { position: fixed; right: auto; left: 0; top: 0; transform-origin: top left; min-width: 230px; }
.hub-more__menu .hub-badge { position: static; }

.hub-navpill {
    position: relative;
    display: inline-flex !important; align-items: center; gap: 7px;
    padding: 9px 15px;
    border-radius: 999px;          /* fully round — a 13px radius under a soft shadow read as a box */
    text-decoration: none;
    color: #334155;
    font-weight: 700; font-size: 0.84rem;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.25s var(--hub-ease-spring), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.hub-navpill .hub-navpill__icon { font-size: 1.05rem; line-height: 1; transition: transform 0.35s var(--hub-ease-spring); }
.hub-navpill:hover { background: rgba(0, 31, 84, 0.07); color: var(--primary); transform: translateY(-2px); }
.hub-navpill:hover .hub-navpill__icon { transform: rotate(-12deg) scale(1.18); }
.hub-navpill:active { transform: translateY(0) scale(0.97); }
.hub-navpill.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(0, 31, 84, 0.6);   /* negative spread: the shadow hugs the pill */
}
.hub-navpill.is-active:hover { background: var(--primary); color: #fff; }
.hub-navpill--admin { color: var(--primary); background: rgba(0, 31, 84, 0.06); border-color: rgba(0, 31, 84, 0.08); }
.hub-navpill--admin.is-active { box-shadow: 0 6px 14px -6px rgba(0, 31, 84, 0.6); }
.hub-navpill--systemdoku { color: #6d28d9; }
.hub-navpill--systemdoku:hover { background: rgba(109, 40, 217, 0.08); color: #5b21b6; }

/* icon-only pill (the bar's first overflow step — see hub_shell_fit) */
.hub-navpill.is-compact .hub-navpill__label, .is-compact > .hub-navpill .hub-navpill__label { display: none; }
.hub-navpill.is-compact, .is-compact > .hub-navpill { padding: 9px 11px; }

/* badge counters (chat / mail / projekte) */
.hub-badge {
    display: none;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 10.5px; font-weight: 800; line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
}
.hub-badge.is-on { display: inline-block; animation: hub-pop 0.45s var(--hub-ease-spring); }
.hub-badge--mail { background: var(--warning); box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4); }
@keyframes hub-pop {
    0%   { transform: scale(0.2); }
    70%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* right cluster */
.hub-topbar__right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }

/* running-timer chip */
.hub-timer {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 13px 7px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff1e6, #ffe3cc);
    border: 1px solid rgba(253, 126, 20, 0.45);
    color: #9a3412;
    text-decoration: none;
    font-weight: 800; font-size: 0.82rem; font-variant-numeric: tabular-nums;
    box-shadow: 0 6px 16px rgba(253, 126, 20, 0.25);
    transition: transform 0.25s var(--hub-ease-spring), box-shadow 0.2s;
}
.hub-timer[hidden] { display: none !important; }
.hub-timer:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(253, 126, 20, 0.35); }
.hub-timer__dot { width: 9px; height: 9px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); animation: hub-timer-pulse 1.4s ease-out infinite; }
@keyframes hub-timer-pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); } 100% { box-shadow: 0 0 0 9px rgba(220, 38, 38, 0); } }
.hub-timer__note { font-weight: 600; color: #b45309; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-timer__note:empty { display: none; }
.hub-timer--fab { display: none; position: fixed; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 20500; }
@media (max-width: 1024px) { .hub-timer--fab:not([hidden]) { display: inline-flex; } }
@media (prefers-reduced-motion: reduce) { .hub-timer__dot { animation: none; } }

/* user chip + menu */
.hub-user { position: relative; }
.hub-user__chip {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: 999px;
    border: 1px solid rgba(0, 31, 84, 0.1);
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.25s var(--hub-ease-spring), box-shadow 0.2s ease, background 0.2s ease;
}
.hub-user__chip:hover { transform: translateY(-2px); box-shadow: var(--hub-shadow-1); background: #fff; }
.hub-user__chip[aria-expanded="true"] { background: #fff; box-shadow: var(--hub-shadow-1); }
.hub-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.8rem; letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 60%, var(--accent) 140%);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}
.hub-avatar--lg { width: 72px; height: 72px; font-size: 1.5rem; border-radius: 24px; }
.hub-avatar--xl { width: 96px; height: 96px; font-size: 2rem; border-radius: 30px; }
.hub-user__name { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.hub-user__name b { font-size: 0.82rem; color: var(--primary); font-weight: 800; }
.hub-user__name small { font-size: 0.68rem; color: var(--hub-ink-muted); font-weight: 600; text-transform: capitalize; }
.hub-user__caret { font-size: 0.7rem; color: var(--hub-ink-muted); transition: transform 0.25s ease; }
.hub-user__chip[aria-expanded="true"] .hub-user__caret { transform: rotate(180deg); }

.hub-user__menu {
    position: absolute; right: 0; top: calc(100% + 10px);
    min-width: 250px;
    padding: 8px;
    border-radius: 18px;
    background: var(--hub-glass-solid);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--hub-shadow-2);
    transform-origin: top right;
    animation: hub-menu-in 0.28s var(--hub-ease-spring) both;
    z-index: 200;
}
.hub-user__menu[hidden] { display: none !important; }
@keyframes hub-menu-in {
    from { transform: scale(0.85) translateY(-8px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.hub-user__menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid var(--hub-line); margin-bottom: 6px; }
.hub-user__menu-head b { display: block; color: var(--primary); font-size: 0.95rem; }
.hub-user__menu-head span { display: block; color: var(--hub-ink-muted); font-size: 0.75rem; font-weight: 600; }
.hub-menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--hub-ink);
    font-weight: 600; font-size: 0.86rem;
    border: none; background: none; cursor: pointer; font-family: inherit; text-align: left;
    transition: background 0.15s ease, transform 0.2s var(--hub-ease-spring);
}
.hub-menu-item:hover { background: rgba(0, 31, 84, 0.06); transform: translateX(3px); }
.hub-menu-item.is-active { background: rgba(0, 31, 84, 0.08); color: var(--primary); }
.hub-menu-item--danger { color: var(--danger); }
.hub-menu-item--danger:hover { background: rgba(220, 53, 69, 0.08); }
.hub-menu-item .hub-menu-item__icon { width: 22px; text-align: center; font-size: 1rem; }
.hub-user__menu-foot { padding: 8px 12px 4px; font-size: 0.7rem; color: var(--hub-ink-muted); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; }

/* hover popups (chat / mail preview) */
.hub-popover {
    position: absolute; top: calc(100% + 10px); right: 0;
    min-width: 260px; max-width: 320px;
    padding: 14px;
    border-radius: 16px;
    background: var(--hub-glass-solid);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--hub-shadow-2);
    z-index: 210;
    animation: hub-menu-in 0.25s var(--hub-ease-spring) both;
}
.hub-popover__title { display: flex; align-items: center; justify-content: space-between; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--hub-ink-muted); margin-bottom: 8px; }
.hub-popover__body { font-size: 0.84rem; color: var(--hub-ink-soft); line-height: 1.45; margin-bottom: 10px; }
.hub-popover__body .hub-mailrow { padding: 6px 0; border-bottom: 1px solid var(--hub-line); }
.hub-popover__body .hub-mailrow b { display: block; font-size: 0.78rem; color: var(--hub-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-popover__body .hub-mailrow span { display: block; font-size: 0.76rem; color: var(--hub-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-popover__more { font-size: 0.74rem; color: var(--hub-ink-muted); margin-top: 6px; }
.hub-popover__cta { display: block; text-align: center; padding: 9px 12px; border-radius: 11px; background: var(--primary); color: #fff; font-weight: 700; font-size: 0.8rem; text-decoration: none; transition: background 0.2s; }
.hub-popover__cta:hover { background: var(--accent); }
.hub-iconbtn {
    background: none; border: none; cursor: pointer; padding: 2px 4px; font-size: 0.95rem; color: var(--hub-ink-muted); line-height: 1; font-family: inherit;
    transition: color 0.15s, transform 0.5s ease;
}
.hub-iconbtn:hover { color: var(--primary); }
.hub-iconbtn.spinning { animation: hub-spin 0.6s linear; }
@keyframes hub-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* the shared mobile shell (bottom drawer + menu FAB) takes over below 1024px */
@media (max-width: 1024px) {
    .hub-topbar { display: none !important; }
    body.hub-dashboard { padding-bottom: 90px !important; }
}
/* chat / mail popups live on a dashboard-only wrapper; the old ids stay because suite_core.js
   binds to them (topnav-chat-link / topnav-chat-popup / topnav-chat-badge) */
.hub-topbar__nav .hub-popwrap { position: relative; }

/* ══════════════════════════════════════════════════════════════════════════════════════════
   PEEK MODE — the same bar on a satellite app, parked above the viewport (TASK-439)
   ══════════════════════════════════════════════════════════════════════════════════════════ */
.hub-topbar--peek {
    display: block !important;      /* beats the inline display:none that hides the unstyled bar */
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 20400;                 /* above the rail (1000) and app content; below modals (≥50000) */
    padding: 8px 18px 0;
    transform: translateY(calc(-100% - 6px));
    transition: transform 0.28s var(--hub-ease-out);
    font-family: var(--hub-font);
    pointer-events: none;
}
.hub-topbar--peek .hub-topbar__inner { animation: none; pointer-events: auto; box-shadow: var(--hub-shadow-2); }
.hub-topbar--peek.is-open { transform: none; }
/* the invisible strip at the top edge that opens the bar, with a small handle as the affordance */
.hub-topbar__hot { position: fixed; top: 0; left: 0; right: 0; height: 8px; z-index: 20399; }
.hub-topbar__hot::after {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 96px; height: 4px; border-radius: 0 0 6px 6px;
    background: var(--primary); opacity: 0.35; transition: opacity 0.2s, width 0.2s;
}
.hub-topbar__hot:hover::after { opacity: 0.7; width: 140px; }
@media (max-width: 1024px) { .hub-topbar__hot { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .hub-topbar--peek { transition: none; } }

/* ── Tool overlay (peek mode): a Hub tool page over the satellite app, never a navigation away
   from it (TASK-439, owner 2026-09-09). Above the FAB drawer and modals (≥ 50000). ───────── */
.hub-tool { position: fixed; inset: 0; z-index: 50020; display: flex; flex-direction: column; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 18px; }
.hub-tool[hidden] { display: none; }
.hub-tool__bar { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 8px 0 18px; background: #fff; border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--hub-line, #e2e8f0); }
.hub-tool__title { font-weight: 900; color: var(--primary, #001f54); font-size: 1rem; flex: 1; letter-spacing: -0.01em; }
.hub-tool__ext { font-size: 0.8rem; font-weight: 700; color: var(--hub-ink-soft, #334155); text-decoration: none; padding: 6px 12px; border-radius: 999px; background: rgba(0, 31, 84, 0.06); }
.hub-tool__ext:hover { background: rgba(0, 31, 84, 0.12); color: var(--primary, #001f54); }
.hub-tool__close { width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0, 31, 84, 0.06); color: var(--primary, #001f54); font-size: 1rem; font-weight: 900; cursor: pointer; }
.hub-tool__close:hover { background: #b91c1c; color: #fff; }
.hub-tool__frame { flex: 1; width: 100%; border: 0; background: #fff; border-radius: 0 0 16px 16px; }
body.hub-tool-open { overflow: hidden; }
@media (max-width: 640px) { .hub-tool { padding: 0; } .hub-tool__bar { border-radius: 0; } .hub-tool__frame { border-radius: 0; } }
