/* ==========================================
   Bear Chat Widget — 趴趴熊聊天框
   ========================================== */

/* 聊天框容器 */
#bearChatWidget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 340px;
  max-height: 480px;
  background: rgba(18,22,36,0.95);
  border: 1px solid rgba(100,160,255,0.2);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 20px rgba(100,160,255,0.08);
  display: none;
  flex-direction: column;
  z-index: 200;
  backdrop-filter: blur(12px);
  overflow: hidden;
  animation: chatSlideUp 0.3s ease-out;
}

#bearChatWidget.open {
  display: flex;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 标题栏 */
.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(100,160,255,0.12);
  flex-shrink: 0;
}

.chat-header .avatar {
  width: 32px;
  height: 32px;
  background: rgba(100,160,255,0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 10px;
}

.chat-header .info {
  flex: 1;
}

.chat-header .info .name {
  color: rgba(220,235,255,0.9);
  font-size: 14px;
  font-weight: 500;
}

.chat-header .info .status {
  color: rgba(100,200,120,0.8);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header .info .status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #64c878;
  border-radius: 50%;
  display: inline-block;
  animation: statusPulse 2s ease-in-out infinite;
}

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

.chat-header .btn-close {
  background: none;
  border: none;
  color: rgba(180,200,240,0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.chat-header .btn-close:hover {
  color: rgba(180,200,240,0.8);
}

/* 消息列表 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 320px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(100,160,255,0.15);
  border-radius: 2px;
}

/* 消息气泡 */
.msg {
  max-width: 85%;
  padding: 8px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: msgIn 0.25s ease-out;
}

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

.msg.bear {
  align-self: flex-start;
  background: rgba(100,160,255,0.1);
  color: rgba(200,220,255,0.9);
  border-bottom-left-radius: 4px;
}

.msg.user {
  align-self: flex-end;
  background: rgba(100,160,255,0.2);
  color: rgba(220,235,255,0.95);
  border-bottom-right-radius: 4px;
}

.msg.admin {
  align-self: flex-start;
  background: rgba(230,180,60,0.12);
  color: rgba(245,220,150,0.95);
  border: 1px solid rgba(230,180,60,0.2);
  border-bottom-left-radius: 4px;
  font-size: 13px;
}

.msg.typing {
  align-self: flex-start;
  background: rgba(100,160,255,0.08);
  color: rgba(180,200,240,0.6);
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.msg.typing span {
  width: 6px;
  height: 6px;
  background: rgba(180,200,240,0.5);
  border-radius: 50%;
  animation: typingDot 1.4s ease-in-out infinite;
}

.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* 输入区 */
.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(100,160,255,0.1);
  flex-shrink: 0;
}

.chat-input input {
  flex: 1;
  background: rgba(40,50,80,0.4);
  border: 1px solid rgba(100,160,255,0.12);
  border-radius: 20px;
  padding: 8px 14px;
  color: rgba(220,235,255,0.85);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: rgba(100,160,255,0.3);
}

.chat-input input::placeholder {
  color: rgba(180,200,240,0.3);
}

.chat-input .btn-send {
  width: 34px;
  height: 34px;
  background: rgba(100,160,255,0.2);
  border: 1px solid rgba(100,160,255,0.15);
  border-radius: 50%;
  color: rgba(180,210,255,0.8);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-input .btn-send:hover {
  background: rgba(100,160,255,0.3);
  color: rgba(220,235,255,0.95);
}

.chat-input .btn-send:active {
  transform: scale(0.92);
}
