/* WP Chat Service Widget Styles - 标准网页客服版本 */
.wp-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wp-chat-widget.wp-chat-bottom-right {
    bottom: 20px;
    right: 20px;
}

.wp-chat-widget.wp-chat-bottom-left {
    bottom: 20px;
    left: 20px;
}

.wp-chat-widget.wp-chat-top-right {
    top: 20px;
    right: 20px;
}

.wp-chat-widget.wp-chat-top-left {
    top: 20px;
    left: 20px;
}

/* 聊天按钮 */
.wp-chat-button {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    outline: none;
    position: relative;
}

.wp-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.4);
}

.wp-chat-button:active {
    transform: translateY(0);
}

.wp-chat-button:focus {
    outline: 2px solid rgba(0, 212, 255, 0.5);
    outline-offset: 2px;
}

/* 聊天窗口 */
.wp-chat-window {
    position: absolute;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom right;
    display: none;
}

.wp-chat-widget.wp-chat-bottom-right .wp-chat-window {
    bottom: 70px;
    right: 0;
    transform-origin: bottom right;
}

.wp-chat-widget.wp-chat-bottom-left .wp-chat-window {
    bottom: 70px;
    left: 0;
    transform-origin: bottom left;
}

.wp-chat-widget.wp-chat-top-right .wp-chat-window {
    top: 70px;
    right: 0;
    transform-origin: top right;
}

.wp-chat-widget.wp-chat-top-left .wp-chat-window {
    top: 70px;
    left: 0;
    transform-origin: top left;
}

.wp-chat-window.wp-chat-opening {
    animation: chatWindowOpen 0.3s ease-out;
}

.wp-chat-window.wp-chat-closing {
    animation: chatWindowClose 0.3s ease-in;
}

@keyframes chatWindowOpen {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes chatWindowClose {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
}

/* 聊天窗口头部 */
.wp-chat-header {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-chat-title {
    font-weight: 600;
    font-size: 16px;
}

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

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

/* 聊天消息区域 */
.wp-chat-messages {
    height: 350px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.wp-chat-message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
}

.wp-chat-message.user {
    justify-content: flex-end;
}

.wp-chat-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.wp-chat-message.user .wp-chat-message-content {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: white;
    border-bottom-right-radius: 6px;
}

.wp-chat-message.admin .wp-chat-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
}

.wp-chat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* 输入区域 */
.wp-chat-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 10px;
}

.wp-chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.wp-chat-input input:focus {
    border-color: #00d4ff;
}

.wp-chat-send-btn {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s;
}

.wp-chat-send-btn:hover {
    transform: scale(1.05);
}

.wp-chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 加载和状态 */
.wp-chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: #666;
    font-size: 14px;
}

.wp-chat-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wp-chat-status {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.wp-chat-form {
    padding: 20px;
    background: white;
}

.wp-chat-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.wp-chat-form input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    box-sizing: border-box;
}

.wp-chat-form input:focus {
    border-color: #00d4ff;
    outline: none;
}

.wp-chat-form button {
    width: 100%;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.wp-chat-form button:hover {
    transform: translateY(-1px);
}

/* 浮动窗口相关样式已删除，使用新窗口模式 */

/* 响应式设计 */
@media (max-width: 480px) {
    .wp-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        bottom: auto !important;
        right: auto !important;
        max-height: 600px;
    }

    .wp-chat-widget.wp-chat-bottom-right .wp-chat-window,
    .wp-chat-widget.wp-chat-bottom-left .wp-chat-window,
    .wp-chat-widget.wp-chat-top-right .wp-chat-window,
    .wp-chat-widget.wp-chat-top-left .wp-chat-window {
        top: 50% !important;
        left: 50% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
    }

    .wp-chat-button {
        padding: 12px 16px;
        font-size: 13px;
    }

    .wp-chat-messages {
        height: calc(100% - 140px);
    }
}

/* 离线状态 */
.wp-chat-offline {
    opacity: 0.6;
    pointer-events: none;
}

.wp-chat-offline .wp-chat-button {
    background: #6c757d;
    box-shadow: 0 4px 20px rgba(108, 117, 125, 0.3);
}

/* 新消息提示 */
.wp-chat-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 历史消息分隔线 */
.wp-chat-separator {
    text-align: center;
    padding: 10px;
    margin: 10px 0;
    font-size: 12px;
    color: #999;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

/* 确保不与其他插件冲突 */
.wp-chat-widget * {
    box-sizing: border-box;
}

/* 新消息提示 */
.wp-chat-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 确保不与其他插件冲突 */
.wp-chat-widget * {
    box-sizing: border-box;
}
