/* WordPress Telegram LiveChat Styles */

/* 图标字体 */
@font-face {
    font-family: 'wptl-icons';
    src: url('data:font/woff2;base64,d09GMgABAAAAAA...') format('woff2');
    font-weight: normal;
    font-style: normal;
}

.wptl-icon-chat:before { content: '\e900'; }
.wptl-icon-close:before { content: '\e901'; }
.wptl-icon-minus:before { content: '\e902'; }
.wptl-icon-send:before { content: '\e903'; }
.wptl-icon-support:before { content: '\e904'; }

/* 主容器 */
.wptl-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.wptl-chat-widget.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.wptl-chat-widget.minimized {
    height: 60px;
}

/* 头部 */
.wptl-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.wptl-chat-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.wptl-chat-title i {
    margin-right: 8px;
    font-size: 18px;
}

.wptl-chat-controls {
    display: flex;
    gap: 8px;
}

.wptl-minimize-btn,
.wptl-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.wptl-minimize-btn:hover,
.wptl-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 聊天主体 */
.wptl-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.wptl-chat-widget.minimized .wptl-chat-body {
    display: none;
}

/* 欢迎消息 */
.wptl-welcome-message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease;
}

.wptl-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

.wptl-message-content {
    flex: 1;
    max-width: calc(100% - 52px);
}

.wptl-message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.wptl-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    margin-left: 16px;
}

/* 消息容器 */
.wptl-messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 用户消息 */
.wptl-message.user-message {
    display: flex;
    justify-content: flex-end;
    animation: fadeInUp 0.5s ease;
}

.wptl-message.user-message .wptl-message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.wptl-message.user-message .wptl-message-time {
    text-align: right;
    margin-right: 16px;
}

/* 客服消息 */
.wptl-message.agent-message {
    display: flex;
    animation: fadeInUp 0.5s ease;
}

/* 底部输入区域 */
.wptl-chat-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
}

.wptl-chat-widget.minimized .wptl-chat-footer {
    display: none;
}

.wptl-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.wptl-upload-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #667eea;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wptl-upload-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.wptl-upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#wptl-message-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 100px;
    min-height: 40px;
}

#wptl-message-input:focus {
    border-color: #667eea;
}

.wptl-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.wptl-send-btn:hover {
    transform: scale(1.05);
}

.wptl-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 切换按钮 */
.wptl-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999998;
    font-weight: 600;
    font-size: 14px;
}

.wptl-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.wptl-chat-toggle.hidden {
    display: none;
}

/* 加载动画 */
.wptl-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
}

.wptl-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.wptl-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.wptl-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .wptl-chat-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 10px;
        right: 20px;
        left: 20px;
    }
    
    .wptl-chat-toggle {
        bottom: 10px;
        right: 20px;
        left: 20px;
        justify-content: center;
    }
}

/* 滚动条样式 */
.wptl-chat-body::-webkit-scrollbar {
    width: 6px;
}

.wptl-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wptl-chat-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wptl-chat-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 状态指示器 */
.wptl-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* 错误消息样式 */
.wptl-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    border-left: 4px solid #c62828;
}

/* 图片消息样式 */
.wptl-message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.wptl-message-image:hover {
    transform: scale(1.05);
}

.wptl-image-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000001;
    cursor: pointer;
}

.wptl-image-preview img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.wptl-upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    border-radius: 12px;
}

/* 成功消息样式 */
.wptl-success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    border-left: 4px solid #2e7d32;
} 