/* widget.css - Bitdefender 客服挂件样式 */

/* ── 全局变量 ──────────────────────────────────────────── */
:root {
  --bd-blue:        #006EFF;
  --bd-blue-dark:   #0054CC;
  --bd-blue-light:  #3389FF;
  --bd-blue-bg:     #EBF3FF;
  --bd-text:        #1a1a2e;
  --bd-text-light:  #6b7280;
  --bd-border:      #e5e7eb;
  --bd-white:       #ffffff;
  --bd-radius:      16px;
  --bd-shadow:      0 12px 40px rgba(0, 110, 255, 0.18), 0 2px 8px rgba(0,0,0,0.08);
}

/* ── 容器 ──────────────────────────────────────────────── */
#csc-container * {
  box-sizing: border-box;
  font-family: 'Microsoft YaHei', '微软雅黑', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', sans-serif;
}

/* ── 悬浮按钮 ──────────────────────────────────────────── */
#csc-toggle {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: auto;
  min-width: 56px;
  height: 52px;
  padding: 0 20px;
  border-radius: 26px;
  background: var(--bd-blue);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 110, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  white-space: nowrap;
}
#csc-toggle:hover {
  background: var(--bd-blue-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 110, 255, 0.5);
}
#csc-toggle:active {
  transform: translateY(0);
  background: var(--bd-blue-dark);
}
.csc-toggle-icon {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}
.csc-toggle-text {
  color: var(--bd-white);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── 消息角标 ──────────────────────────────────────────── */
.csc-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(255,59,48,0.4);
  animation: csc-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes csc-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── 聊天窗口 ──────────────────────────────────────────── */
#csc-window {
  position: fixed;
  right: 28px;
  bottom: 96px;
  width: 360px;
  height: 520px;
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  background: var(--bd-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: csc-slide-up 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
  border: 1px solid rgba(0, 110, 255, 0.1);
}
@keyframes csc-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 头部 ──────────────────────────────────────────────── */
#csc-header {
  background: var(--bd-blue);
  padding: 0 18px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

/* Logo 区域 */
.csc-header-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* 标题文字区 */
.csc-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.csc-header-title {
  color: var(--bd-white);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.csc-header-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

/* 关闭按钮 */
#csc-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--bd-white);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s;
  flex-shrink: 0;
}
#csc-close:hover {
  background: rgba(255,255,255,0.28);
}

/* ── 状态指示点 ──────────────────────────────────────────── */
.csc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.csc-dot--online      { background: #34d058; box-shadow: 0 0 0 2px rgba(52,208,88,0.35); }
.csc-dot--offline     { background: rgba(255,255,255,0.4); }
.csc-dot--connecting  { background: #fbbf24; animation: csc-blink 1s infinite; }
@keyframes csc-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── 欢迎横幅 ────────────────────────────────────────────── */
.csc-welcome-banner {
  background: var(--bd-blue-bg);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--bd-border);
  flex-shrink: 0;
}
.csc-welcome-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}
.csc-welcome-text {
  font-size: 13px;
  color: var(--bd-text);
  line-height: 1.55;
}
.csc-welcome-text strong {
  color: var(--bd-blue);
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

/* ── 消息区 ──────────────────────────────────────────────── */
#csc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8faff;
}
#csc-messages::-webkit-scrollbar { width: 4px; }
#csc-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
#csc-messages::-webkit-scrollbar-track { background: transparent; }

/* ── 系统消息 ────────────────────────────────────────────── */
.csc-system {
  text-align: center;
  font-size: 12px;
  color: var(--bd-text-light);
  padding: 3px 12px;
  background: rgba(0,0,0,0.04);
  border-radius: 20px;
  align-self: center;
  max-width: 80%;
  line-height: 1.5;
}

/* ── 时间戳 ─────────────────────────────────────────────── */
.csc-timestamp {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  align-self: center;
  margin: -4px 0;
}

/* ── 消息气泡 ────────────────────────────────────────────── */
.csc-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 4px;
}
.csc-msg--user  { align-self: flex-end; align-items: flex-end; }
.csc-msg--agent { align-self: flex-start; align-items: flex-start; }

/* 消息头部（头像+名字） */
.csc-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
}
.csc-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: block;
  flex-shrink: 0;
  object-fit: cover;
}
.csc-msg-name {
  font-size: 12px;
  color: var(--bd-text-light);
  font-weight: 500;
}

/* 气泡本体 */
.csc-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}
.csc-msg--user .csc-bubble {
  background: var(--bd-blue);
  color: var(--bd-white);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 110, 255, 0.25);
}
.csc-msg--agent .csc-bubble {
  background: var(--bd-white);
  color: var(--bd-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  border: 1px solid var(--bd-border);
}

/* 打字动画（客服正在输入） */
.csc-typing .csc-bubble {
  padding: 12px 16px;
}
.csc-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.csc-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: csc-bounce 1.2s infinite;
}
.csc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.csc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes csc-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ── 输入区 ──────────────────────────────────────────────── */
#csc-footer {
  border-top: 1px solid var(--bd-border);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bd-white);
}
.csc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#csc-input {
  flex: 1;
  border: 1.5px solid var(--bd-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 72px;
  line-height: 1.4;
  color: var(--bd-text);
  background: #f9fafb;
  transition: border-color 0.2s, background 0.2s;
}
#csc-input:focus {
  border-color: var(--bd-blue);
  background: var(--bd-white);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.1);
}
#csc-input::placeholder { color: #b0b7c3; }

#csc-send {
  background: var(--bd-blue);
  color: var(--bd-white);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
#csc-send img {
  width: 20px;
  height: 20px;
  display: block;
}
#csc-send:hover  { background: var(--bd-blue-light); transform: scale(1.05); }
#csc-send:active { background: var(--bd-blue-dark); transform: scale(0.97); }

/* 底部提示文字 */
.csc-footer-tip {
  text-align: center;
  font-size: 11px;
  color: #c0c7d4;
  letter-spacing: 0.2px;
}
.csc-footer-tip span { color: var(--bd-blue); opacity: 0.7; }

/* ── 手机端适配 ──────────────────────────────────────────── */
@media (max-width: 480px) {
  #csc-window {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 75vh;
    border-radius: 18px 18px 0 0;
  }
  #csc-toggle {
    right: 16px;
    bottom: 16px;
  }
}

/* ���� ����ѡ���� ���������������������������������������������������������������������������������������� */
.csc-emoji-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.csc-emoji-btn:hover {
  background: rgba(0, 110, 255, 0.1);
}

.csc-emoji-picker {
  background: var(--bd-white);
  border-top: 1px solid var(--bd-border);
  padding: 10px;
  max-height: 150px;
  overflow-y: auto;
}
.csc-emoji-list {
  font-size: 24px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.csc-emoji-picker::-webkit-scrollbar { width: 4px; }
.csc-emoji-picker::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
