/* WP聊天工具样式 */

.wp-chat-tool-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 300px;
    max-width: 90%;
    height: 400px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wp-chat-tool-container.active {
    transform: translateY(0);
    opacity: 1;
}

.wp-chat-tool-header {
    padding: 15px;
    background-color: #0073aa;
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-chat-tool-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wp-chat-tool-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.wp-chat-tool-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.wp-chat-tool-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* 消息容器 - 包含头像和消息气泡 */
.wp-chat-tool-message-wrapper {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

/* 用户消息容器 - 头像在右，气泡在右侧 */
.wp-chat-tool-message-wrapper.user {
    justify-content: flex-end;
    align-items: flex-start;
}

/* 管理员消息容器 - 头像在左，气泡在左侧 */
.wp-chat-tool-message-wrapper.admin {
    justify-content: flex-start;
}

/* 头像样式 - 始终在气泡外部 */
.wp-chat-tool-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* 管理员头像位置调整 */
.wp-chat-tool-message-wrapper.admin .wp-chat-tool-message-avatar {
    margin-right: 8px;
    margin-left: 0;
}

/* 用户头像位置调整 */
.wp-chat-tool-message-wrapper.user .wp-chat-tool-message-avatar {
    margin-right: 0;
    margin-left: 8px;
}

/* 消息气泡样式 */
.wp-chat-tool-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 用户消息气泡 - 显示在右侧 */
.wp-chat-tool-message-wrapper.user .wp-chat-tool-message {
    background-color: #007bff;
    border-bottom-right-radius: 4px;
    margin-right: 0;
    margin-left: auto;
}

/* 管理员消息气泡 - 显示在左侧 */
.wp-chat-tool-message-wrapper.admin .wp-chat-tool-message {
    background-color: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 4px;
    margin-left: 0;
    margin-right: auto;
}

/* 隐藏发送者标签，只显示头像 */
.wp-chat-tool-message .sender-label {
    display: none;
}

.wp-chat-tool-message .time {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.wp-chat-tool-input {
    padding: 15px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.wp-chat-tool-input input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
}

.wp-chat-tool-input input:focus {
    outline: none;
    border-color: #0073aa;
}



#wp-chat-tool-send {
    padding: 10px 20px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

#wp-chat-tool-send:hover {
    background-color: #005a87;
}

.wp-chat-tool-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #0073aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.wp-chat-tool-toggle:hover {
    background-color: #005a87;
    transform: scale(1.05);
}

.wp-chat-tool-icon {
    font-size: 24px;
}

/* 对话框打开时自动隐藏气泡图标，避免遮挡发送按钮 */
.wp-chat-tool-toggle.hidden { opacity: 0; pointer-events: none; transform: scale(0.95); }
.wp-chat-tool-container.active + #wp-chat-tool-toggle { opacity: 0; pointer-events: none; transform: scale(0.95); }

/* 复制按钮样式 */
.wp-chat-tool-copy-btn {
    padding: 6px 10px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.wp-chat-tool-copy-btn:active { transform: scale(0.98); }
.wp-chat-tool-copy-btn:hover { background-color: #005a87; }

/* Toast 提示 */
.wp-chat-tool-toast {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.wp-chat-tool-toast.show { opacity: 1; }

/* 滚动条样式 */
.wp-chat-tool-messages::-webkit-scrollbar {
    width: 6px;
}

.wp-chat-tool-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wp-chat-tool-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wp-chat-tool-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .wp-chat-tool-container {
        width: 100%;
        height: 70vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }
    /* 移动端确保图标不与输入区重叠（即使未打开） */
    .wp-chat-tool-toggle { bottom: 24px; right: 16px; }
}
