/* ================================================================
   客服浮窗样式（四端共享）
   完整版 · 463行
   ================================================================ */

.customer-service {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ----- 触发按钮 ----- */
.customer-service .cs-trigger {
    position: relative;
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.customer-service .cs-trigger:hover {
    transform: scale(1.08);
}

.customer-service .cs-trigger-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    position: relative;
    transition: box-shadow 0.3s;
}
.customer-service .cs-trigger-inner:hover {
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.5);
}

.customer-service .cs-icon {
    width: 30px;
    height: 30px;
}

.customer-service .cs-status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    background: #22c55e;
}
.customer-service .cs-status-dot.offline {
    background: #94a3b8;
}
.customer-service .cs-status-dot.busy {
    background: #f59e0b;
    animation: csPulse 2s ease-in-out infinite;
}

@keyframes csPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.customer-service .cs-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.customer-service .cs-badge.show {
    opacity: 1;
    transform: scale(1);
}

.customer-service .cs-tooltip {
    position: absolute;
    right: 74px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.customer-service .cs-trigger:hover .cs-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
}
.customer-service .cs-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(15, 23, 42, 0.92);
}

/* ----- 客服面板 ----- */
.customer-service .cs-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: 620px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    opacity: 0;
    transform: scale(0.85) translateY(20px);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.customer-service .cs-panel.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ----- 面板头部 ----- */
.customer-service .cs-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.customer-service .cs-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.customer-service .cs-header-left .cs-status-dot {
    position: static;
    width: 10px;
    height: 10px;
    border-width: 0;
}
.customer-service .cs-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
}
.customer-service .cs-subtitle {
    font-size: 12px;
    color: #64748b;
}
.customer-service .cs-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.04);
    border-radius: 50%;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.customer-service .cs-close:hover {
    background: rgba(0,0,0,0.08);
    color: #0f172a;
}

/* ----- 快捷入口 ----- */
.customer-service .cs-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.customer-service .cs-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: #475569;
    font-size: 11px;
    transition: all 0.2s;
    font-family: inherit;
}
.customer-service .cs-quick-btn svg {
    stroke: #64748b;
    transition: stroke 0.2s;
}
.customer-service .cs-quick-btn:hover {
    background: rgba(37, 99, 235, 0.06);
    color: #2563eb;
}
.customer-service .cs-quick-btn:hover svg {
    stroke: #2563eb;
}
.customer-service .cs-quick-btn.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}
.customer-service .cs-quick-btn.active svg {
    stroke: #2563eb;
}

/* ----- 聊天区域 ----- */
.customer-service .cs-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.customer-service .cs-messages {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #ffffff;
    min-height: 200px;
    max-height: 320px;
}
.customer-service .cs-messages::-webkit-scrollbar {
    width: 4px;
}
.customer-service .cs-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.customer-service .cs-message {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: csMsgIn 0.3s ease;
}
.customer-service .cs-message.system {
    align-self: flex-start;
}
.customer-service .cs-message.user {
    align-self: flex-end;
}

@keyframes csMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.customer-service .cs-message-bubble {
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}
.customer-service .cs-message.system .cs-message-bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}
.customer-service .cs-message.user .cs-message-bubble {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.customer-service .cs-message-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}
.customer-service .cs-message.user .cs-message-time {
    text-align: right;
}

/* ----- 输入区 ----- */
.customer-service .cs-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 14px 8px 14px;
    border-top: 1px solid #e2e8f0;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}
.customer-service .cs-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 100px;
    line-height: 1.5;
}
.customer-service .cs-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.customer-service .cs-input::placeholder {
    color: #94a3b8;
}

.customer-service .cs-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.customer-service .cs-send-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}
.customer-service .cs-send-btn:active {
    transform: scale(0.95);
}
.customer-service .cs-send-btn svg {
    stroke: #fff;
}

/* ----- 快捷建议 ----- */
.customer-service .cs-suggestions {
    display: flex;
    gap: 8px;
    padding: 6px 14px 10px 14px;
    flex-wrap: wrap;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    flex-shrink: 0;
}
.customer-service .cs-suggestion-chip {
    padding: 5px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.customer-service .cs-suggestion-chip:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.04);
}

/* ----- 渠道面板 ----- */
.customer-service .cs-channel-panel {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    background: #fff;
    display: none;
}
.customer-service .cs-channel-panel.active {
    display: block;
}
.customer-service .cs-channel-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.customer-service .cs-channel-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #0f172a;
}
.customer-service .cs-channel-item:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.03);
}
.customer-service .cs-channel-item .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 20px;
    flex-shrink: 0;
}
.customer-service .cs-channel-item .info {
    flex: 1;
}
.customer-service .cs-channel-item .info .label {
    font-size: 14px;
    font-weight: 500;
}
.customer-service .cs-channel-item .info .desc {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ----- 底部 ----- */
.customer-service .cs-footer {
    padding: 8px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
}
.customer-service .cs-response-time {
    color: #22c55e;
    font-weight: 500;
}

/* ----- 情境服务卡 ----- */
.customer-service .cs-context-container {
    background: linear-gradient(135deg, #f0f4ff 0%, #f8faff 100%);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid rgba(37, 99, 235, 0.10);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.04);
}
.customer-service .cs-context-header {
    margin-bottom: 10px;
}
.customer-service .cs-context-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}
.customer-service .cs-context-subtitle {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}
.customer-service .cs-context-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.customer-service .cs-context-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e8edf5;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.customer-service .cs-context-card:hover {
    border-color: #2563eb;
    background: #f8faff;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.10);
}
.customer-service .cs-context-card:active {
    transform: scale(0.98);
}
.customer-service .cs-context-card-icon {
    font-size: 18px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
    flex-shrink: 0;
}
.customer-service .cs-context-card-info {
    flex: 1;
    min-width: 0;
}
.customer-service .cs-context-card-label {
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
}
.customer-service .cs-context-card-desc {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}
.customer-service .cs-context-card-arrow {
    font-size: 16px;
    color: #94a3b8;
    transition: all 0.2s;
    flex-shrink: 0;
}
.customer-service .cs-context-card:hover .cs-context-card-arrow {
    color: #2563eb;
    transform: translateX(2px);
}

/* ----- 响应式适配 ----- */
@media (max-width: 480px) {
    .customer-service {
        bottom: 16px;
        right: 16px;
    }
    .customer-service .cs-trigger {
        width: 56px;
        height: 56px;
    }
    .customer-service .cs-icon {
        width: 26px;
        height: 26px;
    }
    .customer-service .cs-panel {
        bottom: 72px;
        right: 0;
        width: calc(100vw - 32px);
        max-height: 80vh;
        border-radius: 16px;
    }
    .customer-service .cs-quick-actions {
        grid-template-columns: repeat(4, 1fr);
        padding: 8px 6px;
    }
    .customer-service .cs-quick-btn {
        font-size: 10px;
        padding: 4px 2px;
    }
    .customer-service .cs-messages {
        max-height: 200px;
        padding: 10px 12px;
    }
    .customer-service .cs-tooltip {
        display: none;
    }
    .customer-service .cs-context-container {
        padding: 10px 12px;
    }
    .customer-service .cs-context-card {
        padding: 6px 10px;
    }
    .customer-service .cs-context-card-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .customer-service .cs-context-card-label {
        font-size: 12px;
    }
}

/* ----- 打字动画 ----- */
@keyframes csTyping {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
    30% { opacity: 1; transform: scale(1.2); }
}