/* ============================================================
 * chat-fab.css - 浮动在线咨询弹窗（5 模板 + 4 blog 共享）
 * 依赖 ../public/css/tokens.css 的 --blog-blue / --blog-purple
 * ============================================================ */

/* ============== 浮动按钮 ============== */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blog-blue) 0%, var(--blog-purple) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 12px 32px -6px rgba(22, 119, 255, 0.45),
    0 0 0 4px rgba(22, 119, 255, 0.12);
  z-index: 100;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  cursor: pointer;
  position: fixed;
  animation: chat-fab-pulse 2.4s ease-in-out infinite;
}
.chat-fab:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow:
    0 16px 40px -6px rgba(22, 119, 255, 0.55),
    0 0 0 6px rgba(22, 119, 255, 0.15);
  animation: none;
}
@keyframes chat-fab-pulse {
  0%, 100% { box-shadow: 0 12px 32px -6px rgba(22, 119, 255, 0.45), 0 0 0 4px rgba(22, 119, 255, 0.12); }
  50%      { box-shadow: 0 12px 32px -6px rgba(22, 119, 255, 0.45), 0 0 0 10px rgba(22, 119, 255, 0.04); }
}
.chat-fab svg { width: 26px; height: 26px; }

/* ============== 弹窗 ============== */
.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 24px 60px -20px rgba(15, 23, 42, 0.25),
    0 8px 20px -8px rgba(15, 23, 42, 0.12);
  z-index: 101;
  overflow: hidden;
  animation: chat-panel-pop 240ms cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--f-sans);
}
@keyframes chat-panel-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.chat-panel[hidden] { display: none; }

.chat-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--blog-blue) 0%, var(--blog-purple) 100%);
  color: #fff;
}
.chat-panel__head b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.chat-panel__head button {
  font-size: 14px;
  line-height: 1;
  width: 28px;
  height: 28px;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  color: #fff;
  transition: all 200ms;
}
.chat-panel__head button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(90deg);
}
.chat-panel__body { padding: 22px; }

.chat-panel__qr {
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 14px;
}
.chat-panel__qr img {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  margin: 0 auto;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  border: 1px solid var(--c-border);
}
.chat-panel__qr span {
  display: block;
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 10px;
  font-weight: 500;
}

.chat-panel__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.chat-panel__list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 4px 0;
}
.chat-panel__list b {
  width: 64px;
  color: var(--c-text-2);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.chat-panel__list a, .chat-panel__list span {
  color: var(--c-text);
  font-weight: 500;
  text-decoration: none;
}
.chat-panel__list a:hover { color: var(--blog-blue); }

/* ============== "在线提交需求" 按钮（美化版） ============== */
.chat-panel__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--blog-blue) 0%, var(--blog-purple) 50%, #DB2777 100%);
  background-size: 200% 200%;
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow:
    0 6px 16px -4px rgba(22, 119, 255, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
  position: relative;
  overflow: hidden;
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-panel__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.30) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.chat-panel__cta::after {
  content: "→";
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  margin-left: 2px;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-panel__cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 24px -4px rgba(22, 119, 255, 0.50),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  background-position: 100% 100%;
}
.chat-panel__cta:hover::before { transform: translateX(100%); }
.chat-panel__cta:hover::after { transform: translateX(4px); }
.chat-panel__cta:active {
  transform: translateY(0);
  box-shadow:
    0 4px 12px -2px rgba(22, 119, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ============== 暗色模式 ============== */
[data-theme="dark"] .chat-panel {
  background: var(--c-surface);
  color: var(--c-text);
}
[data-theme="dark"] .chat-panel__list b { color: var(--c-text-2); }
[data-theme="dark"] .chat-panel__list a,
[data-theme="dark"] .chat-panel__list span { color: var(--c-text); }
[data-theme="dark"] .chat-panel__head { color: #fff; }
[data-theme="dark"] .chat-panel__qr { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .chat-panel__qr img { background: #fff; }

/* ============== 响应式 ============== */
@media (max-width: 480px) {
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 92px; }
  .chat-fab { right: 16px; bottom: 16px; }
}