/* ============================================================
   AI 智能客服聊天组件（深蓝风格 / 响应式 / 零依赖）
   ============================================================ */
.cs-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 1000;
    width: 56px; height: 56px; border-radius: 50%;
    background: #1B3A6B; color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(27,58,107,.35);
    transition: transform .2s, background .2s;
}
.cs-fab:hover { background: #F0822A; transform: scale(1.06); }
.cs-fab-badge { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; background: #F0822A; border-radius: 50%; border: 2px solid #fff; }

.cs-win {
    position: fixed; right: 22px; bottom: 90px; z-index: 1001;
    width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 120px);
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 12px 40px rgba(20,44,82,.28);
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(16px); pointer-events: none;
    transition: opacity .22s, transform .22s;
}
.cs-win.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.cs-head { background: #1B3A6B; color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cs-head-avatar { width: 38px; height: 38px; border-radius: 50%; background: #F0822A; display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.cs-head-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cs-head-info { flex: 1; min-width: 0; }
.cs-head-name { font-size: 15px; font-weight: 600; }
.cs-head-status { font-size: 12px; opacity: .8; }
.cs-head-actions { display: flex; gap: 6px; }
.cs-head-btn { background: rgba(255,255,255,.14); border: none; color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.cs-head-btn:hover { background: #F0822A; }

.cs-body { flex: 1; overflow-y: auto; padding: 14px; background: #F5F7FA; display: flex; flex-direction: column; gap: 10px; }
.cs-msg { display: flex; gap: 8px; max-width: 88%; }
.cs-msg.ai { align-self: flex-start; }
.cs-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cs-msg-avatar { width: 30px; height: 30px; border-radius: 50%; background: #1B3A6B; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.cs-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cs-msg.user .cs-msg-avatar { background: #8A94A6; }
.cs-bubble { border-radius: 10px; padding: 9px 13px; font-size: 14px; line-height: 1.65; word-break: break-word; }
.cs-msg.ai .cs-bubble { background: #fff; color: #2B3445; border: 1px solid #E3E8F0; border-top-left-radius: 2px; }
.cs-msg.user .cs-bubble { background: #1B3A6B; color: #fff; border-top-right-radius: 2px; }
.cs-bubble + .cs-media-list { margin-top: 6px; }

/* 富媒体（图片缩略图/视频/外链卡片） */
.cs-media-list { display: flex; flex-direction: column; gap: 8px; max-width: 260px; }
.cs-media-img { border-radius: 8px; overflow: hidden; cursor: zoom-in; border: 1px solid #E3E8F0; background: #fff; }
.cs-media-img img { width: 100%; display: block; }
.cs-media-cap { font-size: 12px; color: #6B7688; padding: 4px 6px; background: #fff; }
.cs-media-video video { width: 100%; border-radius: 8px; background: #000; }
.cs-media-ext { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #E3E8F0; border-radius: 8px; padding: 10px 12px; }
.cs-media-ext .play { width: 36px; height: 36px; border-radius: 50%; background: #F0822A; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.cs-media-ext .t { font-size: 13px; color: #1B3A6B; font-weight: 600; line-height: 1.4; }
.cs-media-ext .s { font-size: 11px; color: #8A94A6; }
a.cs-media-ext:hover { border-color: #F0822A; }

/* 打字中动画 */
.cs-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.cs-typing i { width: 7px; height: 7px; border-radius: 50%; background: #B6C2D6; animation: csBounce 1.2s infinite; }
.cs-typing i:nth-child(2) { animation-delay: .15s; }
.cs-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes csBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* 输入区 */
.cs-foot { border-top: 1px solid #E3E8F0; padding: 10px; display: flex; gap: 8px; align-items: flex-end; background: #fff; flex-shrink: 0; }
.cs-input { flex: 1; border: 1px solid #E3E8F0; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: none; min-height: 52px; max-height: 110px; line-height: 1.5; }
.cs-input:focus { outline: none; border-color: #1B3A6B; }
.cs-send { background: #F0822A; color: #fff; border: none; border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.cs-send:hover { background: #D06F1F; }
.cs-send:disabled { opacity: .5; cursor: not-allowed; }

/* 留资预约表单（Modal 内部） */
.cs-lead-form .form-group { margin-bottom: 12px; }
.cs-lead-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #2B3445; }
.cs-lead-form .form-input { width: 100%; border: 1px solid #E3E8F0; border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit; }
.cs-lead-form .form-input:focus { outline: none; border-color: #1B3A6B; }
.cs-lead-tip { font-size: 12px; color: #8A94A6; margin-bottom: 12px; line-height: 1.6; }

/* 图片放大预览 */
.cs-lightbox { position: fixed; inset: 0; z-index: 1200; background: rgba(10,20,40,.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 20px; }
.cs-lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }

@media (max-width: 640px) {
    .cs-win { right: 8px; left: 8px; bottom: 82px; width: auto; max-width: none; height: 68vh; }
    .cs-fab { right: 14px; bottom: 14px; }
}
