/* FreeNav 增强组件：捐赠 / 分享 / 主题切换 */
/* 目标：紧凑、对齐、减少留白，把页脚整理成干净的三段式 */

/* ===== 页脚整体：收紧上下间距 ===== */
.site-footer {
  padding: 22px 0 10px;
  margin-top: 18px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  align-items: start;
  gap: 18px;
  padding-bottom: 0;
}

.footer-brand {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}

.footer-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.footer-note {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 6px;
  color: var(--muted);
}

.footer-col p { margin: 0 0 6px; }
.footer-col p:last-child { margin-bottom: 0; }
.footer-col a { color: var(--accent); text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }

/* 链接列分成两栏，避免第三列过高 */
.footer-col:nth-child(3) {
  columns: 2;
  column-gap: 14px;
}
.footer-col:nth-child(3) .footer-title { column-span: all; }
.footer-col:nth-child(3) p {
  break-inside: avoid;
  margin-bottom: 3px;
}

/* ===== 捐赠区：从“卡片”改成“横向条带” ===== */
.footer-donate {
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.donate-box {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.donate-summary {
  display: inline-block;
  list-style: none;
  margin: 0 14px 0 0;
  padding: 0;
  cursor: default;
  vertical-align: middle;
}
.donate-summary::-webkit-details-marker { display: none; }
.donate-summary::marker { content: ""; }

.donate-title {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent, #6366f1);
  line-height: 1.2;
  white-space: nowrap;
}

.donate-body {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  vertical-align: middle;
}

.donate-hint {
  flex: 1 1 260px;
  margin: 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--muted, #5b6675);
}
.donate-hint strong { color: var(--text, #111); }

.donate-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.donate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 13px;
  border: 1px solid var(--accent, #6366f1);
  border-radius: 999px;
  background: transparent;
  color: var(--accent, #6366f1);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1;
  transition: border-color .15s, color .15s, transform .1s, background .15s, box-shadow .15s;
}
.donate-link:hover {
  background: var(--accent, #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .22);
}
.donate-link:active { transform: scale(.96); }
.donate-link[aria-pressed="true"] {
  background: var(--accent, #6366f1);
  color: #fff;
}

/* 二维码面板：横向展开，居中 */
.donate-qr-panel {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}
.donate-qr {
  display: none;
  margin: 0;
  text-align: center;
  padding: 6px;
  border: 1px solid var(--border, #e6e8ee);
  border-radius: 8px;
  background: #fff;
}
.donate-qr.active { display: block; }
.donate-qr img {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 6px;
  margin: 0 auto;
  background: #fff;
}
.donate-qr figcaption {
  margin-top: 4px;
  font-size: .72rem;
  color: var(--muted, #5b6675);
}

/* 捐赠区：资金用途说明 + 与上方列间距 */
.footer-donate { margin-top: 22px; }
.donate-use {
  margin: 8px 0 0;
  font-size: .76rem;
  line-height: 1.5;
  color: var(--faint, #8b9ab4);
}

/* ===== 分享栏：从独立横幅移入第一列 footer-col ===== */
.footer-col .share-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow-x: visible;
}

.share-label {
  font-weight: 600;
  font-size: .8rem;
  color: var(--muted, #5b6675);
  white-space: nowrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--border, #e6e8ee);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  cursor: pointer;
  font-size: .75rem;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, color .15s, transform .1s;
}
.share-btn:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.share-btn:active { transform: scale(.96); }

/* 分享提示 */
.share-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Footer bottom：把统计并入同一行 ===== */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 16px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: none;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.footer-bottom .footer-stat {
  font-size: .75rem;
  color: var(--faint);
}

.footer-tip {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

/* ===== 主题切换按钮 ===== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.theme-toggle:hover { border-color: var(--accent); }

.theme-icon { line-height: 1; font-size: 15px; }
.theme-label { font-size: .85rem; color: var(--muted, #5b6675); }
.theme-toggle:hover .theme-label { color: var(--text); }

/* 主题按钮 hover 提示气泡 */
.theme-toggle { position: relative; }
.theme-toggle::after {
  content: attr(aria-label);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: .74rem;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 60;
}
.theme-toggle:hover::after,
.theme-toggle:focus::after { opacity: 1; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .site-footer { padding: 20px 0 10px; }
  .footer-inner { grid-template-columns: 1fr; gap: 16px; }
  .footer-col:nth-child(3) { columns: 2; }

  .donate-title { font-size: 1.05rem; }
  .donate-body { gap: 8px; }
  .donate-hint { flex: 1 1 100%; }
  .donate-actions { width: 100%; justify-content: flex-start; }
  .donate-qr-panel { gap: 10px; }
  .donate-qr img { width: 84px; height: 84px; }

  .footer-col .share-bar { margin-top: 8px; }

  .footer-bottom {
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    text-align: left;
  }
  .footer-tip { text-align: left; }
}
