/* ==========================================
   nav-unified.css - 橙电统一导航样式
   毛玻璃效果 + 响应式 + 移动端侧滑菜单
   ========================================== */

/* ===== 全局变量 ===== */
:root {
  --nav-height: 64px;
  --nav-mobile-height: 56px;
  --brand-orange: #FF7A00;
  --brand-orange-dark: #E56D00;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --shadow-nav: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-nav-scrolled: 0 4px 20px rgba(0, 0, 0, 0.1);
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 导航外层 ===== */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  z-index: 9999;
  transition: box-shadow var(--transition-fast), background var(--transition-fast);
}

.nav-header.scrolled {
  box-shadow: var(--shadow-nav-scrolled);
  background: rgba(255, 255, 255, 0.98);
}

.nav-container {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== 品牌 Logo ===== */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.nav-brand-text {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.nav-brand-text span {
  color: var(--brand-orange);
}

/* ===== 主导航链接 ===== */
.nav-main {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-main a {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-main a:hover {
  color: var(--brand-orange);
  background: rgba(255, 122, 0, 0.06);
}

.nav-main a.active {
  color: var(--brand-orange);
  background: rgba(255, 122, 0, 0.1);
}

.nav-main a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--brand-orange);
  border-radius: 1px;
}

/* ===== 右侧操作区 ===== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-btn-primary {
  height: 38px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
  color: white;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 19px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.nav-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.35);
}

.nav-btn-secondary {
  height: 38px;
  padding: 0 16px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-btn-secondary:hover {
  color: var(--brand-orange);
  background: rgba(255, 122, 0, 0.06);
}

/* ===== 移动端菜单按钮 ===== */
#nav-mobile-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border-radius: 8px;
  transition: background var(--transition-fast);
}

#nav-mobile-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

#nav-mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #333;
  border-radius: 1px;
  transition: all var(--transition-fast);
}

/* ===== 移动端侧滑菜单 ===== */
#nav-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

#nav-mobile-overlay.show {
  opacity: 1;
  visibility: visible;
}

#nav-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: white;
  z-index: 10001;
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

#nav-mobile-menu.open {
  transform: translateX(0);
}

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

.nav-mobile-header span {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

#nav-mobile-close {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

#nav-mobile-close:hover {
  background: #f5f5f5;
  color: #333;
}

.nav-mobile {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-mobile li {
  margin: 2px 0;
}

.nav-mobile a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #555;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.nav-mobile a:hover {
  color: var(--brand-orange);
  background: rgba(255, 122, 0, 0.04);
  border-left-color: var(--brand-orange);
}

.nav-mobile a.active {
  color: var(--brand-orange);
  background: rgba(255, 122, 0, 0.08);
  border-left-color: var(--brand-orange);
}

.nav-mobile-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-mobile-footer {
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 10px;
}

.nav-mobile-footer .nav-btn-primary,
.nav-mobile-footer .nav-btn-secondary {
  flex: 1;
  justify-content: center;
}

/* ===== 搜索栏 ===== */
#search-bar {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid #eee;
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: all var(--transition-smooth);
  opacity: 0;
}

#search-bar.show {
  max-height: 80px;
  padding: 16px 24px;
  opacity: 1;
}

.search-input-wrap {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.search-input-wrap input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  border: 2px solid #eee;
  border-radius: 22px;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input-wrap input:focus {
  border-color: var(--brand-orange);
}

.search-input-wrap button {
  height: 44px;
  padding: 0 24px;
  background: var(--brand-orange);
  color: white;
  border: none;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* ===== 返回顶部按钮 ===== */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: white;
  border: 1px solid #eee;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-smooth);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 9998;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: white;
  transform: translateY(-2px);
}

/* ===== 响应式断点 ===== */
@media (max-width: 1024px) {
  .nav-main {
    gap: 2px;
  }
  
  .nav-main a {
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: var(--nav-mobile-height);
  }
  
  .nav-header {
    height: var(--nav-mobile-height);
  }
  
  .nav-container {
    padding: 0 16px;
  }
  
  .nav-brand-text {
    font-size: 18px;
  }
  
  .nav-main,
  .nav-actions .nav-btn-secondary {
    display: none;
  }
  
  #nav-mobile-toggle {
    display: flex;
  }
  
  .nav-actions {
    gap: 8px;
  }
  
  .nav-btn-primary {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }
}

/* ===== body顶部补偿 ===== */
body {
  padding-top: var(--nav-height);
}

@media (max-width: 768px) {
  body {
    padding-top: var(--nav-mobile-height);
  }
}
