/* ============================================
   AI SmarTOP 销售客服机器人样式
   ============================================ */

#ai-smartop-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

/* 悬浮按钮 */
.ai-trigger-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
  transition: all 0.3s ease;
  position: relative;
  animation: pulse 2s ease-in-out infinite;
}
.ai-trigger-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.6);
}
.ai-trigger-btn svg {
  width: 32px;
  height: 32px;
  fill: white;
}
.ai-trigger-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ff4757;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4); }
  50% { box-shadow: 0 8px 40px rgba(0, 212, 255, 0.6); }
}

/* 聊天窗口 */
.ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
}
.ai-chat-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* 聊天头部 */
.ai-chat-header {
  background: var(--surface);
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 15px;
}
.ai-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  flex-shrink: 0;
}
.ai-header-info {
  flex: 1;
}
.ai-header-info h3 {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.ai-header-info p {
  font-size: 0.85em;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8em;
  color: #2ecc71;
}
.ai-status-dot {
  width: 8px;
  height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.ai-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-size: 1.2em;
}
.ai-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* 聊天消息区 */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.95em;
  line-height: 1.6;
  animation: messageIn 0.3s ease;
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-message-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: var(--primary);
  border-bottom-right-radius: 4px;
}
.ai-message-bot {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.ai-message-bot a {
  color: var(--accent);
  text-decoration: none;
}
.ai-message-bot a:hover {
  text-decoration: underline;
}
.ai-message-time {
  font-size: 0.75em;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}

/* 快捷按钮 */
.ai-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ai-quick-btn {
  padding: 8px 14px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 20px;
  color: var(--accent);
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.3s;
}
.ai-quick-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  transform: translateY(-1px);
}

/* 输入区 */
.ai-chat-input-area {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ai-chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95em;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: all 0.3s;
}
.ai-chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}
.ai-chat-input::placeholder {
  color: var(--text-muted);
}
.ai-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}
.ai-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}
.ai-send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}
.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 打字指示器 */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  align-self: flex-start;
}
.ai-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* 产品推荐卡片 */
.ai-product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
  display: flex;
  gap: 15px;
  align-items: center;
  transition: all 0.3s;
}
.ai-product-card:hover {
  border-color: rgba(0, 212, 255, 0.3);
  transform: translateX(5px);
}
.ai-product-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  flex-shrink: 0;
}
.ai-product-info h4 {
  font-size: 1em;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
.ai-product-info p {
  font-size: 0.85em;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}
.ai-product-info a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85em;
  font-weight: 500;
}

/* 联系销售按钮 */
.ai-contact-sales {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #c9a96e 0%, #e8d5a3 100%);
  color: var(--primary);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  margin-top: 10px;
  transition: all 0.3s;
}
.ai-contact-sales:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(201, 169, 110, 0.3);
}

/* 欢迎消息 */
.ai-welcome {
  text-align: center;
  padding: 20px 0;
}
.ai-welcome h4 {
  font-size: 1.2em;
  color: var(--gold);
  margin-bottom: 10px;
}
.ai-welcome p {
  color: var(--text-muted);
  font-size: 0.9em;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    bottom: 0;
    right: 0;
  }
  #ai-smartop-widget {
    bottom: 20px;
    right: 20px;
  }
}
