﻿/* ==========================================================================
 * 衷遥 AI 小助手 widget — v2
 * ========================================================================== */
:root {
  --cw-primary: #0B3D6B;
  --cw-primary-dark: #08294A;
  --cw-accent: #F26B1F;
  --cw-bg: #f5f7fa;
  --cw-bubble-ai: #ffffff;
  --cw-bubble-user: var(--cw-accent);
  --cw-border: #e0e4ea;
}

.cw-btn {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cw-accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(242, 107, 31, .35);
  z-index: 9998;
  border: none;
  transition: transform .2s, box-shadow .2s;
  font-family: inherit;
}
.cw-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(242, 107, 31, .45);
}
.cw-btn:active { transform: scale(.97); }
.cw-btn-icon { font-size: 24px; line-height: 1; }
.cw-btn-text {
  font-size: 11px;
  margin-top: 2px;
  font-weight: 500;
  letter-spacing: 1px;
}

.cw-panel {
  position: fixed;
  right: 20px;
  bottom: 160px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 200px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.cw-panel.open { display: flex; }

.cw-head {
  background: linear-gradient(135deg, var(--cw-primary) 0%, var(--cw-primary-dark) 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cw-head-title { display: flex; align-items: center; gap: 10px; }
.cw-head-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ee07a;
  box-shadow: 0 0 0 3px rgba(46, 224, 122, .25);
  flex-shrink: 0;
}
.cw-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}
.cw-head-sub {
  font-size: 11px;
  opacity: .85;
  display: block;
  margin-top: 2px;
}
.cw-head-close {
  cursor: pointer;
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.cw-head-close:hover { background: rgba(255, 255, 255, .25); }

.cw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--cw-border);
}
.cw-chip {
  background: #fff;
  border: 1px solid var(--cw-border);
  color: var(--cw-primary);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.cw-chip:hover {
  background: var(--cw-primary);
  color: #fff;
  border-color: var(--cw-primary);
}

.cw-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--cw-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cw-msg { display: flex; }
.cw-msg.user { justify-content: flex-end; }
.cw-bubble {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 10px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 13.5px;
}
.cw-msg.ai .cw-bubble {
  background: var(--cw-bubble-ai);
  border: 1px solid var(--cw-border);
  color: #222;
  border-top-left-radius: 2px;
}
.cw-msg.user .cw-bubble {
  background: var(--cw-bubble-user);
  color: #fff;
  border-top-right-radius: 2px;
}
.cw-msg.ai .cw-bubble.cw-typing {
  padding: 12px 14px;
  background: var(--cw-bubble-ai);
  border: 1px solid var(--cw-border);
}
.cw-typing .cw-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c0c8d4;
  margin: 0 2px;
  animation: cw-bounce 1.2s infinite;
}
.cw-typing .cw-dot:nth-child(2) { animation-delay: .15s; }
.cw-typing .cw-dot:nth-child(3) { animation-delay: .3s; }
@keyframes cw-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.cw-foot {
  padding: 10px;
  border-top: 1px solid var(--cw-border);
  display: flex;
  gap: 6px;
  background: #fff;
}
.cw-foot input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--cw-border);
  border-radius: 18px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
.cw-foot input:focus { border-color: var(--cw-accent); }
.cw-foot input:disabled { background: #f0f0f0; }
.cw-foot button {
  padding: 8px 16px;
  background: var(--cw-accent);
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background .15s;
}
.cw-foot button:hover:not(:disabled) { background: #d8571a; }
.cw-foot button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .cw-panel {
    right: 10px;
    bottom: 140px;
    width: calc(100vw - 20px);
    height: 70vh;
  }
  .cw-btn { right: 14px; bottom: 70px; width: 56px; height: 56px; }
}