/* ============================================================
 * BTMP 全站统一顶栏样式（沿用共享主题）
 * 命名空间: .btmp-topbar-*  避免与各页冲突
 * ============================================================ */

.btmp-topbar {
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 44px;
    background: inherit;
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 0.92rem;
    color: var(--btmp-text);
}

.btmp-topbar-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 18px;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.2;
    letter-spacing: .04em;
    white-space: nowrap;
    color: var(--btmp-text);
    text-decoration: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    caret-color: transparent;
    padding-right: 16px;
}

.btmp-brand-mark {
    display: block;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.btmp-topbar-logo:hover {
    color: var(--btmp-text);
    text-decoration: none;
}

.btmp-topbar-spacer { flex: 1; }

.btmp-topbar-guide {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--btmp-text-subtle);
    text-decoration: none;
    white-space: nowrap;
    font-size: 13px;
}
.btmp-topbar-guide:hover, .btmp-topbar-guide.active {
    color: var(--btmp-text);
    background: var(--btmp-surface-muted);
}
.btmp-topbar-guide:focus-visible {
    outline: 2px solid var(--btmp-primary);
    outline-offset: 2px;
}

.btmp-topbar-guide-article {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: var(--btmp-primary);
    font-size: 14px;
    font-weight: 500;
}
.btmp-topbar-guide-article > span:first-child {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    text-decoration-color: currentColor;
}
.btmp-topbar-guide-article:hover > span:first-child { text-decoration-color: currentColor; }

/* Keep the complete article title above the review date on narrow screens. */
@media (max-width: 800px) {
    .btmp-topbar[data-home-guide] {
        height: auto;
        min-height: 44px;
        flex-wrap: wrap;
        row-gap: 0;
    }
    .btmp-topbar[data-home-guide] > .btmp-topbar-logo,
    .btmp-topbar[data-home-guide] > .btmp-topbar-user { margin-top: 4px; margin-bottom: 4px; }
    .btmp-topbar[data-home-guide] > .btmp-topbar-guide-article {
        order: 1;
        flex: 1 0 100%;
        min-width: 0;
        padding: 8px 0 12px;
        font-size: 13px;
        line-height: 1.7;
        white-space: normal;
    }
}

.btmp-topbar-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 auto;
    margin: 0 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--btmp-line);
    border-radius: 50%;
    background: var(--btmp-surface);
    color: var(--btmp-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.btmp-topbar-theme:hover { background: var(--btmp-surface-muted); }
.btmp-topbar-theme svg { flex: none; pointer-events: none; }
.btmp-theme-moon { display: none; }
[data-btmp-theme="graphite"] .btmp-theme-sun { display: none; }
[data-btmp-theme="graphite"] .btmp-theme-moon { display: block; }
.btmp-topbar-theme:focus-visible {
    outline: 2px solid var(--btmp-primary);
    outline-offset: 2px;
}

/* 模式标识 */
.btmp-topbar-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--btmp-surface-muted);
    color: var(--btmp-text-subtle);
    font-size: 0.82rem;
    font-weight: 500;
    margin-right: 14px;
    user-select: none;
}

.btmp-topbar-mode.intraday {
    background: #fee2e2;
    color: #b91c1c;
}

.btmp-topbar-mode.intraday::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239,68,68,0.6);
    animation: btmp-pulse 1.6s ease-out infinite;
}

@keyframes btmp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
    70%  { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* 头像区 */
.btmp-topbar-user {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 6px;
    border-radius: 20px;
    background: var(--btmp-bg);
    cursor: pointer;
    user-select: none;
    color: var(--btmp-text);
    text-decoration: none;
    font-size: 0.86rem;
}

.btmp-topbar-user:hover {
    background: var(--btmp-line);
}

.btmp-topbar-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--btmp-primary);
    color: var(--btmp-surface);
    font-weight: 600;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btmp-topbar-user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 180px;
    background: var(--btmp-surface);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    border: 1px solid var(--btmp-line);
    padding: 6px;
    z-index: 1100;
}

.btmp-topbar-user.open .btmp-topbar-user-menu {
    display: block;
}

.btmp-topbar-user-menu a {
    display: block;
    padding: 8px 12px;
    color: var(--btmp-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
}

.btmp-topbar-user-menu a:hover {
    background: var(--btmp-surface-muted);
}

.btmp-topbar-user-menu .divider {
    height: 1px;
    background: var(--btmp-line);
    margin: 6px 4px;
}

/* 视角 Tab（calendar 页用） */
.btmp-view-tab {
    display: inline-flex;
    background: var(--btmp-surface-muted);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.btmp-view-tab a {
    padding: 6px 18px;
    border-radius: 8px;
    color: var(--btmp-text-subtle);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.btmp-view-tab a.active {
    background: var(--btmp-surface);
    color: var(--btmp-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btmp-view-tab a:hover:not(.active) {
    color: var(--btmp-primary);
}

.btmp-view-tab-wrap {
    max-width: var(--btmp-shell-max, 1400px);
    margin: 14px auto 0;
    padding: 0 var(--btmp-shell-pad-x, 24px);
}

@media (max-width: 900px) {
    .btmp-topbar { padding: 0 12px; }
    .btmp-topbar-mode { display: none; }
}

@media (max-width: 600px) {
    .btmp-topbar {
        width: 100%;
        padding: 0 10px;
        gap: 6px;
        overflow: visible;
    }
    .btmp-topbar-logo {
        font-size: 18px;
        letter-spacing: .04em;
        gap: 5px;
        flex: 0 0 auto;
        margin-right: 0;
        white-space: nowrap;
    }
    .btmp-topbar-guide { padding: 6px 4px; font-size: 12px; }
    .btmp-topbar-spacer {
        min-width: 0;
    }
    .btmp-topbar-theme {
        margin: 0;
    }
    .btmp-topbar-user {
        flex: 0 0 auto;
        padding: 4px;
    }
    .btmp-topbar-user > span:not(.btmp-topbar-avatar) {
        display: none;
    }
}
