/* ===== 顶部导航栏 ===== */
.navbar {
  position: sticky;
  top: 8px;
  z-index: 1000;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 20px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  color: #222;
  transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  animation: navIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.navbar.navbar-hidden {
  transform: translateY(calc(-100% - 16px));
}
.dark .navbar {
  background: rgba(30, 30, 30, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  color: #eee;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
@keyframes navIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

/* 左侧：头像 + 站点名 */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: opacity 0.3s;
}
.navbar-brand:hover { opacity: 0.75; }
.navbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(128, 128, 128, 0.3);
}
.navbar-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 中间：搜索栏 */
.navbar-search {
  flex: 1;
  min-width: 0;
  display: flex;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.dark .navbar-search input {
  background: rgba(0, 0, 0, 0.25);
  color: #eee;
}
.navbar-search input::placeholder { color: rgba(120, 120, 120, 0.8); }
.dark .navbar-search input::placeholder { color: rgba(200, 200, 200, 0.6); }
.navbar-search input:focus {
  border-color: #b55;
  box-shadow: 0 0 0 3px rgba(181, 85, 85, 0.18);
}
.dark .navbar-search input:focus {
  border-color: #b39ddb;
  box-shadow: 0 0 0 3px rgba(179, 157, 219, 0.18);
}

/* 右侧：切换 + 汉堡 */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.hamburger {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  padding: 0;
  transition: all 0.4s ease;
  flex-shrink: 0;
}
.dark .hamburger { background: rgba(0, 0, 0, 0.25); }
.hamburger:active { transform: scale(0.9); }
.hamburger svg { display: block; }
.hamburger .hl-1, .hamburger .hl-2, .hamburger .hl-3 {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
}
.hamburger.open .hl-1 { transform: translateY(6px) rotate(45deg); }
.hamburger.open .hl-2 { opacity: 0; }
.hamburger.open .hl-3 { transform: translateY(-6px) rotate(-45deg); }

/* ===== 下拉菜单 ===== */
.navbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 14px;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  padding: 8px;
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .navbar-menu {
  background: rgba(35, 35, 40, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.navbar-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.25s, transform 0.25s;
}
.nav-menu-item:hover {
  background: rgba(181, 85, 85, 0.12);
  transform: translateX(3px);
}
.dark .nav-menu-item:hover { background: rgba(179, 157, 219, 0.12); }
.nav-menu-item svg { flex-shrink: 0; }

/* ===== 搜索联想下拉 ===== */
.navbar-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(380px, 100%);
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  padding: 6px;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1200;
}
.dark .navbar-suggest {
  background: rgba(35, 35, 40, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}
.navbar-suggest.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.navbar-suggest-item {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
  max-width: 100%;
}
.navbar-suggest-item:hover { background: rgba(181, 85, 85, 0.1); }
.dark .navbar-suggest-item:hover { background: rgba(179, 157, 219, 0.1); }
.navbar-suggest-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-suggest-excerpt {
  font-size: 12px;
  color: rgba(120, 120, 120, 0.9);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.dark .navbar-suggest-excerpt { color: rgba(200, 200, 200, 0.7); }
.navbar-suggest mark {
  background: rgba(255, 213, 79, 0.55);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}
.dark .navbar-suggest mark { background: rgba(179, 157, 219, 0.35); }
.navbar-suggest-empty {
  padding: 12px;
  font-size: 13px;
  text-align: center;
  color: rgba(120, 120, 120, 0.9);
}

/* ===== 移动端适配：保持单行，隐藏站点名给搜索腾空间 ===== */
@media (max-width: 560px) {
  .navbar-inner { gap: 8px; padding: 8px 10px; }
  .navbar-title { display: none; }
  .navbar-avatar { width: 30px; height: 30px; }
  .navbar-search input { padding: 7px 12px; font-size: 13px; }
  .navbar { margin-bottom: 14px; }
  .navbar-menu { right: 8px; left: 8px; min-width: 0; }
}

/* 触屏：去掉悬停位移 */
@media (hover: none), (pointer: coarse) {
  .nav-menu-item:hover { transform: none; }
  .navbar-brand:hover { opacity: 1; }
}

/* 防止移动端双击缩放页面（只禁用双击缩放，双指捏合缩放保留） */
html, body { touch-action: manipulation; }

/* 减弱动态效果 */
@media (prefers-reduced-motion: reduce) {
  .navbar { animation: none !important; transition: none !important; }
  .navbar-menu,
  .hamburger .hl-1, .hamburger .hl-2, .hamburger .hl-3,
  .nav-menu-item { transition: none !important; }
}

/* ===== 侧拉栏（返回顶部 / 分享） ===== */
.side-fab {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(128, 128, 128, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
  overflow: hidden;
}
.dark .side-fab { background: rgba(35, 35, 40, 0.7); color: #eee; }
.side-fab.show { opacity: 1; transform: none; pointer-events: auto; }
.side-fab:active { transform: scale(0.92); }
.side-fab svg { display: block; }
.side-fab .fab-icon-spin { animation: fabIconSpin 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes fabIconSpin {
  from { transform: rotate(-90deg); opacity: 0.4; }
  to { transform: rotate(0deg); opacity: 1; }
}

/* 点击涟漪 */
.side-fab .ripple {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(181, 85, 85, 0.25);
  transform: scale(0);
  animation: fabRipple 0.6s ease-out forwards;
  pointer-events: none;
}
.dark .side-fab .ripple { background: rgba(179, 157, 219, 0.3); }
@keyframes fabRipple {
  from { transform: scale(0); opacity: 0.5; }
  to { transform: scale(1); opacity: 0; }
}

.side-panel {
  position: fixed;
  right: 16px;
  bottom: 148px;
  z-index: 1100;
  min-width: 150px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  padding: 6px;
  opacity: 0;
  transform: translateX(24px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .side-panel { background: rgba(35, 35, 40, 0.9); }
.side-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.side-panel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 10px;
  color: inherit;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.side-panel-item:hover { background: rgba(181, 85, 85, 0.12); }
.dark .side-panel-item:hover { background: rgba(179, 157, 219, 0.12); }
.side-panel-item svg { flex-shrink: 0; }

/* 移动端位置微调 */
@media (max-width: 560px) {
  .side-fab { right: 12px; bottom: 84px; }
  .side-panel { right: 12px; bottom: 136px; }
}

@media (prefers-reduced-motion: reduce) {
  .side-fab, .side-panel, .side-panel-item { transition: none !important; }
  .side-fab .fab-icon-spin { animation: none !important; }
  .side-fab .ripple { animation: none !important; }
}
