/* ==========================================
   glass.css — 液态玻璃效果、悬浮导航样式
   ========================================== */

/* ---------- 导航栏容器 ---------- */
.nav-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  /* 液态玻璃效果（高透光 Apple 风格） */
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-nav);
  box-shadow: var(--glass-shadow);
  /* 内高光 — 模拟玻璃边缘折射 */
  background-image:
    linear-gradient(135deg, var(--glass-highlight) 0%, transparent 50%);
  transition: width 0.35s cubic-bezier(0.25, 0.8, 0.25, 1.2);
  /* 导航栏入场动画 */
  animation: navSlideDown 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* ---------- 导航按钮 ---------- */
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: var(--font-sans);
  text-decoration: none;
}

.nav-btn:hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
  transform: scale(1.05);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn:active {
  transform: scale(0.96);
  transition: all 0.1s ease;
}

/* 当前页高亮 */
.nav-btn.active {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

/* ---------- 搜索图标按钮 ---------- */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-text-secondary);
}

.nav-search-btn:hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
  transform: scale(1.08);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-search-btn:active {
  transform: scale(0.92);
  transition: all 0.1s ease;
}

.nav-search-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- 搜索区域：图标 + 展开输入框 ---------- */
.nav-search-wrapper {
  display: flex;
  align-items: center;
  position: relative;
}

/* 搜索输入框：默认收起（宽度为 0，不可见） */
.nav-search-input {
  width: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  outline: none;
  opacity: 0;
  transition:
    width 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
    padding 0.35s ease,
    opacity 0.2s ease;
  cursor: default;
}

.nav-search-input::placeholder {
  color: var(--color-text-secondary);
}

/* 展开态：输入框滑出 */
.nav-search-wrapper.expanded .nav-search-input {
  width: 180px;
  padding: 6px 10px;
  opacity: 1;
  cursor: text;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
}

.nav-search-wrapper.expanded .nav-search-btn {
  color: var(--color-accent);
  background: transparent;
}

/* ---------- 搜索结果下拉 ---------- */
.search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-6px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
  max-height: 360px;
  overflow-y: auto;
}

.search-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* 搜索结果列表 */
.search-dropdown-list {
  display: flex;
  flex-direction: column;
}

/* 单条搜索结果 */
.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.18s ease, transform 0.2s ease;
  gap: 12px;
  opacity: 0;
  animation: fadeInUp 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.search-result-item:nth-child(1)  { animation-delay: 0.03s; }
.search-result-item:nth-child(2)  { animation-delay: 0.07s; }
.search-result-item:nth-child(3)  { animation-delay: 0.11s; }
.search-result-item:nth-child(4)  { animation-delay: 0.15s; }
.search-result-item:nth-child(5)  { animation-delay: 0.19s; }
.search-result-item:nth-child(6)  { animation-delay: 0.23s; }

.search-result-item:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateX(2px);
}

.search-result-title {
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.search-result-date {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* 搜索空状态 */
.search-dropdown-empty {
  text-align: center;
  padding: 20px 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* ---------- 玻璃卡片 ---------- */
.glass-card {
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  padding: 24px;
  transition: box-shadow 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.2s ease;
}

.glass-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  transform: translateY(-3px);
}

/* ---------- Footer 玻璃弱化版 ---------- */
.footer-container {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 1000;
  padding: 8px 20px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-nav);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  animation: fadeInUp 0.5s 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---------- 捐赠弹窗 ---------- */
.donate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.donate-overlay.active {
  opacity: 1;
  visibility: visible;
}

.donate-modal {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 320px;
  width: calc(100vw - 48px);
  transform: translateY(12px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.donate-overlay.active .donate-modal {
  transform: translateY(0) scale(1);
}

.donate-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.donate-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text);
  transform: scale(1.08);
}

.donate-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--color-text);
}

.donate-qr {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  display: block;
  margin: 0 auto 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.donate-thanks {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ---------- 移动端减弱 blur ---------- */
@media (max-width: 480px) {
  .nav-container {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
  }

  .glass-card {
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
  }

  /* 移动端搜索框更窄 */
  .nav-search-wrapper.expanded .nav-search-input {
    width: 110px;
    padding: 5px 8px;
    font-size: 0.82rem;
  }

  .search-dropdown {
    width: calc(100vw - 32px);
    left: 0;
    transform: translateX(0) translateY(-6px);
    border-radius: 14px;
  }

  .search-dropdown.active {
    transform: translateX(0) translateY(0);
  }
}
