/* 晨幻AI ™ · 智能获客系统样式 - 独立青色AI助手 */
:root {
  --c-ai: #00d4ff;
  --c-ai-dark: #0099cc;
  --c-accent2: #ff3e9a;
  --c-gold: #ffd700;
  --c-green: #00d26a;
  --c-dark: #0A0A0F;
  --c-card: rgba(10, 14, 25, 0.96);
  --c-border: rgba(0, 212, 255, 0.25);
}

/* ========== AI智能估价助手按钮（青色，在绿色客服上方） ========== */
.ai-chat-launcher {
  position: fixed;
  bottom: 90px;
  right: 14px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.ai-chat-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark));
  border: 2px solid rgba(255,255,255,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.5), 0 4px 15px rgba(0,0,0,0.3);
  animation: breatheCyan 2.2s ease-in-out infinite;
  transition: all 0.3s;
  position: relative;
}
.ai-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.7);
}
.ai-chat-btn .ai-icon {
  font-size: 24px;
  line-height: 1;
}
.ai-chat-btn .badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  background: #ff4444;
  border-radius: 50%;
  border: 2px solid white;
  font-size: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  padding: 0 3px;
}

.ai-chat-bubble {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 12px 16px;
  color: #e0e0e0;
  font-size: 14px;
  max-width: 230px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 15px rgba(0,212,255,0.1);
  cursor: pointer;
  animation: slideInRight 0.4s ease-out;
}
.ai-chat-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--c-card);
}
.ai-chat-bubble .bubble-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

/* ========== 聊天窗口 ========== */
.ai-chat-window {
  position: fixed;
  bottom: 160px;
  right: 14px;
  width: 350px;
  max-width: calc(100vw - 28px);
  height: 500px;
  max-height: calc(100vh - 180px);
  background: var(--c-dark);
  border: 1px solid var(--c-ai);
  border-radius: 20px;
  z-index: 100000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 35px rgba(0, 212, 255, 0.2), 0 10px 40px rgba(0,0,0,0.5);
  animation: chatPopIn 0.3s ease-out;
}
.ai-chat-window.open {
  display: flex;
}

.ai-chat-header {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(0, 153, 204, 0.08));
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ai-chat-header-info h4 {
  margin: 0;
  color: white;
  font-size: 15px;
}
.ai-chat-header-info span {
  font-size: 12px;
  color: var(--c-ai);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-chat-header-info span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--c-ai);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
.ai-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.ai-msg {
  display: flex;
  gap: 8px;
  max-width: 86%;
}
.ai-msg.bot { align-self: flex-start; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.ai-msg.bot .ai-msg-avatar { background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark)); }
.ai-msg.user .ai-msg-avatar { background: rgba(255,255,255,0.15); }

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.ai-msg.bot .ai-msg-bubble {
  background: rgba(255,255,255,0.06);
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}
.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,212,255,0.08));
  color: white;
  border: 1px solid rgba(0,212,255,0.2);
  border-bottom-right-radius: 4px;
}

.ai-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ai-quick-reply {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--c-ai);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ai-quick-reply:hover {
  background: rgba(0, 212, 255, 0.2);
  transform: scale(1.02);
}

.ai-lead-form {
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
}
.ai-lead-form h5 {
  margin: 0 0 8px;
  color: var(--c-ai);
  font-size: 13px;
}
.ai-lead-form input, .ai-lead-form select {
  width: 100%;
  padding: 9px;
  margin-bottom: 7px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: white;
  font-size: 13px;
  box-sizing: border-box;
}
.ai-lead-form input:focus, .ai-lead-form select:focus {
  outline: none;
  border-color: var(--c-ai);
}
.ai-lead-form button {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark));
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-lead-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,212,255,0.4);
}

.ai-chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 8px;
}
.ai-chat-input {
  flex: 1;
  padding: 9px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  color: white;
  font-size: 14px;
}
.ai-chat-input:focus {
  outline: none;
  border-color: var(--c-ai);
}
.ai-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

/* ========== 社会证明通知（左下角） ========== */
.social-proof-notif {
  position: fixed;
  bottom: 170px;
  left: 14px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-ai);
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 99997;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideInLeft 0.4s ease-out;
  cursor: pointer;
}
.social-proof-notif.hide {
  animation: slideOutLeft 0.3s ease-out forwards;
}
.sp-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sp-text {
  font-size: 12px;
  color: #c0c0c0;
  line-height: 1.4;
}
.sp-text strong { color: var(--c-ai); }
.sp-text .sp-time { color: #666; font-size: 11px; }

/* ========== 退出挽留弹窗 ========== */
.exit-intent-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 200000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.exit-intent-modal.show {
  display: flex;
  animation: fadeIn 0.3s;
}
.exit-intent-box {
  background: var(--c-dark);
  border: 1px solid var(--c-gold);
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
  text-align: center;
  position: relative;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.exit-intent-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
}
.exit-intent-icon { font-size: 44px; margin-bottom: 12px; }
.exit-intent-box h3 { color: white; font-size: 20px; margin: 0 0 10px; }
.exit-intent-box p { color: #a0a0a0; font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.exit-coupon {
  background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(255,215,0,0.03));
  border: 1px dashed var(--c-gold);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.exit-coupon .coupon-label { color: var(--c-gold); font-size: 12px; font-weight: bold; margin-bottom: 4px; }
.exit-coupon .coupon-val { color: white; font-size: 28px; font-weight: bold; }
.exit-coupon .coupon-cond { color: #888; font-size: 11px; margin-top: 4px; }
.exit-cta {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--c-gold), #e6c200);
  border: none;
  border-radius: 12px;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
}
.exit-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,215,0,0.3); }
.exit-stay { background: none; border: none; color: #666; font-size: 12px; cursor: pointer; text-decoration: underline; }

/* ========== 移动端底部CTA ========== */
.mobile-sticky-cta {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(10,10,15,0.98), rgba(10,10,15,0.92));
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 99996;
  border-top: 1px solid var(--c-border);
  gap: 8px;
  backdrop-filter: blur(10px);
}
.mobile-sticky-cta a {
  flex: 1;
  text-align: center;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
}
.mcta-call { background: linear-gradient(135deg, var(--c-green), #00a854); color: white; }
.mcta-quote { background: linear-gradient(135deg, var(--c-ai), var(--c-ai-dark)); color: white; }

/* ========== 动画 ========== */
@keyframes breatheCyan {
  0%, 100% { box-shadow: 0 0 18px rgba(0,212,255,0.5), 0 4px 15px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 32px rgba(0,212,255,0.75), 0 4px 15px rgba(0,0,0,0.3); }
}
@keyframes slideInRight { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes slideInLeft { from { opacity:0; transform:translateX(-20px); } to { opacity:1; transform:translateX(0); } }
@keyframes slideOutLeft { to { opacity:0; transform:translateX(-20px); } }
@keyframes chatPopIn { from { opacity:0; transform:scale(0.9) translateY(20px); } to { opacity:1; transform:scale(1) translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes popIn { from { opacity:0; transform:scale(0.8); } to { opacity:1; transform:scale(1); } }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .ai-chat-launcher {
    bottom: 76px;
    right: 10px;
  }
  .ai-chat-btn {
    width: 50px;
    height: 50px;
  }
  .ai-chat-btn .ai-icon { font-size: 22px; }
  .ai-chat-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 140px;
    height: 65vh;
    max-height: calc(100vh - 160px);
  }
  .ai-chat-bubble {
    max-width: 200px;
    font-size: 13px;
  }
  .social-proof-notif {
    left: 10px;
    right: 70px;
    bottom: 140px;
    max-width: none;
  }
  .mobile-sticky-cta { display: flex; }
}
