/* ═══════════════════════════════════════════════════
   页眉导航栏小部件
   ═══════════════════════════════════════════════════ */

/* ── 导航栏容器 ── */
.hnav-bar {
    width: 100%;
    height: 56px;
    background: #fff;
    color: #333;
    position: relative;
    z-index: 999;
    transition: background .3s, color .3s, box-shadow .3s;
}

/* JS 控制：固定到顶部 */
.hnav-bar.hnav-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
}

/* 占位符，防止固定后内容跳动 */
.hnav-spacer {
    display: none;
}

.hnav-spacer.is-active {
    display: block;
}

/* 滚动后：半透明 + 毛玻璃 */
.hnav-bar.hnav-scrolled {
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
}

/* 透明模式滚动后也切换为毛玻璃 */
.hnav-bar.hnav-transparent.hnav-scrolled {
    background: rgba(255, 255, 255, .82);
    color: #333;
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
}

.hnav-bar.hnav-transparent.hnav-scrolled .hnav-menu-list > li > a {
    color: #333;
}

.hnav-bar.hnav-transparent.hnav-scrolled .hnav-action-link {
    color: #333;
}

.hnav-bar.hnav-transparent.hnav-scrolled .hnav-hamburger {
    color: #333;
}

/* 透明+浅色 滚动后 Logo 切回深色版 */
.hnav-bar.hnav-light.hnav-scrolled .hnav-logo-dark {
    display: block !important;
}

.hnav-bar.hnav-light.hnav-scrolled .hnav-logo-light {
    display: none !important;
}

.hnav-bar.hnav-border {
    border-bottom: 1px solid #eee;
}

/* 透明模式：不占空间，悬浮在内容上方 */
.hnav-bar.hnav-transparent {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    border-bottom: none;
}

/* 透明模式滚动后：fixed 必须覆盖 absolute */
.hnav-bar.hnav-transparent.hnav-fixed {
    position: fixed;
}

/* 浅色（白字）模式 */
.hnav-bar.hnav-light {
    color: #fff;
}

.hnav-bar.hnav-light .hnav-menu-list > li > a {
    color: #fff;
}

.hnav-bar.hnav-light .hnav-menu-list > li > a:hover {
    opacity: .85;
}

.hnav-bar.hnav-light .hnav-menu-list > li > a::after {
    background-color: #fff;
}

.hnav-bar.hnav-light .hnav-action-link {
    color: #fff;
}

.hnav-bar.hnav-light .hnav-action-link::after {
    background-color: #fff;
}

/* 滚动置顶后下划线恢复默认颜色 */
.hnav-bar.hnav-light.hnav-scrolled .hnav-menu-list > li > a::after {
    background-color: #6c5ce7;
}

.hnav-bar.hnav-light.hnav-scrolled .hnav-action-link::after {
    background-color: #6c5ce7;
}


.hnav-bar.hnav-light .hnav-menu-list .sub-menu {
    background: #fff;
    color: #333;
}

.hnav-bar.hnav-light .hnav-menu-list .sub-menu a {
    color: #333;
}

/* Logo 切换：默认只显示 dark，light 模式切换 */
.hnav-bar .hnav-logo-light {
    display: none !important;
}

.hnav-bar .hnav-logo-dark {
    display: block !important;
}

.hnav-bar.hnav-light .hnav-logo-dark {
    display: none !important;
}

.hnav-bar.hnav-light .hnav-logo-light {
    display: block !important;
}

/* ── 内层容器（100% 宽度） ── */
.hnav-inner {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-sizing: border-box;
}

/* ── Logo ── */
.hnav-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.hnav-logo img {
    width: 120px;
    height: auto;
    display: block;
}

/* ═══════════════════════════════════════════════════
   桌面导航菜单（wp_nav_menu 输出）
   ═══════════════════════════════════════════════════ */
.hnav-desktop-menu {
    flex: 1;
    min-width: 0;
}

.hnav-menu-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hnav-menu-list > li {
    position: relative;
    margin-right: 28px;
}

.hnav-menu-list > li:last-child {
    margin-right: 0;
}

.hnav-menu-list > li > a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 4px 0;
    transition: color .2s;
}

/* 下划线动画：左到右 */
.hnav-menu-list > li > a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background-color: #6c5ce7;
    border-radius: 1px;
    transition: width .3s ease;
}

.hnav-menu-list > li > a:hover::after,
.hnav-menu-list > li.current-menu-item > a::after,
.hnav-menu-list > li.current-menu-ancestor > a::after {
    width: 100%;
}

.hnav-menu-list > li.current-menu-item > a,
.hnav-menu-list > li.current-menu-ancestor > a {
    color: #6c5ce7;
}

/* ── 桌面下拉菜单 ── */
.hnav-menu-list .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 12px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
    padding: 8px 0;
    min-width: 140px;
    list-style: none;
    z-index: 1000;
}

.hnav-menu-list .sub-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

.hnav-menu-list > li:hover > .sub-menu {
    display: block;
}

.hnav-menu-list .sub-menu li a {
    display: block;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.hnav-menu-list .sub-menu li a:hover {
    background: #f5f5f5;
    color: #6c5ce7;
}

/* 移除链接点击后的虚线边框 */
.hnav-bar a:focus,
.hnav-bar a:active,
.hnav-bar button:focus,
.hnav-user-dropdown a:focus,
.hnav-user-dropdown a:active {
    outline: none !important;
    box-shadow: none !important;
}

/* ── 右侧操作区 ── */
.hnav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

/* 操作链接（投稿赚钱、开通会员、登录） */
.hnav-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 300;
    white-space: nowrap;
    position: relative;
    transition: color .2s;
}

.hnav-action-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background-color: #6c5ce7;
    border-radius: 1px;
    transition: width .3s ease;
}

.hnav-action-link:hover::after {
    width: 100%;
}

/* VIP 链接（三角+渐变背景） */
.hnav-vip-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.hnav-vip-link .hnav-diamond-icon {
    margin-right: 4px;
}

.hnav-vip-triangle {
    width: 0;
    height: 0;
    border-right: 5px solid #FB00FF;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.hnav-vip-text {
    display: inline-block;
    padding: 0 9px;
    height: 20px;
    background: linear-gradient(90.3deg, #FB00FF -0.82%, #FF7900 98.16%);
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 400;
    text-align: center;
    line-height: 20px;
    border-radius: 8px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* 钻石图标 */
.hnav-diamond-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

/* 透明底白色模式：钻石轮廓变白 */
.hnav-bar.hnav-light .hnav-diamond-outline {
    fill: #fff !important;
}

/* 滚动后轮廓恢复深色 */
.hnav-bar.hnav-light.hnav-scrolled .hnav-diamond-outline {
    fill: #1A1A1A !important;
}

/* 用户头像 */
.hnav-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.hnav-avatar {
    display: inline-flex;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
}

.hnav-avatar-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hnav-avatar-badge svg {
    width: 14px;
    height: 14px;
}

.hnav-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* ── 用户下拉面板 ── */
.hnav-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 240px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .2s, visibility .2s, transform .2s;
    z-index: 9999;
    overflow: hidden;
}

.hnav-avatar-wrap::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 14px;
}

.hnav-avatar-wrap:hover .hnav-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 面板头部 */
.hnav-ud-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 14px;
}

.hnav-ud-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hnav-ud-info {
    min-width: 0;
}

.hnav-ud-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hnav-ud-id {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* VIP 行 */
.hnav-ud-vip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    margin: 0 12px 0;
    background: #f5f5f7;
    border-radius: 8px;
}

.hnav-ud-vip-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.hnav-ud-vip-label {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.hnav-ud-vip-expire {
    margin-left: auto;
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.hnav-ud-vip-btn {
    margin-left: auto;
    display: inline-block;
    padding: 3px 12px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%) !important;
    color: #fff !important;
    font-size: 10px;
    font-weight: 500;
    border-radius: 14px;
    text-decoration: none;
    transition: opacity .2s;
}

.hnav-ud-vip-btn:hover {
    opacity: .85;
}

/* 菜单列表 */
.hnav-ud-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.hnav-ud-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 26px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    transition: background .15s;
}

.hnav-ud-menu li a:hover {
    background: #f7f7f8;
}

.hnav-ud-menu li a svg {
    flex-shrink: 0;
    color: #999;
}

.hnav-ud-extra {
    margin-left: auto;
    font-size: 13px;
    color: #999;
}

/* 底部退出 */
.hnav-ud-footer {
    border-top: 1px solid #f0f0f0;
    padding: 4px 0;
}

.hnav-ud-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 26px;
    font-size: 12px;
    color: #999;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.hnav-ud-footer a:hover {
    background: #f7f7f8;
    color: #e74c3c;
}

.hnav-ud-footer a svg {
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   汉堡按钮（仅手机/平板显示）
   ═══════════════════════════════════════════════════ */
.hnav-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    color: inherit;
    transition: background .2s;
}

.hnav-hamburger:hover {
    background: rgba(0, 0, 0, .06);
}

.hnav-hamburger svg {
    display: block;
    flex-shrink: 0;
}

.hnav-bar.hnav-light .hnav-hamburger {
    color: #fff;
}

.hnav-bar.hnav-light .hnav-hamburger:hover {
    background: rgba(255, 255, 255, .15);
}

.hnav-bar.hnav-light.hnav-scrolled .hnav-hamburger {
    color: #333;
}

.hnav-bar.hnav-light.hnav-scrolled .hnav-hamburger:hover {
    background: rgba(0, 0, 0, .06);
}

/* ═══════════════════════════════════════════════════
   侧边栏（手机/平板）
   ═══════════════════════════════════════════════════ */
.hnav-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 10000;
    opacity: 0;
    transition: opacity .3s;
}

.hnav-sidebar-overlay.is-open {
    display: block;
    opacity: 1;
}

.hnav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: #fff;
    z-index: 10001;
    transform: translateX(-100%);
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, .1);
}

.hnav-sidebar.is-open {
    transform: translateX(0);
}

.hnav-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.hnav-sidebar-header .hnav-logo img {
    width: 100px;
    height: auto;
}

.hnav-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #666;
    border-radius: 6px;
    transition: background .15s;
}

.hnav-sidebar-close:hover {
    background: #f5f5f5;
}

/* 侧边栏菜单列表 */
.hnav-sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.hnav-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hnav-sidebar-list li {
    position: relative;
}

.hnav-sidebar-list li a {
    display: block;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    transition: background .15s;
}

.hnav-sidebar-list li a:hover {
    background: #f7f7f7;
}

.hnav-sidebar-list li.current-menu-item > a {
    color: #6c5ce7;
}

/* 子菜单折叠 */
.hnav-sidebar-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: #fafafa;
}

.hnav-sidebar-list li.hnav-sub-open > .sub-menu {
    max-height: 500px;
}

.hnav-sidebar-list .sub-menu li a {
    padding: 10px 24px 10px 40px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

/* 子菜单展开箭头 */
.hnav-sub-toggle {
    position: absolute;
    right: 12px;
    top: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s;
    color: #999;
}

.hnav-sub-toggle:hover {
    background: #f0f0f0;
}

.hnav-sub-toggle svg {
    transition: transform .25s;
}

li.hnav-sub-open > .hnav-sub-toggle svg {
    transform: rotate(180deg);
}

/* 侧边栏底部 */
.hnav-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hnav-sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.hnav-sidebar-user:hover {
    color: #6c5ce7;
}

/* ═══════════════════════════════════════════════════
   响应式：平板 (≤1024px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .hnav-inner {
        gap: 20px;
    }

    .hnav-menu-list > li {
        margin-right: 18px;
    }
}

/* ═══════════════════════════════════════════════════
   响应式：手机 (≤768px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hnav-inner {
        gap: 12px;
    }

    /* 隐藏桌面菜单 */
    .hnav-desktop-menu {
        display: none !important;
    }

    /* 显示汉堡按钮 */
    .hnav-hamburger {
        display: flex;
    }

    /* 隐藏桌面端文字链接、VIP、头像 */
    .hnav-action-link {
        display: none;
    }

    .hnav-vip-link {
        display: none;
    }

    .hnav-avatar {
        display: none;
    }

    .hnav-logo img {
        width: 90px;
    }
}
