/* ===== 前端UI — 前台导航栏样式 ===== */
/* 基于 RiPro-v2/zpro 主题核心样式提取并泛化 */

/* ── 基础重置 ── */
.np-header * { box-sizing: border-box; }

/* ── Header 容器 ── */
.np-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  height: 72px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.05);
  transition: background .3s ease, box-shadow .3s ease, border-color .3s ease, backdrop-filter .3s ease;
}
.np-sticky { position: sticky; top: 0; }
.np-fixed { position: fixed; }
.np-header:not(.np-fixed):not(.np-sticky) { position: relative; }
.np-gap { height: 72px; }
body.np-menu-open { overflow: hidden; }

/* ── 内部布局 ── */
.np-container { max-width: 1200px; margin: 0 auto; padding: 0 15px; height: 100%; }
.np-navbar {
  display: flex; align-items: center; height: 100%;
  justify-content: flex-start; flex-wrap: nowrap;
  position: relative;
}

/* ── Logo ── */
.np-logo-wrapper { flex-shrink: 0; }
.np-logo-wrapper a {
  display: flex; align-items: center; font-size: 22px; font-weight: 800;
  color: var(--np-text, #243047); text-decoration: none; height: 72px;
  letter-spacing: 0;
}
.np-logo { max-height: 44px; width: auto; display: block; }
.np-sep { flex: 1 1 auto; min-width: 24px; }
/* classic: sep fills space between menu and actions */
.np-layout-classic .np-sep { flex: 1 1 auto; }
.np-layout-classic .np-main-menu { margin-left: 36px; flex-shrink: 0; }
/* center-menu: menu absolutely centered over the spacer, sep pushes actions right */
.np-layout-center-menu .np-sep { flex: 1 1 auto; }
.np-layout-center-menu .np-main-menu {
  position: absolute; left: 50%; top: 0;
  transform: translateX(-50%);
  margin-left: 0; margin-right: 0; flex-shrink: 0; z-index: 2;
}
.np-layout-center-menu .np-navbar { position: relative; }
/* split: order logo(0) sep(1) menu(2) actions(3); sep pushes menu right */
.np-layout-split .np-logo-wrapper { order: 0; }
.np-layout-split .np-sep { order: 1; flex: 1 1 auto; }
.np-layout-split .np-main-menu { order: 2; flex-shrink: 0; margin-left: 0; margin-right: 24px; }
.np-layout-split .np-actions { order: 3; }

/* ── 菜单 ── */
.np-main-menu { display: flex; align-items: center; min-width: 0; margin-left: 36px; }
.np-nav-list {
  display: flex; list-style: none; margin: 0; padding: 0; gap: 22px;
}
.np-menu-item { position: relative; }

/* 菜单文字链接 */
.np-menu-item > a {
  display: flex; align-items: center; height: 72px;
  padding: 0 4px; font-size: 16px; font-weight: 700;
  color: var(--np-text, #243047); text-decoration: none;
  white-space: nowrap; transition: color .2s ease, transform .2s ease;
  position: relative;
}
.np-menu-item > a:hover { color: var(--np-theme, #4d6bfe); transform: translateY(-1px); }
.np-menu-item.current-menu-item > a,
.np-menu-item.current-menu-parent > a {
  color: var(--np-theme, #4d6bfe);
}

/* 当前菜单下划线指示器 */
.np-menu-item.current-menu-item > a::after {
  content: ''; position: absolute; bottom: 14px; left: 4px; right: 4px;
  height: 3px; background: var(--np-theme, #4d6bfe); border-radius: 99px;
}

/* ── 下拉菜单（通用） ── */
.np-sub-menu {
  position: absolute; top: 100%; left: 50%; z-index: 100;
  width: 360px; max-width: calc(100vw - 32px);
  max-height: min(520px, calc(100vh - 120px));
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  padding: 18px 14px; margin: 0; list-style: none;
  background: rgba(255,255,255,.98); border-radius: 10px;
  box-shadow: 0 20px 50px rgba(15,23,42,.15), 0 4px 12px rgba(15,23,42,.08);
  opacity: 0; visibility: hidden;
  transform: translate(-50%, 14px) scale(.97);
  transform-origin: top center;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.12) transparent;
}
.np-sub-menu::-webkit-scrollbar { width: 0; height: 0; }
.np-sub-menu::-webkit-scrollbar-track { background: transparent; }
.np-sub-menu::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 99px; }
.np-has-children:hover > .np-sub-menu {
  opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1);
}
.np-has-children > .np-sub-menu::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 12px; height: 12px;
  background: rgba(255,255,255,.98);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  box-shadow: -2px -2px 6px rgba(15,23,42,.04);
  z-index: -1;
}

/* 下拉项 */
.np-sub-item { position: relative; }
.np-sub-item > a {
  display: flex; align-items: center; min-height: 38px; padding: 0 10px 0 24px;
  font-size: 14px; font-weight: 600; color: #344256; text-decoration: none;
  transition: color .18s ease, background .18s ease, padding-left .18s ease;
  white-space: nowrap; border-radius: 7px;
  text-shadow: none !important;
}
.np-sub-item > a:hover { background: #f6f8ff; color: var(--np-theme, #4d6bfe); padding-left: 28px; }
.np-sub-item::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 99px;
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  background: #72d8d2; opacity: .85;
}
.np-sub-item:nth-child(2n)::before { background: #ff7785; }
.np-sub-item:nth-child(3n)::before { background: #8aa5ff; }
.np-sub-item:nth-child(4n)::before { background: #f8c35b; }
.np-sub-item:nth-child(5n)::before { background: #4ecdc4; }
.np-sub-item:nth-child(6n)::before { background: #a78bfa; }

/* 三级菜单（右侧展开） */
.np-sub-sub {
  left: 100%; top: -16px; width: 240px;
  grid-template-columns: 1fr;
  transform: translate(12px, 0) scale(.98);
}
.np-sub-item:hover > .np-sub-sub {
  opacity: 1; visibility: visible; transform: translate(0, 0) scale(1);
}
.np-sub-sub::before {
  display: none;
}

/* ── 箭头 ── */
.np-arrow {
  display: none; cursor: pointer;
}
.np-has-children > .np-arrow {
  display: inline-flex;
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: .72;
  pointer-events: none;
}

/* ── 右侧操作区 ── */
.np-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.np-vip-btn,
.np-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  border: 2px solid rgba(77,107,254,.62);
  background: transparent;
  color: var(--np-theme, #4d6bfe);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.np-vip-btn { gap: 6px; }
.np-vip-btn:hover,
.np-auth-btn:hover {
  color: #fff !important;
  background: var(--np-theme, #4d6bfe);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(77, 107, 254, .28);
}
.np-vip-icon {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(77,107,254,.48);
  border-radius: 2px;
  display: inline-block;
  background:
    linear-gradient(135deg, transparent 42%, #78b75b 43% 68%, transparent 69%),
    linear-gradient(45deg, transparent 50%, #9cc7ff 51%);
  background-color: #fff;
}
.np-auth-or {
  color: var(--np-theme, #4d6bfe);
  font-weight: 800;
  font-size: 15px;
  padding: 0 4px;
}

/* 已登录用户按钮 */
.np-user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: 8px;
  color: var(--np-text, #243047); text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: background .2s ease, color .2s ease, transform .2s ease;
  border: 2px solid transparent;
}
.np-user-btn:hover {
  background: #f4f6fa; color: var(--np-theme, #4d6bfe);
  transform: translateY(-1px);
}
.np-avatar { border-radius: 50%; width: 28px; height: 28px; object-fit: cover; flex-shrink: 0; border: 2px solid rgba(77,107,254,.18); }
.np-user-name { white-space: nowrap; }
.np-style-solid .np-vip-btn,
.np-style-solid .np-auth-btn,
.np-style-glass.is-scroll .np-vip-btn,
.np-style-glass.is-scroll .np-auth-btn,
.np-style-transparent.is-scroll .np-vip-btn,
.np-style-transparent.is-scroll .np-auth-btn,
.np-style-gradient.is-scroll .np-vip-btn,
.np-style-gradient.is-scroll .np-auth-btn {
  color: var(--np-theme, #4d6bfe);
}
.np-style-solid .np-vip-btn:hover,
.np-style-solid .np-auth-btn:hover,
.np-style-glass.is-scroll .np-vip-btn:hover,
.np-style-glass.is-scroll .np-auth-btn:hover,
.np-style-transparent.is-scroll .np-vip-btn:hover,
.np-style-transparent.is-scroll .np-auth-btn:hover,
.np-style-gradient.is-scroll .np-vip-btn:hover,
.np-style-gradient.is-scroll .np-auth-btn:hover {
  color: #fff;
}

/* 搜索按钮 */
.np-search-btn {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: none; background: transparent;
  color: var(--np-text, #243047); cursor: pointer; border-radius: 50%;
  transition: background .2s, color .2s, transform .2s ease;
}
.np-search-btn:hover { background: #f0f2f5; color: var(--np-theme, #4d6bfe); transform: translateY(-1px); }

/* ── 汉堡菜单 ── */
.np-burger {
  display: none; width: 26px; height: 22px; position: relative;
  background: none; border: none; cursor: pointer; padding: 0;
}
.np-burger span {
  display: block; width: 100%; height: 2px; background: var(--np-text, #333);
  position: absolute; left: 0; border-radius: 2px;
  transition: all .3s ease;
}
.np-burger span:nth-child(1) { top: 0; }
.np-burger span:nth-child(2) { top: 10px; }
.np-burger span:nth-child(3) { top: 20px; }
.np-burger.is-open span:nth-child(1) { top: 10px; transform: rotate(45deg); }
.np-burger.is-open span:nth-child(2) { opacity: 0; }
.np-burger.is-open span:nth-child(3) { top: 10px; transform: rotate(-45deg); }

/* ── 背景模式 ── */

/* 毛玻璃：始终显示半透明模糊背景 */
.np-style-glass {
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.05);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.np-style-glass.is-scroll { background: rgba(255,255,255,.88); }

/* 透明：顶部完全透明，滚动后变成稳定背景 */
.np-style-transparent { background: transparent; border-bottom: none; }
.np-style-transparent:not(.is-scroll) .np-menu-item > a,
.np-style-transparent:not(.is-scroll) .np-logo-wrapper a,
.np-style-transparent:not(.is-scroll) .np-search-btn,
.np-style-transparent:not(.is-scroll) .np-vip-btn,
.np-style-transparent:not(.is-scroll) .np-auth-btn,
.np-style-transparent:not(.is-scroll) .np-auth-or,
.np-style-transparent:not(.is-scroll) .np-user-btn { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.24); }
.np-style-transparent:not(.is-scroll) .np-burger span { background: #fff; }
.np-style-transparent:not(.is-scroll) .np-avatar { border-color: rgba(255,255,255,.35); }
.np-style-transparent:not(.is-scroll) .np-sub-menu .np-sub-item > a {
  color: #344256 !important;
  text-shadow: none !important;
}
.np-style-transparent.is-scroll {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0,0,0,.05);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* 纯色 */
.np-style-solid { background: #fff; border-bottom: 1px solid rgba(0,0,0,.05); }
.np-style-solid.is-scroll { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* 渐变：顶部有轻微压暗层，滚动后变成稳定背景 */
.np-style-gradient {
  background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.14) 72%, transparent);
  border-bottom: none;
}
.np-style-gradient:not(.is-scroll) .np-menu-item > a,
.np-style-gradient:not(.is-scroll) .np-logo-wrapper a,
.np-style-gradient:not(.is-scroll) .np-search-btn,
.np-style-gradient:not(.is-scroll) .np-vip-btn,
.np-style-gradient:not(.is-scroll) .np-auth-btn,
.np-style-gradient:not(.is-scroll) .np-auth-or,
.np-style-gradient:not(.is-scroll) .np-user-btn { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.24); }
.np-style-gradient:not(.is-scroll) .np-burger span { background: #fff; }
.np-style-gradient:not(.is-scroll) .np-avatar { border-color: rgba(255,255,255,.35); }
.np-style-gradient:not(.is-scroll) .np-sub-menu .np-sub-item > a {
  color: #344256 !important;
  text-shadow: none !important;
}
.np-style-gradient.is-scroll {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0,0,0,.05);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* ── 深色模式 ── */
body.dark .np-header { border-bottom-color: rgba(255,255,255,.04); }
body.dark .np-style-glass { background: rgba(20,20,30,.78); backdrop-filter: saturate(180%) blur(20px); }
body.dark .np-style-glass.is-scroll,
body.dark .np-style-transparent.is-scroll,
body.dark .np-style-gradient.is-scroll { background: rgba(26,26,46,.92); }
body.dark .np-style-solid { background: #1a1a2e; }
body.dark .np-menu-item > a { color: rgba(255,255,255,.85); }
body.dark .np-menu-item > a:hover { color: var(--np-theme, #4d6bfe); }
body.dark .np-sub-menu { background: #22223a; }
body.dark .np-sub-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }
body.dark .np-has-children > .np-sub-menu::before { background: #22223a; }
body.dark .np-sub-item > a { color: rgba(255,255,255,.7); }
body.dark .np-sub-item > a:hover { background: rgba(255,255,255,.08); color: var(--np-theme); }
body.dark .np-burger span { background: rgba(255,255,255,.85); }
body.dark .np-search-btn { color: rgba(255,255,255,.7); }
body.dark .np-search-btn:hover { background: rgba(255,255,255,.08); color: var(--np-theme); }
body.dark .np-user-btn { color: rgba(255,255,255,.85); }
body.dark .np-user-btn:hover { background: rgba(255,255,255,.08); color: var(--np-theme); }
body.dark .np-avatar { border-color: rgba(255,255,255,.18); }

/* ── 响应式 ── */
@media (max-width: 991.98px) {
  .np-main-menu {
    display: block; position: fixed; top: 72px; left: 16px; right: 16px; bottom: auto;
    max-height: calc(100vh - 96px);
    background: rgba(255,255,255,.98); z-index: 999; overflow-y: auto;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15,23,42,.18);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  }
  .np-main-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .np-nav-list { flex-direction: column; padding: 16px; gap: 0; }
  .np-menu-item > a { height: 46px; padding: 0 12px; color: var(--np-text, #333) !important; text-shadow: none !important; }
  .np-sub-menu { position: static; box-shadow: none; opacity: 1; visibility: visible; transform: none; background: #f9fafb; border-radius: 8px; margin: 4px 0; display: none; width: auto; min-width: 0; max-width: none; grid-template-columns: 1fr; padding: 8px; max-height: none; overflow-y: visible; }
  .np-sub-menu::before { display: none; }
  .np-has-children:hover > .np-sub-menu { display: none; }
  .np-has-children.is-open > .np-sub-menu { display: block; }
  .np-sub-sub { left: 0; top: 0; }
  .np-burger { display: block; }
  .np-vip-btn,
  .np-auth-btn { height: 36px; min-width: 58px; padding: 0 10px; font-size: 14px; border-radius: 6px; }
  .np-auth-or { font-size: 14px; padding: 0 2px; }
  .np-user-btn { height: 36px; padding: 0 10px; font-size: 13px; }
  .np-user-name { display: none; }
  .np-avatar { width: 24px; height: 24px; }
  .np-vip-icon { width: 18px; height: 18px; }
  .np-arrow { position: absolute; left: auto; right: 10px; top: 15px; bottom: auto; transform: none; width: 28px; height: 28px; align-items: center; justify-content: center; margin-left: 0; pointer-events: auto; }

  body.dark .np-main-menu { background: #1a1a2e; }
  body.dark .np-sub-menu { background: #22223a; }
}

@media (max-width: 1199.98px) {
  .np-container { padding: 0 24px; }
  .np-main-menu { margin-left: 24px; }
  .np-layout-center-menu .np-main-menu { position: static; transform: none; margin-left: 24px; margin-right: 0; }
  .np-layout-split .np-main-menu { margin-right: 16px; }
  .np-nav-list { gap: 14px; }
  .np-menu-item > a { font-size: 15px; }
  .np-layout-split .np-logo-wrapper,
  .np-layout-split .np-sep,
  .np-layout-split .np-main-menu,
  .np-layout-split .np-actions { order: unset; }
}

@media (max-width: 575.98px) {
  .np-header { height: 64px; }
  .np-gap { height: 64px; }
  .np-logo-wrapper a { height: 64px; font-size: 20px; }
  .np-container { padding: 0 18px; }
  .np-main-menu { margin-left: 0; }
  .np-layout-center-menu .np-main-menu,
  .np-layout-split .np-main-menu { position: fixed; transform: none; margin-left: 0; margin-right: 0; }
  .np-main-menu { top: 64px; }
  .np-layout-split .np-logo-wrapper,
  .np-layout-split .np-sep,
  .np-layout-split .np-main-menu,
  .np-layout-split .np-actions { order: unset; }
}
