/* ========== AI方案顾问 — 悬浮组件样式 ========== */

/* 悬浮按钮 */
.ai-plan-fab {
  position: fixed; bottom: 32px; right: 32px; z-index: 9999;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s, box-shadow 0.3s;
  animation: aiFabPulse 3s ease-in-out infinite;
}
.ai-plan-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(59,130,246,0.6);
}
.ai-plan-fab svg { width: 28px; height: 28px; fill: #fff; }
.ai-plan-fab .fab-label {
  position: absolute; right: 72px; top: 50%; transform: translateY(-50%);
  background: #0F172A; color: #E2E8F0; font-size: 13px; padding: 8px 14px;
  border-radius: 8px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
  border: 1px solid rgba(255,255,255,0.1);
}
.ai-plan-fab:hover .fab-label { opacity: 1; }
@keyframes aiFabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(59,130,246,0.4); }
  50% { box-shadow: 0 4px 30px rgba(139,92,246,0.6); }
}

/* 弹窗遮罩 */
.ai-plan-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.3s;
}
.ai-plan-overlay.active { opacity: 1; visibility: visible; }

/* 弹窗主体 — 加高 */
.ai-plan-modal {
  width: 90%; max-width: 680px; max-height: 88vh;
  background: #1E293B; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(20px); transition: transform 0.3s;
}
.ai-plan-overlay.active .ai-plan-modal { transform: translateY(0); }

/* 头部 */
.ai-plan-header {
  padding: 16px 24px; background: linear-gradient(135deg, #1E3A5F 0%, #1A2D4A 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
}
.ai-plan-header h3 {
  font-size: 17px; font-weight: 600; color: #F1F5F9;
  display: flex; align-items: center; gap: 10px;
}
.ai-header-logo {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  border: 1px solid rgba(255,255,255,0.15);
}
.ai-plan-header h3 .ai-badge {
  font-size: 11px; background: linear-gradient(135deg, #22C55E, #16A34A);
  padding: 2px 8px; border-radius: 10px; color: #fff; font-weight: 500;
}
.ai-plan-close {
  width: 32px; height: 32px; border: none; background: rgba(255,255,255,0.08);
  color: #94A3B8; border-radius: 8px; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.ai-plan-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* 消息区 — 加高 */
.ai-plan-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 300px; max-height: 62vh;
}

/* 消息气泡 */
.ai-msg { display: flex; gap: 10px; animation: msgFadeIn 0.3s ease; }
@keyframes msgFadeIn { from { opacity: 0; transform: translateY(8px); } }
.ai-msg.bot { align-items: flex-start; }
.ai-msg.user { justify-content: flex-end; }

.ai-msg .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; overflow: hidden;
}
.ai-msg .avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.ai-msg.bot .avatar { background: linear-gradient(135deg, #3B82F6, #8B5CF6); }
.ai-msg.user .avatar { background: #475569; }
.ai-msg .bubble {
  max-width: 80%; padding: 12px 16px; border-radius: 14px;
  font-size: 14px; line-height: 1.6; color: #E2E8F0;
  word-wrap: break-word; overflow-wrap: break-word;
}
.ai-msg.user .bubble {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  border-bottom-right-radius: 4px;
}
.ai-msg.bot .bubble {
  background: #334155; border-bottom-left-radius: 4px;
}

/* 加载动画 */
.ai-loading { display: flex; align-items: center; gap: 6px; color: #64748B; font-size: 13px; }
.ai-loading .dots { display: flex; gap: 3px; }
.ai-loading .dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #64748B;
  animation: dotBounce 1.4s infinite ease-in-out both;
}
.ai-loading .dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading .dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dotBounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }

/* 方案结果卡片 */
.ai-plan-result {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.08));
  border: 1px solid rgba(59,130,246,0.25); border-radius: 14px;
  overflow: hidden;
}
.ai-plan-result .result-summary {
  padding: 16px; font-size: 15px; color: #F1F5F9; font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  line-height: 1.7;
}
.ai-plan-result .result-services {
  padding: 12px 16px; display: flex; flex-direction: column; gap: 10px;
}
.result-service-card {
  background: rgba(15,23,42,0.6); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 14px;
}
.result-service-card .svc-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.result-service-card .svc-name { font-size: 15px; font-weight: 600; color: #93C5FD; }
.result-service-card .svc-price {
  font-size: 14px; color: #F59E0B; font-weight: 600; white-space: nowrap;
}
.result-service-card .svc-reason { font-size: 13px; color: #94A3B8; margin-bottom: 4px; }
.result-service-card .svc-detail { font-size: 13px; color: #64748B; }
.result-service-card .svc-timeline {
  margin-top: 8px; font-size: 12px; color: #3B82F6;
  display: flex; align-items: center; gap: 4px;
}

.ai-plan-result .result-total {
  padding: 10px 16px; font-size: 14px; color: #FDE68A;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(245,158,11,0.05);
}
.ai-plan-result .result-steps {
  padding: 12px 16px; font-size: 13px; color: #94A3B8;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ai-plan-result .result-steps .step-label {
  font-size: 12px; color: #3B82F6; font-weight: 600; margin-bottom: 6px;
}
.ai-plan-result .result-steps ol { margin: 0; padding-left: 20px; }
.ai-plan-result .result-steps li { margin-bottom: 4px; }

.ai-plan-result .result-cta {
  padding: 12px 16px; display: flex; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.result-cta-btn {
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.2s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.result-cta-btn.primary {
  background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff;
}
.result-cta-btn.primary:hover { box-shadow: 0 4px 15px rgba(59,130,246,0.4); }
.result-cta-btn.secondary {
  background: rgba(255,255,255,0.08); color: #E2E8F0; border: 1px solid rgba(255,255,255,0.1);
}
.result-cta-btn.secondary:hover { background: rgba(255,255,255,0.12); }

/* 输入区 */
.ai-plan-input-area {
  padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 10px; align-items: center;
}
.ai-plan-input-area input {
  flex: 1; height: 42px; padding: 0 16px; box-sizing: border-box; border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1); background: #0F172A;
  color: #E2E8F0; font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.ai-plan-input-area input:focus { border-color: #3B82F6; }
.ai-plan-input-area input::placeholder { color: #475569; }
.ai-plan-call {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #059669);
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s; flex-shrink: 0;
}
.ai-plan-call:hover { transform: scale(1.05); box-shadow: 0 4px 15px rgba(16,185,129,0.4); }
.ai-plan-call svg { width: 18px; height: 18px; }
.ai-plan-send {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s; flex-shrink: 0;
}
.ai-plan-send:hover { transform: scale(1.05); box-shadow: 0 4px 15px rgba(59,130,246,0.4); }
.ai-plan-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.ai-plan-send svg { width: 18px; height: 18px; fill: #fff; }

/* 快捷标签 */
.ai-quick-tags { padding: 8px 24px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.ai-quick-tag {
  padding: 5px 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #94A3B8; font-size: 12px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.ai-quick-tag:hover { background: rgba(59,130,246,0.15); border-color: #3B82F6; color: #93C5FD; }

/* 响应式 */
@media (max-width: 640px) {
  .ai-plan-fab { bottom: 20px; right: 20px; width: 52px; height: 52px; }
  .ai-plan-overlay { justify-content: flex-start; }
  .ai-plan-modal {
    width: calc(100% - 16px); max-width: 100%;
    border-radius: 16px;
    max-height: 70vh;
    margin-top: 20vh;
    margin-bottom: 10vh;
  }
  .ai-plan-messages { padding: 16px; min-height: 200px; max-height: 65vh; }
  .ai-plan-input-area {
    padding: 10px 12px; gap: 8px;
    align-items: center;
  }
  .ai-plan-input-area input {
    height: 42px; padding: 0 12px;
    box-sizing: border-box; font-size: 13px;
    flex: 1; min-width: 0;
  }
  .ai-plan-call, .ai-plan-send {
    width: 42px; height: 42px; flex-shrink: 0;
  }
  .ai-msg .bubble { max-width: 85%; font-size: 13px; line-height: 1.6; }
  .ai-quick-tags { padding: 8px 12px 0; }
}
