/* CustomerService 访客聊天窗口样式 */

/* ---- 右下角悬浮按钮组：在线客服/电话/QQ/微信 ---- */
.cs-fab-stack {
    position: fixed;
    right: 20px;
    bottom: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 99990;
}
.cs-fab-item { position: relative; }

.cs-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}
.cs-fab:hover { transform: scale(1.08); }
.cs-fab.cs-chat { background: #2563eb; }
.cs-fab.cs-phone { background: #ff6b35; }
.cs-fab.cs-qq { background: #12b7f5; }
.cs-fab.cs-wechat { background: #07c160; }

.cs-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    border-radius: 9999px;
}

.cs-pop {
    display: none;
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
    padding: 14px 16px;
    white-space: nowrap;
    z-index: 99991;
}
.cs-pop::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    margin-top: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
}
.cs-pop.show { display: block; }
.cs-pop-line {
    display: block;
    color: #1f2937 !important;
    text-decoration: none;
    font-size: 14px;
    line-height: 2;
}
.cs-pop-line:hover { color: #2563eb !important; }
.cs-pop-line strong { font-size: 15px; letter-spacing: .5px; }
.cs-pop-note {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
    text-align: center;
}
.cs-pop-qr {
    display: block;
    width: 150px;
    height: auto;
    border-radius: 6px;
}

/* ---- 聊天窗口 ---- */
.cs-panel {
    position: fixed;
    right: 20px;
    bottom: 100px;
    width: 400px;
    height: 560px;
    max-height: calc(100vh - 120px);
    min-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99992;
    transition: all .3s ease;
}
.cs-panel.cs-hide { display: none; }
.cs-panel.cs-drag { outline: 2px dashed #2563eb; outline-offset: -6px; }
.cs-panel.cs-maximized {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: 80vw;
    height: 80vh;
    max-width: 900px;
    max-height: 700px;
    transform: translate(-50%, -50%);
    border-radius: 16px;
}

.cs-panel-head {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cs-panel-head .cs-title { font-size: 15px; font-weight: bold; letter-spacing: 1px; }
.cs-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
    margin-left: 6px;
}
.cs-close:hover { opacity: 1; }
.cs-maximize {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
    margin-left: 6px;
    padding: 2px 4px;
}
.cs-maximize:hover { opacity: 1; }
.cs-maximize svg { vertical-align: middle; }

.cs-mode {
    display: flex;
    margin-left: 10px;
    background: rgba(255, 255, 255, .16);
    border-radius: 9999px;
    padding: 2px 10px;
    align-items: center;
}
.cs-mode-label { font-size: 12px; color: rgba(255,255,255,.95); }
.cs-mode-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .85);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 6px;
}
.cs-mode-btn:hover { background: rgba(255,255,255,.15); }

.cs-msg .cs-name {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 3px;
    user-select: none;
}

.cs-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f6f8fb;
}
.cs-tip,
.cs-systip {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin: 6px 0;
    white-space: pre-line;
}
.cs-msg { display: flex; margin-bottom: 10px; }
.cs-msg.agent { justify-content: flex-start; }
.cs-msg.visitor { justify-content: flex-end; }
.cs-msg > div {
    max-width: 82%;
    min-width: 40px;
}
.cs-bubble {
    max-width: 100%;
    min-width: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    white-space: normal;
    display: inline-block;
    text-align: left;
}
.cs-msg.agent .cs-bubble,
.cs-msg.agent .cs-media { background: #fff; border: 1px solid #e5eaf1; color: #1f2937; }
.cs-msg.visitor .cs-bubble,
.cs-msg.visitor .cs-media { background: #2563eb; color: #fff; }
.cs-msg.ai .cs-bubble,
.cs-msg.ai .cs-media { background: #f3f0ff; border: 1px solid #ddd3fb; color: #1f2937; }

.cs-link {
    color: #2563eb !important;
    text-decoration: underline;
    word-break: break-all;
}
.cs-msg.visitor .cs-link { color: #fff !important; }

/* 媒体消息 */
.cs-media {
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.cs-media-image { padding: 4px; background: #fff; border: 1px solid #e5eaf1; }
.cs-msg.visitor .cs-media-image { background: #2563eb; border-color: #2563eb; }
.cs-msg.ai .cs-media-image { background: #f3f0ff; border: 1px solid #ddd3fb; }
.cs-img {
    display: block;
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: zoom-in;
    background: #f1f5f9;
}
.cs-img-copy {
    position: absolute;
    right: 8px;
    bottom: 8px;
    border: none;
    background: rgba(15, 23, 42, .65);
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    cursor: pointer;
}
.cs-img-copy:hover { background: rgba(15, 23, 42, .85); }

.cs-media-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-width: 180px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #fff;
}
.cs-file-icon { font-size: 22px; }
.cs-file-name {
    display: block;
    color: #2563eb !important;
    font-size: 13px;
    text-decoration: none;
    word-break: break-all;
    max-width: 180px;
}
.cs-file-name:hover { text-decoration: underline; }
.cs-file-size { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.cs-msg.visitor .cs-file-name { color: #fff !important; }
.cs-msg.visitor .cs-file-size { color: rgba(255,255,255,.8); }

/* 底部工具栏 + 输入 */
.cs-foot {
    border-top: 1px solid #e5eaf1;
    background: #fff;
    padding: 8px 10px 10px;
    position: relative;
}
.cs-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.cs-tool {
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    width: 32px;
    height: 28px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.cs-tool:hover { background: #e2e8f0; }
.cs-tool-hint {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
}
.cs-emoji-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
    padding: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
}
.cs-emoji-panel.cs-hide { display: none; }
.cs-emoji-item {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
}
.cs-emoji-item:hover { background: #e2e8f0; }

.cs-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.cs-input {
    flex: 1;
    resize: none;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    height: 58px;
    outline: none;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.cs-input:focus { border-color: #93c5fd; }
.cs-send {
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 14px;
    cursor: pointer;
}
.cs-send:hover { background: #1d4ed8; }

@media (max-width: 768px) {
    .cs-panel {
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: auto;
        height: auto;
        max-height: none;
        min-height: 0;
        border-radius: 0;
    }
    .cs-fab-stack { right: 14px; bottom: 20px; }
    .cs-tool-hint { display: none; }
    .cs-img { max-width: 180px; max-height: 180px; }
}
