/**
 * ECC 智能客服样式
 */

/* ========== 悬浮气泡按钮 ========== */
.ecc-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1677ff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(22, 119, 255, 0.4);
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ecc-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(22, 119, 255, 0.5);
}
.ecc-chat-bubble svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* ========== 聊天窗口（隐藏态）============ */
.ecc-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* 默认隐藏 */
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.ecc-chat-widget.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 手机端自适应 */
@media (max-width: 768px) {
    .ecc-chat-bubble {
        bottom: 16px;
        right: 16px;
    }
    .ecc-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* ========== 窗口标题栏 ========== */
.ecc-chat-header {
    padding: 14px 16px;
    background: #1677ff;
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    flex-shrink: 0;
}
.ecc-chat-header span {
    font-size: 15px;
}
.ecc-chat-header-buttons {
    display: flex;
    gap: 12px;
}
.ecc-chat-header-buttons button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ========== 聊天内容区 ========== */
.ecc-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f7f8fa;
    font-size: 14px;
    line-height: 1.5;
}
.ecc-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.ecc-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ========== 消息气泡 ========== */
.ecc-chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    animation: eccMsgFadeIn 0.25s ease;
}
.ecc-chat-message.user {
    flex-direction: row-reverse;
}
.ecc-chat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1677ff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-right: 8px;
}
.ecc-chat-message.user .ecc-chat-message-avatar {
    background: #52c41a;
    margin-right: 0;
    margin-left: 8px;
}
.ecc-chat-message-content {
    max-width: 75%;
}
.ecc-chat-message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    word-break: break-word;
    white-space: pre-wrap;
}
.ecc-chat-message.user .ecc-chat-message-bubble {
    background: #dfeeff;
    border-radius: 14px 14px 4px 14px;
}
.ecc-chat-message.assistant .ecc-chat-message-bubble {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 14px 14px 14px 4px;
}
.ecc-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}
.ecc-chat-message.user .ecc-chat-message-time {
    text-align: right;
}

/* ========== 底部操作区 ========== */
.ecc-chat-bottom {
    padding: 12px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.ecc-chat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.ecc-chat-buttons .ecc-chat-quick-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
}
.ecc-chat-buttons .ecc-chat-quick-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

/* 输入框行布局：输入框 + 发送按钮并排 */
.ecc-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

/* 输入框样式：占满剩余空间 */
#ecc-chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid #ddd;
    font-size: 14px;
    outline: none;
    min-width: 0;
    font-family: inherit;
}
#ecc-chat-input:focus {
    border-color: #1677ff;
}

/* 发送按钮：主色突出，一眼可见 */
.ecc-send-primary {
    background: #1677ff;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}
.ecc-send-primary:hover {
    background: #4096ff;
}
@media (max-width: 768px) {
    .ecc-send-primary {
        padding: 12px 16px;
    }
}

/* ========== 输入中动画 ========== */
.ecc-chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.ecc-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: eccTypingBounce 1.2s infinite;
}
.ecc-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ecc-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes eccMsgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes eccTypingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}
