/* ============================================================
   Site Shared Components - Navbar & Footer
   双行布局导航栏（顶部工具栏 + 底部主导航）
   ============================================================ */

:root {
  --site-brand: #000666;
  --site-brand-light: #E0E0FF;
  --site-brand-focus: #BDC2FF;
  --site-text-primary: #191C1E;
  --site-text-secondary: #454652;
  --site-bg-container: #F7F9FC;
  --site-bg-secondary: #F2F4F7;
  --site-bg-page: #ECEEF1;
  --site-border: rgba(198, 197, 212, 0.30);
  --site-success: #21638D;
  --site-navbar-h: 36px;       /* 顶部工具栏高度 */
  --site-navmain-h: 64px;      /* 主导航高度 */
  --site-nav-total: 100px;     /* 总高度 */
}

/* ============ 顶部导航容器 ============ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--site-bg-container);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ============ 顶部工具栏 ============ */
.nav-top {
  height: var(--site-navbar-h);
  background: var(--site-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-top-inner {
  width: 1280px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 64px;
}
.nav-top-left {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.9;
}
.nav-top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* 顶部工具栏语言切换 */
.nav-top .lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.nav-top .lang-switch .lang-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 2px;
  transition: color 0.2s;
}
.nav-top .lang-switch .lang-btn:hover { color: #fff; }
.nav-top .lang-switch .lang-btn.active { color: #fff; }
.nav-top .lang-switch .lang-divider {
  color: rgba(255, 255, 255, 0.3);
}

.nav-top-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-top-link:hover { color: #fff; }
.nav-top-link svg { width: 14px; height: 14px; }
.nav-top .nav-top-user { font-weight: 600; color: #fff; }

/* ============ 主导航栏 ============ */
.nav-main {
  height: var(--site-navmain-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--site-border);
}
.nav-main-inner {
  width: 1280px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 64px;
  gap: 24px;
}

/* Logo */
.site-nav .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.site-nav .logo:hover { transform: scale(1.03); }
.site-nav .logo img { display: block; }
.site-nav .logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--site-brand);
  letter-spacing: 0.5px;
}

/* 类别导航 */
.nav-cats {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  justify-content: center;
}
.nav-cats a {
  font-size: 14px;
  font-weight: 500;
  color: var(--site-text-primary);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.nav-cats a:hover { color: var(--site-brand); }
.nav-cats a.active {
  color: var(--site-brand);
  border-bottom-color: var(--site-brand);
}

/* 右侧操作区 */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}
.nav-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--site-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 4px;
  text-decoration: none;
  position: relative;
  transition: color 0.2s, background 0.2s;
}
.nav-action-btn:hover { color: var(--site-brand); background: rgba(0, 6, 102, 0.05); }
.nav-action-btn svg { width: 20px; height: 20px; }

/* 购物车角标 */
.site-nav .cart-link { position: relative; }
.site-nav .cart-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--site-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.site-nav .cart-badge[style*="display: none"],
.site-nav .cart-badge.is-empty { display: none; }

/* 移动端菜单按钮 */
.site-nav .menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 1001;
}
.site-nav .menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--site-brand);
  border-radius: 1px;
  transition: all 0.3s;
}
.site-nav .menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.site-nav .menu-toggle.active span:nth-child(2) { opacity: 0; }
.site-nav .menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============ 搜索浮层 ============ */
.nav-search-overlay {
  position: fixed;
  top: var(--site-nav-total, 100px);
  left: 0; right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--site-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  padding: 16px 0;
  display: none;
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.nav-search-overlay.active {
  display: block;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.nav-search-inner {
  width: 1280px;
  margin: 0 auto;
  padding: 0 64px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-search-inner svg { width: 20px; height: 20px; color: var(--site-text-secondary); }
.nav-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 16px;
  color: var(--site-text-primary);
  padding: 8px 0;
  font-family: inherit;
}
.nav-search-input::placeholder { color: var(--site-text-secondary); }
.nav-search-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--site-text-secondary);
  padding: 4px 8px;
  line-height: 1;
}
.nav-search-close:hover { color: var(--site-brand); }

/* ============ 移动端菜单 ============ */
.nav-mobile-menu {
  position: fixed;
  top: var(--site-nav-total, 100px);
  left: 0; right: 0;
  background: rgba(247, 249, 252, 0.98);
  backdrop-filter: blur(6px);
  flex-direction: column;
  padding: 8px 24px 16px;
  border-bottom: 1px solid var(--site-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: none;
  z-index: 999;
  max-height: calc(100vh - var(--site-nav-total, 100px));
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
}
.nav-mobile-menu.active { display: flex; }
.nav-mobile-menu a {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--site-text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--site-border);
  transition: color 0.2s;
}
.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { color: var(--site-brand); }
.nav-mobile-menu .nav-mobile-divider {
  height: 1px;
  background: var(--site-border);
  margin: 8px 0;
}

/* ============ 占位间距（避免内容被fixed导航遮挡）============ */
body.has-site-nav { padding-top: var(--site-nav-total); }

/* ============ 产品列表页 page-header 顶部间距修正 ============
   旧内联样式 padding-top:96px + .page-title margin-top:64px 是为旧固定导航预留，
   现已由 body.has-site-nav 的 padding-top 统一处理，此处覆盖避免双重间距。 */
body.has-site-nav .page-header { padding-top: 32px; }
body.has-site-nav .page-title { margin-top: 0; }

/* ============ 产品详情页顶部间距修正 ============ */
body.has-site-nav .product-page { padding-top: 0; }
@media (max-width: 768px) {
  body.has-site-nav .product-page { padding-top: 0; }
}

/* ============ 购物车页顶部间距修正 ============ */
body.has-site-nav .cart-page { padding-top: 0; }
@media (max-width: 768px) {
  body.has-site-nav .cart-page { padding-top: 0; }
}

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
  .nav-top-inner, .nav-main-inner, .nav-search-inner {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
  }
  .nav-cats { gap: 20px; }
  .nav-cats a { font-size: 13px; }
}

@media (max-width: 768px) {
  :root {
    --site-navbar-h: 32px;
    --site-navmain-h: 56px;
    --site-nav-total: 88px;
  }
  .nav-top-left { font-size: 11px; }
  .nav-top-right { gap: 12px; }
  .nav-top .lang-switch { font-size: 11px; }
  .nav-top-link { font-size: 11px; }
  .site-nav .logo-text { font-size: 18px; }
  .site-nav .logo img { width: 32px; height: 32px; }

  /* 移动端隐藏中间类别，用菜单按钮替代 */
  .nav-cats { display: none; }
  .site-nav .menu-toggle { display: flex; }
  .nav-actions { gap: 14px; }
}

/* ============ Footer ============ */
.site-footer {
  width: 100%;
  background: var(--site-bg-page);
  border-top: 1px solid #E6E8EB;
  padding: 48px 0 0;
}
.site-footer .footer-inner {
  width: 1280px;
  margin: 0 auto;
  padding: 0 64px;
}
.site-footer .footer-brand { margin-bottom: 24px; }
.site-footer .footer-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--site-brand);
  margin-bottom: 12px;
}
.site-footer .footer-brand-desc {
  font-size: 16px;
  font-weight: 400;
  color: var(--site-text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}
/* Footer 链接（关于我们/联系我们）*/
.site-footer .footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 8px;
}
.site-footer .footer-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--site-text-primary);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.site-footer .footer-links a:hover {
  color: var(--site-brand);
  border-bottom-color: var(--site-brand);
}
.site-footer .footer-bottom {
  border-top: 1px solid var(--site-border);
  padding: 17px 0;
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--site-text-primary);
}

@media (max-width: 1024px) {
  .site-footer .footer-inner { width: 100%; padding: 0 24px; }
}
@media (max-width: 768px) {
  .site-footer .footer-links { flex-wrap: wrap; gap: 16px; }
}
