/* ============================================================
   川渝好门户 - 导航栏系统 v5.0
   12项主导航 + 二级导航，川渝地方门户风格
   ============================================================ */

/* ========== 导航栏容器 ========== */
#nv-bar {
  background: var(--cy-primary);
  position: relative;
  z-index: 999;
  box-shadow: var(--cy-shadow-lg);
}

#nv-bar .wp {
  max-width: var(--cy-container);
  margin: 0 auto;
  padding: 0 var(--cy-space-4);
}

/* ========== 导航列表 ========== */
#nv {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: var(--cy-nav-h);
  overflow-x: auto;
  scrollbar-width: none;
}

#nv::-webkit-scrollbar { display: none; }

#nv li {
  position: relative;
  flex-shrink: 0;
}

/* ========== 导航链接 ========== */
#nv li > a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--cy-space-3);
  height: var(--cy-nav-h);
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--cy-text-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--cy-transition);
  position: relative;
}

#nv li > a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* ========== 当前激活态 ========== */
#nv li.a > a {
  color: #fff;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}

#nv li.a > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: #fff;
  border-radius: 3px 3px 0 0;
}

/* ========== 导航图标 ========== */
#nv .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ========== 悬浮高亮 ========== */
#nv li:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ========== 徽章 ========== */
.nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  background: var(--cy-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--cy-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-badge-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--cy-danger);
  border-radius: var(--cy-radius-full);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========== 二级导航栏 ========== */
#sub-nv-bar {
  background: linear-gradient(180deg, #fff 0%, #f8f9fa 100%);
  border-bottom: 2px solid var(--cy-primary);
  position: relative;
  z-index: 998;
}

#sub-nv-bar .wp {
  max-width: var(--cy-container);
  margin: 0 auto;
  padding: 0 var(--cy-space-4);
}

/* 二级面板 - 默认隐藏，两行显示 */
.sub-nv-panel {
  display: none;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 0;
  align-items: flex-start;
  align-content: flex-start;
  animation: subNvFadeIn 0.3s ease;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cy-gray-300) transparent;
}

.sub-nv-panel::-webkit-scrollbar {
  height: 3px;
}

.sub-nv-panel::-webkit-scrollbar-track {
  background: transparent;
}

.sub-nv-panel::-webkit-scrollbar-thumb {
  background: var(--cy-gray-300);
  border-radius: 3px;
}

.sub-nv-panel.show {
  display: flex;
}

@keyframes subNvFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 欢迎语 */
.sub-nv-welcome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--cy-primary-bg) 0%, #fff 100%);
  border-radius: var(--cy-radius);
  border-left: 3px solid var(--cy-primary);
}

.sub-nv-welcome-icon {
  font-size: 20px;
  line-height: 1;
}

.sub-nv-welcome-text {
  color: var(--cy-text);
  font-size: 14px;
  font-weight: 500;
}

/* 二级链接 - 卡片式 */
.sub-nv-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 34px;
  color: var(--cy-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--cy-transition);
  border-radius: var(--cy-radius);
  background: #fff;
  border: 1px solid var(--cy-border);
  position: relative;
  animation: subNvLinkIn 0.3s ease both;
}

.sub-nv-panel.show .sub-nv-link:nth-child(1) { animation-delay: 0.02s; }
.sub-nv-panel.show .sub-nv-link:nth-child(2) { animation-delay: 0.04s; }
.sub-nv-panel.show .sub-nv-link:nth-child(3) { animation-delay: 0.06s; }
.sub-nv-panel.show .sub-nv-link:nth-child(4) { animation-delay: 0.08s; }
.sub-nv-panel.show .sub-nv-link:nth-child(5) { animation-delay: 0.10s; }
.sub-nv-panel.show .sub-nv-link:nth-child(6) { animation-delay: 0.12s; }
.sub-nv-panel.show .sub-nv-link:nth-child(7) { animation-delay: 0.14s; }
.sub-nv-panel.show .sub-nv-link:nth-child(8) { animation-delay: 0.16s; }
.sub-nv-panel.show .sub-nv-link:nth-child(9) { animation-delay: 0.18s; }
.sub-nv-panel.show .sub-nv-link:nth-child(10) { animation-delay: 0.20s; }

@keyframes subNvLinkIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sub-nv-link:hover {
  color: var(--cy-primary);
  background: var(--cy-primary-bg);
  border-color: var(--cy-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.12);
}

.sub-nv-link.a {
  color: #fff;
  font-weight: 600;
  background: var(--cy-primary);
  border-color: var(--cy-primary);
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.25);
}

.sub-nv-link.a:hover {
  color: #fff;
  background: var(--cy-primary-dark);
  border-color: var(--cy-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

/* 图标 - 通过 data-icon 属性显示 */
.sub-nv-link::before {
  content: attr(data-icon);
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

/* 标签文字 */
.sub-nv-link-label {
  line-height: 1.2;
}

/* 热门标签 */
.sub-nv-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.sub-nv-tag.hot {
  color: #fff;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  box-shadow: 0 1px 3px rgba(255, 71, 87, 0.3);
}

.sub-nv-tag.rec {
  color: #fff;
  background: linear-gradient(135deg, #ffa502, #ffc048);
  box-shadow: 0 1px 3px rgba(255, 165, 2, 0.3);
}

/* 分隔符 - 隐藏 */
.sub-nv-sep {
  display: none;
}

/* 占位文本 */
.sub-nv-placeholder {
  color: var(--cy-text-muted);
  font-size: 12px;
  letter-spacing: 2px;
  padding: 0 var(--cy-space-2);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  #nv li > a {
    padding: 0 var(--cy-space-2);
    font-size: var(--cy-text-sm);
  }
}

@media (max-width: 768px) {
  #nv-bar { display: none; }
  #sub-nv-bar { display: none; }
}

/* ========== 无障碍 ========== */
#nv li > a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.sub-nv-link:focus-visible {
  outline: 2px solid var(--cy-primary);
  outline-offset: -2px;
  border-radius: 4px;
}
