/* 放心購 Chatbox 樣式 - 參考 pet-platform */

/* 浮動按鈕 */
.fxg-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #fb923c);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(244, 114, 182, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: all 0.3s ease;
  z-index: 1000;
}

.fxg-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(244, 114, 182, 0.6);
}

.fxg-chat-btn.open {
  transform: scale(0.9);
}

/* Chatbox 容器 */
.fxg-chatbox {
  position: fixed;
  bottom: 110px;
  right: 24px;
  width: 360px;
  height: 500px;
  background: rgba(255, 250, 245, 0.98);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(180, 80, 80, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid rgba(244, 114, 182, 0.3);
  z-index: 999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
  pointer-events: none;
}

.fxg-chatbox.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 頭部 */
.fxg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
}

.fxg-chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.fxg-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 消息區域 */
.fxg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: linear-gradient(180deg, #fef3f2 0%, #fff 100%);
}

.fxg-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.fxg-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.fxg-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(244, 114, 182, 0.3);
  border-radius: 3px;
}

.fxg-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 114, 182, 0.5);
}

/* 消息氣泡 */
.fxg-chat-msg {
  display: flex;
  animation: fadeIn 0.3s ease;
}

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

.fxg-chat-msg.user {
  justify-content: flex-end;
}

.fxg-chat-msg.assistant {
  justify-content: flex-start;
}

.fxg-chat-bubble {
  max-width: 75%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.fxg-chat-msg.user .fxg-chat-bubble {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: white;
  border-bottom-right-radius: 4px;
}

.fxg-chat-msg.assistant .fxg-chat-bubble {
  background: #f3e8ff;
  color: #5b21b6;
  border-bottom-left-radius: 4px;
}

/* 加載動畫 */
.fxg-chat-bubble.loading {
  letter-spacing: 4px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 輸入區域 */
.fxg-chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem;
  border-top: 1px solid rgba(244, 114, 182, 0.2);
  background: white;
}

.fxg-chat-input {
  flex: 1;
  border: 1.5px solid #f9a8d4;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.fxg-chat-input:focus {
  border-color: #f472b6;
}

.fxg-chat-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.fxg-chat-send {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 0.5rem 1.2rem;
  font-size: 0.88rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.fxg-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.3);
}

.fxg-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .fxg-chatbox {
    width: calc(100vw - 32px);
    height: calc(100vh - 140px);
    right: 16px;
    bottom: 90px;
  }
  
  .fxg-chat-btn {
    bottom: 16px;
    right: 16px;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
  }
}
