/* shared/topbar.css — 统一导航栏 + 光晕悬浮效果 */

:root {
  --accent: #00f0d8;
  --accent2: #7c6cf0;
  --dim: #788090;
  --bg-dark: rgba(8, 10, 22, 0.7);
  --bg-dark-scrolled: rgba(8, 10, 22, 0.9);
}

/* 入场动画 */
@keyframes topbar-slide-in {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 光晕呼吸动画 */
@keyframes glow-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 1; }
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0;
  margin: 0 auto;
  max-width: min(95vw, 900px);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 0;
  border-radius: 0;
  animation: topbar-slide-in 0.4s ease-out;
  transition: all 0.3s ease;
}

/* 滚动时收缩 */
.topbar.scrolled {
  height: 36px;
  background: transparent;
  box-shadow: none;
}
.topbar.scrolled a {
  padding: 4px 10px;
  font-size: 12px;
}

/* ═══════════════════════════════
   导航链接 — 胶囊质感 + 光效
   ═══════════════════════════════ */
.topbar a {
  font-size: 13.5px;
  letter-spacing: 0.5px;
  padding: 3px 12px;
  border-radius: 12px;
  color: #9aa2b0;

  /* 渐变背景：顶部微光 → 主体 → 底部暗影 = 胶囊厚度 */
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(18, 22, 38, 0.60) 1px,
    rgba(8, 10, 22, 0.75) 100%
  );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  border: 1px solid rgba(255, 255, 255, 0.08);

  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  will-change: transform;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 外层光晕 — hover/active 时显示 */
.topbar a::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 24px;
  background: radial-gradient(ellipse at center, rgba(0, 240, 216, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

/* 玻璃反光 — hover 时光泽斜面扫过 */
.topbar a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    transparent 28%,
    rgba(255, 255, 255, 0.14) 42%,
    rgba(255, 255, 255, 0.05) 45%,
    transparent 55%
  );
  background-size: 200% 100%;
  background-position: 100% 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* ── 悬停高亮 ── */
.topbar a:hover {
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(0, 240, 216, 0.10) 1px,
    rgba(0, 240, 216, 0.04) 100%
  );
  border-color: rgba(0, 240, 216, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 240, 216, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
  text-shadow: 0 0 8px rgba(0, 240, 216, 0.4);
}

.topbar a:hover::after {
  opacity: 1;
  background-position: 0% 0;
  transition:
    background-position 0.65s cubic-bezier(0.22, 0.9, 0.4, 1),
    opacity 0.3s ease;
}

/* ── 当前页高亮 ── */
.topbar a.active {
  color: var(--accent);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(0, 240, 216, 0.08) 1px,
    rgba(0, 240, 216, 0.03) 100%
  );
  border: 1px solid rgba(0, 240, 216, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.5),
    0 0 16px rgba(0, 240, 216, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transform: none;
}

.topbar a.active::before {
  opacity: 1;
  background: radial-gradient(ellipse at center, rgba(0, 240, 216, 0.28) 0%, transparent 65%);
  animation: glow-pulse 3s ease-in-out infinite alternate;
}

/* ═══════════════════════════════
   语言切换按钮 — 胶囊质感 + 光效
   ═══════════════════════════════ */
.topbar .lang {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(18, 22, 38, 0.60) 1px,
    rgba(8, 10, 22, 0.75) 100%
  );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(124, 108, 240, 0.35);
  color: var(--accent2);
  padding: 4px 16px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  will-change: transform;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.topbar .lang::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 28px;
  background: radial-gradient(ellipse at center, rgba(124, 108, 240, 0.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

/* 紫色玻璃反光 */
.topbar .lang::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    transparent 28%,
    rgba(200, 190, 255, 0.14) 42%,
    rgba(200, 190, 255, 0.05) 45%,
    transparent 55%
  );
  background-size: 200% 100%;
  background-position: 100% 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.topbar .lang:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(124, 108, 240, 0.12) 1px,
    rgba(124, 108, 240, 0.05) 100%
  );
  border-color: rgba(124, 108, 240, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(124, 108, 240, 0.18),
    0 6px 20px rgba(0, 0, 0, 0.3);
  color: #fff;
  transform: translateY(-2px);
  text-shadow: 0 0 8px rgba(124, 108, 240, 0.4);
}

.topbar .lang:hover::after {
  opacity: 1;
  background-position: 0% 0;
  transition:
    background-position 0.65s cubic-bezier(0.22, 0.9, 0.4, 1),
    opacity 0.3s ease;
}

/* 移动端适配 */
@media (max-width: 800px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar a { font-size: 12px; padding: 4px 8px; }
  .topbar .lang { padding: 4px 12px; font-size: 12px; }
}
@media (max-width: 640px) {
  .topbar { gap: 4px; padding: 0 8px; border-radius: 20px; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar a { font-size: 11px; padding: 3px 6px; letter-spacing: 0; flex-shrink: 0; }
  .topbar .lang { padding: 3px 10px; font-size: 11px; flex-shrink: 0; }
}
@media (max-width: 480px) {
  .topbar { gap: 3px; padding: 0 8px; border-radius: 16px; height: auto; min-height: 36px; }
  .topbar a { font-size: 10px; padding: 3px 5px; border-radius: 10px; letter-spacing: 0; }
  .topbar .lang { padding: 3px 8px; font-size: 10px; border-radius: 12px; }
  .topbar a:hover { transform: translateY(-1px); }
  .topbar .lang:hover { transform: translateY(-1px); }
}
@media (max-width: 380px) {
  .topbar { gap: 2px; padding: 0 4px; border-radius: 14px; }
  .topbar a { font-size: 9px; padding: 2px 4px; border-radius: 8px; letter-spacing: 0; }
  .topbar .lang { padding: 2px 6px; font-size: 9px; border-radius: 10px; }
  .topbar a:hover { transform: translateY(-1px); }
  .topbar .lang:hover { transform: translateY(-1px); }
}

