/**
 * 社会人士避难所 3.0 - 导航栏 + 主题切换
 * Liquid Glass 液态玻璃风格
 */

/* ==================== 导航栏容器 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-sm) var(--space-lg);
  transition: all var(--transition-normal);
}

/* 滚动时的导航栏效果 - 进阶玻璃 */
.navbar.scrolled {
  padding: var(--space-xs) var(--space-lg);
}

.navbar.scrolled .navbar-container {
  background: 
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.35) 100%
    );
  backdrop-filter: 
    blur(80px)
    saturate(200%)
    brightness(1.1);
  box-shadow: 
    0 8px 32px rgba(31, 110, 140, 0.15),
    0 2px 8px rgba(31, 110, 140, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .navbar.scrolled .navbar-container {
  background: 
    linear-gradient(
      180deg,
      rgba(40, 50, 70, 0.6) 0%,
      rgba(30, 41, 59, 0.45) 100%
    );
  backdrop-filter: 
    blur(80px)
    saturate(200%)
    brightness(1.15);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ==================== 导航栏内容 - 进阶玻璃 ==================== */
.navbar-container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: 
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(235, 248, 255, 0.35) 50%,
      rgba(220, 240, 255, 0.3) 100%
    );
  backdrop-filter: 
    blur(var(--glass-blur-heavy))
    saturate(var(--glass-saturate))
    brightness(var(--glass-brightness));
  -webkit-backdrop-filter: 
    blur(var(--glass-blur-heavy))
    saturate(var(--glass-saturate))
    brightness(var(--glass-brightness));
  border-top: 1px solid var(--glass-border-top);
  border-left: 1px solid var(--glass-border-left);
  border-right: 1px solid var(--glass-border-right);
  border-bottom: 1px solid var(--glass-border-bottom);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
}

/* ==================== Logo ==================== */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--accent-primary);
  transform: scale(1.02);
}

.navbar-brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
}

/* ==================== 导航菜单 ==================== */
.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.navbar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.navbar-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

.navbar-link:hover {
  color: var(--accent-primary);
}

.navbar-link:hover::before {
  opacity: 1;
}

.navbar-link.active {
  color: var(--text-on-accent);
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.navbar-link.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* ==================== 主题切换按钮 ==================== */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  background: var(--glass-bg-hover);
  box-shadow: var(--glass-shadow-hover);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.95);
}

/* 图标容器 */
.theme-toggle-icons {
  position: relative;
  width: 22px;
  height: 22px;
}

/* 太阳和月亮图标 */
.theme-toggle-sun,
.theme-toggle-moon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all var(--transition-normal);
}

/* 白天模式显示太阳 */
.theme-toggle-sun {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle-moon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0);
}

/* 黑暗模式切换 */
[data-theme="dark"] .theme-toggle-sun {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0);
}

[data-theme="dark"] .theme-toggle-moon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

/* ==================== 移动端菜单按钮 ==================== */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* ==================== 移动端底部导航 - 精致液态玻璃 ==================== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

.mobile-nav-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: 
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.25) 0%,
      rgba(255, 255, 255, 0.15) 100%
    );
  backdrop-filter: 
    blur(40px)
    saturate(180%)
    brightness(1.1);
  -webkit-backdrop-filter: 
    blur(40px)
    saturate(180%)
    brightness(1.1);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.5rem 0.875rem;
  color: var(--text-secondary);
  border-radius: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 52px;
  font-weight: 500;
}

.mobile-nav-item:hover {
  color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-item.active {
  color: var(--text-on-accent);
  background: var(--accent-gradient);
  box-shadow: 
    0 4px 12px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mobile-nav-item i {
  font-size: 1.15rem;
}

.mobile-nav-item span {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}

/* 移动端主题切换 */
.mobile-nav .theme-toggle {
  margin-left: 0;
  width: 36px;
  height: 36px;
}

/* 夜间模式移动端底部导航 */
[data-theme="dark"] .mobile-nav-container {
  background: 
    linear-gradient(
      180deg,
      rgba(45, 55, 75, 0.6) 0%,
      rgba(35, 45, 65, 0.45) 100%
    );
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobile-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ==================== 遮罩层 ==================== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* ==================== 导航链接动画 ==================== */
@keyframes nav-link-enter {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.navbar-link {
  animation: nav-link-enter 0.4s ease backwards;
}

.navbar-link:nth-child(1) { animation-delay: 0.1s; }
.navbar-link:nth-child(2) { animation-delay: 0.15s; }
.navbar-link:nth-child(3) { animation-delay: 0.2s; }
