/* 基础样式 */
#sparklite-chat-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    font-size: 14px;
}

#sparklite-chat-container.sparklite-position-right {
    right: 20px;
}

#sparklite-chat-container.sparklite-position-left {
    left: 20px;
}

#sparklite-chat-container.sparklite-hidden {
    display: none;
}

/* 浮动按钮样式 */
#sparklite-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #4e8cff;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 99999;
}

/* 浮动按钮头像样式 */
#sparklite-chat-toggle .sparklite-float-button-avatar {
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

#sparklite-chat-toggle .sparklite-float-button-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#sparklite-chat-toggle:hover .sparklite-float-button-avatar {
    transform: scale(1.1);
}

/* 调整徽标位置 */
#sparklite-chat-toggle .sparklite-float-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 聊天窗口样式 */
.sparklite-chat-wrapper {
    width: 350px;
    max-width: 100%;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    height: 500px;
    max-height: 80vh;
    transition: all 0.3s ease;
}

/* 聊天头部样式 */
.sparklite-chat-header {
    padding: 15px;
    background-color: #4e8cff;
    color: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sparklite-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sparklite-ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.sparklite-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sparklite-chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.sparklite-chat-actions {
    display: flex;
    gap: 10px;
}

.sparklite-chat-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    padding: 5px;
    border-radius: 4px;
}

.sparklite-chat-actions button:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* 聊天主体样式 */
.sparklite-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.sparklite-welcome-message {
    padding: 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    transition: opacity 0.3s ease;
}

.sparklite-welcome-content p {
    margin-top: 0;
    color: #495057;
}

.sparklite-quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 15px 0;
}

.sparklite-quick-question {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 18px;
    padding: 6px 12px;
    font-size: 13px;
    color: #4e8cff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.sparklite-quick-question:hover {
    background-color: #f1f6ff;
}

.sparklite-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scroll-behavior: smooth;
}

/* 消息样式 */
.sparklite-message {
    margin-bottom: 15px;
    max-width: 80%;
}

.sparklite-message-user {
    margin-left: auto;
}

.sparklite-message-ai {
    margin-right: auto;
}

.sparklite-message-nickname {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.sparklite-message-content {
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.sparklite-message-user .sparklite-message-content {
    background-color: #4e8cff;
    color: white;
    border-bottom-right-radius: 4px;
}

.sparklite-message-ai .sparklite-message-content {
    background-color: #f1f3f5;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.sparklite-message-time {
    display: block;
    font-size: 11px;
    color: #adb5bd;
    margin-top: 4px;
    text-align: right;
}

.sparklite-message-ai .sparklite-message-time {
    text-align: left;
}

/* 输入指示器 */
.sparklite-typing-indicator {
    display: none;
    padding: 10px 15px;
    align-items: center;
    gap: 8px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.sparklite-typing-dots {
    display: flex;
    gap: 4px;
}

.sparklite-typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #adb5bd;
    border-radius: 50%;
    animation: sparklite-bounce 1.4s infinite ease-in-out;
}

.sparklite-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.sparklite-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes sparklite-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

.sparklite-typing-text {
    font-size: 12px;
    color: #4e8cff;
}

/* 聊天底部样式 */
.sparklite-chat-footer {
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.sparklite-input-container {
    padding: 10px;
}

.sparklite-input-box {
    display: flex;
    align-items: flex-end;
    gap: 5px;
}

.sparklite-message-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 18px;
    padding: 8px 15px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: #800080;
}

.sparklite-message-input::placeholder {
    color: #adb5bd;
}

.sparklite-message-input:focus {
    border-color: #4e8cff;
}

.sparklite-send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #4e8cff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: all 0.2s;
}

.sparklite-send-button:not(:disabled) {
    opacity: 1;
}

.sparklite-send-button:not(:disabled):hover {
    background-color: #3a7bff;
}

/* 人工客服按钮样式 - 修改后的版本 */
.sparklite-transfer-button {
    display: flex !important; /* 确保始终显示 */
    align-items: center;
    justify-content: center;
    width: calc(100% - 20px);
    margin: 0 auto 10px;
    padding: 10px 15px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.sparklite-transfer-button:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.4);
}

.sparklite-transfer-button:active {
    transform: translateY(0);
}

.sparklite-transfer-button::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* 人工客服回复中的邮箱链接样式 */
.sparklite-agent-response a[href^="mailto:"] {
    color: #FF6B6B; /* 使用与人工客服按钮相同的红色 */
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed #FF6B6B;
    transition: all 0.2s ease;
}

.sparklite-agent-response a[href^="mailto:"]:hover {
    color: #E74C3C; /* 悬停时加深红色 */
    border-bottom-color: #E74C3C;
}

/* 客服响应样式 */
.sparklite-agent-response {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

.sparklite-agent-response h4 {
    color: #6e2def;
    margin-top: 0;
}

.sparklite-agent-image {
    margin-top: 10px;
}

.sparklite-agent-image img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #ff6b6b;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .sparklite-chat-wrapper {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    #sparklite-chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    #sparklite-chat-toggle {
        bottom: 25%;
        right: 10px;
        width: 50px;
        height: 50px;
    }

    .sparklite-transfer-button {
        padding: 12px 15px;
        font-size: 15px;
        margin-bottom: 15px;
    }
}
/* 搜索结果显示样式 */
.sparklite-search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sparklite-search-results li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.sparklite-search-results li:last-child {
    border-bottom: none;
}

.sparklite-search-results a {
    color: #4e8cff;
    text-decoration: none;
}

.sparklite-search-results a:hover {
    text-decoration: underline;
}

.sparklite-search-results small {
    display: block;
    color: #6c757d;
    font-size: 12px;
    margin-top: 4px;
}

/* 游客专用样式 */
.guest-suggestion {
    margin-top: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.guest-suggestion a, 
.guest-suggestion button {
    display: inline-block;
    padding: 3px 8px;
    margin: 0 5px;
    background: #2271b1;
    color: white;
    border-radius: 3px;
    text-decoration: none;
}

.guest-suggestion span {
    color: #666;
    font-size: 0.9em;
}

/* 错误状态样式 */
.sparklite-error-box {
    background: #fff8f8;
    border-left: 3px solid #dc3232;
    padding: 10px;
    margin: 5px 0;
}

.sparklite-transfer-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sparklite-debug-btn {
    background: none;
    border: none;
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9em;
}

/* AI头像点击效果 */
.sparklite-transfer-trigger {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sparklite-transfer-trigger:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.sparklite-transfer-trigger::after {
    
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sparklite-transfer-trigger:hover::after {
    opacity: 1;
}