/* ============================================================
   公共样式 — 导航栏、用户菜单、回到顶部
   导航栏颜色硬编码为统一深蓝色系，不受各页面 --color-primary 影响
   ============================================================ */

/* ---------- 导航栏专用颜色变量 ---------- */
:root {
    --nav-color-primary: #1a3f6e;
    --nav-color-primary-light: #2b5f95;
}

/* ---------- 顶部导航栏 ---------- */
.navbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    cursor: pointer;
}

.navbar__logo {
    height: 50px;
    width: auto;
}

.navbar__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--nav-color-primary);
    letter-spacing: 0.5px;
}

.navbar__title span { color: #16a34a; }

.navbar__nav {
    display: flex;
    gap: 0.5rem;
}

.navbar__link {
    position: relative;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar__link::after {
    content: "";
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: -0.75rem;
    height: 2px;
    background: var(--nav-color-primary);
    border-radius: 1px;
    opacity: 0;
    transform: scaleX(0.6);
    transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar__link:hover {
    color: var(--nav-color-primary);
    background: rgba(26, 63, 110, 0.06);
    transform: translateY(-1px);
}

.navbar__link--active {
    color: var(--nav-color-primary) !important;
    font-weight: 600;
}

.navbar__link--active::after {
    opacity: 1;
    transform: scaleX(1);
}

/* ---------- 用户头像与下拉菜单 ---------- */
.navbar__user {
    position: relative;
    margin-left: 0.75rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nav-color-primary), var(--nav-color-primary-light));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.user-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 0.4rem;
    display: none;
    z-index: 200;
}

.user-dropdown.active { display: block; }

.user-dropdown__name {
    display: block;
    padding: 0.4rem 0.65rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown__logout {
    display: block;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: none;
    background: none;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.user-dropdown__logout:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* ---------- 悬浮操作面板（回到顶部） ---------- */
.floating-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateX(calc(100% - 4px)) translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    opacity: 0.7;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.floating-panel:hover {
    transform: translateX(0) translateY(-50%);
    opacity: 1;
}

.floating-panel__btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    text-decoration: none;
}

.floating-panel__btn:hover {
    background: var(--nav-color-primary);
    color: #fff;
    border-color: var(--nav-color-primary);
}

.floating-panel__btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.floating-panel__btn--top {
    display: none;
}

.floating-panel__btn--top.visible {
    display: flex;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .navbar { padding: 0.75rem 1.25rem; }
}

@media (max-width: 640px) {
    .navbar__nav { display: none; }
}
