/* ====== 科创工坊智能客服 - 聊天窗口样式 ====== */

/* 浮动按钮 */
#chat-fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(135deg, #00c4cc, #0097a7);
  color: #fff; font-size: 22px;
  box-shadow: 0 4px 16px rgba(0,229,229,.35);
  z-index: 99999; transition: all .3s ease;
  display: flex; align-items: center; justify-content: center;
}
#chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,229,229,.5); }

/* 隐藏状态（fab） */
.chat-fab-hide { opacity: 0; pointer-events: none; transform: scale(0.6); }
.chat-fab-show { opacity: 1; pointer-events: auto; }

/* 聊天窗口 */
#chat-widget {
  position: fixed; bottom: 96px; right: 24px;
  width: 380px; height: 520px;
  background: #fff; border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
  z-index: 100000; display: flex; flex-direction: column;
  overflow: hidden; font-family: 'Inter', -apple-system, sans-serif;
  transition: all .35s cubic-bezier(.16,1,.3,1);
}

/* 隐藏/显示状态 */
.chat-hidden {
  opacity: 0; pointer-events: none;
  transform: translateY(20px) scale(.95);
}
.chat-show {
  opacity: 1; pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* 头部 */
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #0a1628, #132238);
  color: #fff; font-size: 14px; font-weight: 700;
}
#chat-title { letter-spacing: .5px; }
#chat-close {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 16px; cursor: pointer; transition: all .2s ease;
  display: flex; align-items: center; justify-content: center;
}
#chat-close:hover { background: rgba(255,255,255,.3); }

/* 消息区域 */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f8fafc;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* 单条消息 */
.msg { display: flex; gap: 8px; max-width: 88%; animation: msgIn .25s ease both; }
.user-msg { flex-direction: row-reverse; margin-left: auto; }
.bot-msg { margin-right: auto; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #e6f5f6, #d0eeef);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; border: 1.5px solid rgba(0,151,157,.2);
}
.msg-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.55; word-break: break-word;
  white-space: pre-wrap;
}
.bot-msg .msg-bubble {
  background: #fff; color: #334155;
  border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
}
.user-msg .msg-bubble {
  background: linear-gradient(135deg, #00c4cc, #0097a7); color: #fff;
  border-bottom-right-radius: 4px;
}

/* 输入区 */
.chat-input-row {
  display: flex; gap: 8px; padding: 12px 14px;
  background: #fff; border-top: 1px solid #eef2f6;
}
.chat-input-row input {
  flex: 1; padding: 10px 14px; border-radius: 20px;
  border: 1.5px solid #e2e8f0; outline: none;
  font-size: 13px; transition: border-color .2s;
  font-family: inherit;
}
.chat-input-row input:focus { border-color: #00e5e5; }
.chat-input-row button {
  padding: 10px 18px; border-radius: 20px; border: none;
  background: linear-gradient(135deg, #00c4cc, #0097a7);
  color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s ease; white-space: nowrap;
}
.chat-input-row button:hover { opacity: .9; transform: scale(1.02); }
.chat-input-row button:disabled { opacity: .4; cursor: not-allowed; }

/* 加载动画 */
.typing-indicator {
  display: flex; gap: 4px; padding: 8px 12px;
}
.typing-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8; animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: .3; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* 响应式：手机端适配 */
@media(max-width: 480px) {
  #chat-widget {
    width: calc(100vw - 32px);
    right: 16px; bottom: 80px;
    height: calc(100vh - 140px);
    border-radius: 16px;
  }
  #chat-fab { bottom: 20px; right: 20px; width: 48px; height: 48px; font-size: 19px; }
}
