/* ============ 顶部导航 ============ */
.top-nav {
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-light);
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ★ 三段式 grid：左 logo | 中 nav | 右 admin */
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.2rem;
    justify-self: start;    /* 靠左 */
}
.nav-logo-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .95rem;
    box-shadow: 0 4px 12px -2px rgba(99,102,241,.4);
}
.nav-logo-text span { color: var(--brand-1); }

/* ★ 导航居中：靠 grid 的 auto 列 + justify-content:center */
.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    justify-self: center;
    position: relative;
    /* ★ 关键：允许下拉溢出 */
    overflow: visible;
}

.btn-admin {
    justify-self: end;    /* 靠右 */
    padding: .45rem 1rem;
    border-radius: 8px;
    background: var(--text-main);
    color: #fff;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn-admin:hover { background: var(--brand-1); color: #fff; }

/* ============ 导航项 + 下拉 ============ */
.nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-link-main {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: .5rem .9rem;
    border-radius: 8px;
    color: var(--text-sub);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    transition: all .15s ease;
    white-space: nowrap;
}
.nav-link-main:hover {
    background: var(--bg-soft);
    color: var(--brand-1);
}
.nav-link-main.more-link {
    color: var(--brand-1);
    font-weight: 600;
}
.nav-link-main .fa-chevron-down {
    font-size: .6rem;
    opacity: .55;
    transition: transform .2s ease;
}
.nav-item:hover .nav-link-main .fa-chevron-down {
    transform: rotate(180deg);
}

/* ★ 下拉菜单：默认隐藏，hover 显示；用 padding-top 衔接 hover 区域 */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 12px 32px -8px rgba(15,23,42,.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 1100;
    /* ★ 关键：顶部加透明 padding，桥接触发区 */
    margin-top: 6px;
}
/* 透明桥梁，防止 hover 中断 */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0; right: 0;
    height: 10px;
    background: transparent;
}

.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown a {
    display: block;
    padding: .55rem .85rem;
    border-radius: 8px;
    color: var(--text-sub);
    text-decoration: none;
    font-size: .87rem;
    transition: all .12s ease;
    white-space: nowrap;
}
.nav-dropdown a:hover {
    background: var(--bg-soft);
    color: var(--brand-1);
}

/* 移动端：导航横向滚动，下拉仍 hover（后续可改点击） */
@media (max-width: 900px) {
    .nav-container {
        grid-template-columns: auto 1fr auto;
        gap: .5rem;
    }
    .nav-links {
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
}