﻿/* ========================================
   般若鲲企业官网 - 头部导航栏样式
   ========================================
   
   目录：
   1. 头部容器 - .header
   2. Logo区域 - .logo
   3. 主导航 - .main-nav / .nav-list
   4. 下拉菜单 - .dropdown
   5. 头部右侧 - .header-right
   6. 移动端适配 - .mobile-menu-btn
   7. 响应式断点 - @media queries

   颜色变量（来自variables.css）：
   - --primary: 主色调（深蓝 #0d2b5c）
   - --accent: 强调色（橙色 #f60）
   - --text-white: 白色文字
   ======================================== */

/* ========================================
   1. 头部容器
   ======================================== */

/* 固定顶部导航栏 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  transition: all var(--transition-base);
}

/* 透明头部（用于首页英雄区） */
.header.transparent {
  background: transparent;
}

/* 滚动后的头部样式（背景变深+阴影） */
.header.scrolled {
  background: rgba(13, 43, 92, 0.98);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

/* 头部内部容器：Logo + 导航 + 右侧区域 */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 20px;
}

/* ========================================
   2. Logo区域
   ======================================== */

/* Logo容器：水平排列、flex弹性布局 */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}

/* 文字Logo基础样式 */
.logo-text {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

/* 中文品牌名：较大字号 */
.logo-text--header {
  font-size: 26px;
  letter-spacing: 2px;
}

/* 英文品牌名：较小字号、浅色显示 */
.logo-text--header-en {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.7);
}

/* Logo悬停效果 */
.logo:hover .logo-text {
  opacity: 0.85;
}

/* 图片Logo（备用兼容方案） */
.logo-img {
  height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  transition: opacity var(--transition-fast);
}

/* 图片Logo悬停效果 */
.logo:hover .logo-img {
  opacity: 0.85;
}

/* ========================================
   3. 主导航
   ======================================== */

/* 主导航容器 */
.main-nav {
  display: flex;
  align-items: center;
  height: 100%;
}

/* 导航列表：水平排列 */
.nav-list {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
}

/* 导航项：相对定位、垂直居中 */
.nav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

/* 导航链接样式 */
.nav-item > a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 18px;
  height: 100%;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

/* 导航链接：悬停状态 */
.nav-item > a:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
}

/* 激活状态：仅在非悬停时显示 */
.nav-item.active:not(:hover) > a {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
}

/* 导航链接底部指示器：橙色小条 */
.nav-item > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 30px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: transform var(--transition-base);
}

/* 悬停时显示底部指示器 */
.nav-item > a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* 激活状态底部指示器：仅在非悬停时显示 */
.nav-item.active:not(:hover) > a::after {
  transform: translateX(-50%) scaleX(1);
}

/* ========================================
   4. 下拉菜单箭头
   ======================================== */

/* 下拉箭头：CSS三角形 */
.nav-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  margin-left: 4px;
  transition: transform var(--transition-fast);
}

/* 悬停时箭头旋转180度 */
.nav-item:hover .nav-arrow {
  transform: rotate(180deg);
}

/* PC端隐藏分类标题（仅移动端显示） */
.nav-category {
  display: none;
}

/* ========================================
   5. 下拉菜单
   ======================================== */

/* 下拉菜单容器：绝对定位、初始隐藏 */
.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 200px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: 8px 0;
  z-index: 100;
}

/* 导航项悬停时显示下拉菜单 */
.nav-item:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 下拉菜单项链接 */
.dropdown a {
  display: block;
  padding: 12px 24px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  background: transparent !important;
}

/* 下拉菜单项悬停效果 */
.dropdown a:hover {
  background: var(--bg-secondary) !important;
  color: var(--primary);
  padding-left: 28px;
}

/* ========================================
   6. 头部右侧区域
   ======================================== */

/* 右侧区域容器 */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* 语言切换 */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch a {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.lang-switch a:hover,
.lang-switch a.active {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.15);
}

/* 头部联系电话 */
.header-phone {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--accent);
  font-weight: 500;
}

.header-phone svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   7. 移动端菜单按钮（汉堡菜单）
   ======================================== */

/* 汉堡按钮：初始隐藏，仅在小屏幕显示 */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 1001;
  background: none;
  border: none;
}

/* 汉堡按钮的三条横线 */
.mobile-menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-white);
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* 汉堡按钮激活状态：变成X */
.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   8. 内页头部样式
   ======================================== */

/* 非首页的内页头部：固定显示深蓝色背景 */
.header.header-page {
  background: var(--primary);
}

/* ========================================
   响应式断点
   ======================================== */

/* 大屏幕（<=1200px）：缩小导航间距 */
@media (max-width: 1200px) {
  .nav-item > a {
    padding: 0 14px;
    font-size: 14px;
  }
}

/* 平板/小笔记本（<=992px）：显示汉堡菜单 */
@media (max-width: 992px) {
  /* 显示汉堡菜单按钮 */
  .mobile-menu-btn {
    display: flex;
  }

  /* 隐藏右侧区域（语言+电话） */
  .header-right {
    display: none;
  }

  /* 主导航变为侧边栏 */
  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: var(--primary);
    padding: 80px 0 30px;
    overflow-x: hidden;
    overflow-y: auto;
    transition: right var(--transition-base);
    z-index: 999;
    /* 强制滚动条样式稳定 */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  }

  /* Webkit 滚动条样式 */
  .main-nav::-webkit-scrollbar {
    width: 4px;
  }

  .main-nav::-webkit-scrollbar-track {
    background: transparent;
  }

  .main-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
  }

  /* 侧边栏打开状态 */
  .main-nav.open {
    right: 0;
  }

  /* 导航列表改为垂直排列 */
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    height: auto;
  }

  .nav-item {
    height: auto;
    flex-direction: column;
  }

  .nav-item > a {
    padding: 12px 24px;
    height: auto;
    color: rgba(255, 255, 255, 0.85);
    justify-content: space-between;
  }

  /* 移动端隐藏底部指示器 */
  .nav-item > a::after {
    display: none;
  }

  /* 移动端：有子菜单的导航项隐藏链接，显示分类标题 */
  .nav-item.has-children > a {
    display: none !important;
  }

  /* 一级菜单分类标题（带底色框）- 仅移动端显示 */
  .nav-category {
    display: block;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent);
    cursor: default;
    user-select: none;
    margin: 2px 10px;
    box-sizing: border-box;
    width: calc(100% - 20px);
    border-radius: 2px;
  }

  /* 移动端首页按钮样式 - 与其他一级菜单宽度一致 */
  .nav-item[data-page="index"] > a {
    display: block !important;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent);
    margin: 2px 10px;
    box-sizing: border-box;
    width: calc(100% - 20px);
    border-radius: 2px;
  }

  .nav-item[data-page="index"] > a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-white);
  }

  /* 移动端选中状态：橙色左边框，字体保持可见 */
  .nav-item.active > a {
    background: rgba(255, 255, 255, 0.12);
    color: var(--accent);
  }

  .nav-item.active > a:hover {
    color: var(--text-white);
  }

  /* 移动端：下拉菜单变为垂直嵌套列表，默认全部展开 */
  .dropdown {
    position: static;
    transform: none !important;
    opacity: 1;
    visibility: visible;
    min-width: 100%;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    max-height: none;
    overflow: visible;
  }

  /* 移动端移除展开/收起动画 */
  .nav-item.dropdown-open .dropdown {
    max-height: none;
  }

  /* 子菜单项：明显缩进+左侧装饰线 */
  .dropdown a {
    padding: 8px 36px 8px 48px;
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    transition: background-color 0.15s, color 0.15s;
  }

  /* 左侧装饰线（使用伪元素，不会影响布局） */
  .dropdown a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.15);
    transition: background-color 0.15s;
  }

  /* 左侧圆点装饰 */
  .dropdown a::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: background-color 0.15s;
  }

  .dropdown a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
  }

  .dropdown a:hover::before {
    background: var(--accent);
  }

  .dropdown a:hover::after {
    background: var(--accent);
  }

  /* 移动端遮罩层 */
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
  }

  .nav-overlay.show {
    display: block;
  }
}

/* 手机（<=576px）：进一步调整 */
@media (max-width: 576px) {
  /* 隐藏英文Logo，只显示中文 */
  .logo-text--header-en {
    display: none;
  }

  /* 侧边栏宽度调整为280px */
  .main-nav {
    width: 280px;
  }
}
