/* ===== 红海车域 - 全局聊天组件样式 ===== */

/* 浮动按钮（默认隐藏，由JS控制显示） */
.cw-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FB331F, #D92814);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 99998;
  box-shadow: 0 4px 20px rgba(251,51,31,0.4);
  transition: transform 0.2s, opacity 0.3s;
}
.cw-float:hover { transform: scale(1.08); }

.cw-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  background: #FF5722;
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 10px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* 聊天面板 */
.cw-panel {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 360px; height: 520px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  animation: cwPop 0.25s ease;
  border: 1px solid #f0f0f0;
}
@keyframes cwPop {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 头部 */
.cw-header {
  background: linear-gradient(135deg, #24549B, #1A3D73);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cw-h-title { font-size: 16px; font-weight: 600; }
.cw-h-sub { font-size: 12px; opacity: 0.85; margin-top: 3px; }
.cw-min {
  width: 30px; height: 30px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.cw-min:hover { background: rgba(255,255,255,0.32); }

/* 消息区 */
.cw-body {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  background: #F5F7FB;
}
.cw-body::-webkit-scrollbar { width: 6px; }
.cw-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.cw-msg { display: flex; flex-direction: column; margin-bottom: 12px; gap: 3px; }
.cw-me   { align-items: flex-end; }
.cw-them { align-items: flex-start; }

.cw-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.cw-b-them { background: #fff; color: #333; border: 1px solid #eee; border-top-left-radius: 4px; }
.cw-b-me   { background: linear-gradient(135deg, #3570D4, #24549B); color: #fff; border-top-right-radius: 4px; }

.cw-time { font-size: 11px; color: #aaa; padding: 0 4px; }

/* 输入区 */
.cw-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
#cwInput {
  flex: 1;
  resize: none;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
}
#cwInput:focus { border-color: #24549B; }

.cw-send {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #FB331F, #D92814);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cw-send:hover { opacity: 0.9; }

.cw-login-tip {
  padding: 8px 12px;
  background: #FFF6EE;
  color: #666;
  font-size: 12px;
  border-top: 1px solid #f5e5d8;
  flex-shrink: 0;
}
.cw-login-tip a { color: #FB331F; }

/* 小屏 */
@media (max-width: 640px) {
  .cw-panel {
    right: 8px; bottom: 8px; left: 8px;
    width: auto; height: 65vh;
  }
  .cw-float { right: 14px; bottom: 14px; width: 48px; height: 48px; font-size: 20px; }
}
