/**
 * 导航与页脚 —— 主题「晨曦 Aurora」
 *
 * @description 顶栏（玻璃拟态）、页脚、移动端底部 TabBar、主题切换按钮
 */

/* ==================== 顶部导航 ==================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--nav-h);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

/* 不支持 color-mix 的浏览器回退 */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .navbar { background: var(--card); }
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
  border-bottom-color: var(--border-hover);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad-brand);
  color: var(--text-onbrand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.logo-icon svg { width: 18px; height: 18px; }

/* 导航链接 */
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  position: relative;
  font-size: 14.5px;
  color: var(--text-2);
  font-weight: 550;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  transition: color var(--dur), background var(--dur);
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 650;
}

/* 顶栏右侧操作区 */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 主题切换按钮 */
.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: rotate(18deg);
}
.theme-toggle .fa-sun { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

/* CTA 按钮 */
.nav-cta {
  flex-shrink: 0;
  padding: 9px 20px;
  border: none;              /* <button> 复用此类时吃掉浏览器默认边框（打赏按钮） */
  appearance: none;
  border-radius: var(--radius-pill);
  background: var(--grad-brand);
  color: var(--text-inv);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;          /* button 与 a 的行高基线对齐 */
  box-shadow: var(--shadow-brand);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  cursor: pointer;
}
.nav-cta:hover {
  color: var(--text-inv);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px var(--primary-shadow);
}

/* ==================== 页脚 ==================== */
.footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 52px 0 24px;
  /* 与内容的间距由 main 的 padding-bottom 统一供给（base.css），
     这里不再加 margin-top —— 双份间距会把页面撑出一大截 */
  margin-top: 0;
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grad-brand);
  opacity: .5;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
}

.footer .logo { margin-bottom: 12px; }

.footer-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
  max-width: 320px;
}

.footer h4 {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 14px;
}

.footer li { margin-bottom: 9px; }

.footer li a {
  font-size: 13px;
  color: var(--text-2);
  transition: color var(--dur);
}
.footer li a:hover { color: var(--primary); }

.footer-bottom {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-3);
}
.footer-bottom a { color: inherit; }
.footer-bottom a:hover { color: var(--primary); }

/* ==================== 移动端底部 TabBar ==================== */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-tabbar);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 22px var(--hairline);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .tabbar { background: var(--card); }
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 3px;
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 550;
  transition: color var(--dur);
  position: relative;
}

.tabbar a.active { color: var(--primary); font-weight: 650; }

/* 激活项顶部小圆点 */
.tabbar a.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 22px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--grad-brand);
}

.tabbar svg { width: 22px; height: 22px; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .tabbar { display: flex; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* 移动端顶部保留简化导航栏：左边 logo，右侧主题切换 + 打赏/用户中心按钮。
     中间导航链接在窄屏上没有空间，直接隐藏（用户通过底部 TabBar 切换主入口）。
     之前 .navbar { display: none; } 导致商品详情页等 H5 页面顶部光秃秃很难看。 */
  .navbar {
    position: sticky;
    top: 0;
  }
  .nav-links { display: none; }
  .nav-inner { gap: 12px; }
  .logo {
    font-size: 16px;
    gap: 8px;
  }
  .logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .logo-icon svg { width: 16px; height: 16px; }
  .nav-actions {
    gap: 8px;
    margin-left: auto;
  }
  .nav-cta {
    padding: 8px 16px;
    font-size: 13px;
  }
  .theme-toggle {
    width: 34px;
    height: 34px;
  }
  .footer { padding: 36px 0 20px;}
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    text-align: center;
  }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .footer .logo { justify-content: center; }
  .footer-desc { max-width: none; }
  .footer h4 { font-size: 12.5px; margin-bottom: 10px; }
  .footer li { margin-bottom: 7px; }
  .footer-bottom {
    margin-top: 28px;
    justify-content: center;
    text-align: center;
  }
}
