/* 智能客服机器人样式 */
.ai-chatbot {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chatbot-toggle {
    width: auto;
    height: auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8534 100%);
    border-radius: 25px;
    display: flex;
    align-items: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 107, 0, 0.4), 0 0 0 rgba(255, 107, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 5px 20px rgba(255, 107, 0, 0.4), 0 0 0 0 rgba(255, 107, 0, 0.1);
    }
    70% {
        box-shadow: 0 5px 20px rgba(255, 107, 0, 0.4), 0 0 0 15px rgba(255, 107, 0, 0);
    }
    100% {
        box-shadow: 0 5px 20px rgba(255, 107, 0, 0.4), 0 0 0 0 rgba(255, 107, 0, 0);
    }
}

.chatbot-toggle:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(255, 107, 0, 0.5);
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 50%);
    border-radius: 50%;
}

.toggle-avatar {
    width: auto;
    height: auto;
    margin-right: 8px;
}

.toggle-avatar i {
    font-size: 1.2rem;
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    margin-right: 8px;
    white-space: nowrap;
}

.chatbot-status {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.chatbot-toggle:hover .chatbot-status {
    bottom: -18px;
    opacity: 1;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    margin-right: 5px;
    position: relative;
    display: inline-block;
}

.status-dot::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(76, 175, 80, 0.5);
    border-radius: 50%;
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    70% {
        transform: scale(2);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* 添加拖拽相关样式 */
.chatbot-container {
    position: fixed;
    right: 25px;
    bottom: 85px;
    width: 380px;
    height: 600px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    transform: scale(0.5);
    transform-origin: bottom right;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

/* 防止页面加载闪烁的样式 */
.chatbot-container.no-transition {
    transition: none !important;
}

.chatbot-container.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 当容器被拖动时，移除transition */
.chatbot-container.active[style*="left"] {
    transition: none;
    right: auto !important;
    bottom: auto !important;
}

/* 拖拽时的样式 */
.chatbot-container[style*="left"] {
    transition: none !important;
}

/* 优化标题栏样式 */
.chatbot-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8534 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    user-select: none;
}

/* 确保内容区域不会干扰拖拽 */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    z-index: 1;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

/* 优化全屏模式样式 */
.chatbot-container.expanded {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) scale(1) !important;
    width: 90%;
    max-width: 800px;
    height: 80%;
    max-height: 700px;
    z-index: 1050;
}

/* 确保覆盖层正确显示 */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.chatbot-container.expanded + .chatbot-overlay,
.chatbot-container.expanded ~ .chatbot-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 确保从全屏状态返回时的平滑过渡 */
.chatbot-container.active:not(.expanded) {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-title {
    display: flex;
    align-items: center;
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-avatar i {
    font-size: 1.5rem;
    color: white;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}

.chatbot-info {
    display: flex;
    flex-direction: column;
}

/* 智能客服标题和状态 */
.chatbot-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chatbot-status-text {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-status-text .status-dot {
    width: 5px;
    height: 5px;
    margin-right: 4px;
}

.chatbot-actions {
    display: flex;
    align-items: center;
}

/* 标题栏按钮样式 */
.chatbot-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-actions button {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    padding: 0;
    margin: 0;
}

.chatbot-actions button:hover {
    opacity: 1;
}

/* 按钮图标 */
.chatbot-actions button i {
    font-size: 14px;
}

/* 刷新按钮特殊样式 */
.chatbot-actions .btn-refresh {
    position: relative;
}

.chatbot-actions .btn-refresh:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.chatbot-actions .btn-refresh.spinning i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 15px;
    background: white;
    padding: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.welcome-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.05) 0%, rgba(255, 133, 52, 0.05) 100%);
    border-radius: 50%;
}

.welcome-logo {
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
}

.welcome-message h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8534 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-message p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.bot-message {
    align-self: flex-start;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    margin: 0 10px;
}

/* 聊天消息头像 */
.message-avatar i {
    font-size: 18px;
}

.user-message .message-avatar {
    background: #FF6B00;
    color: white;
}

.message-content {
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 12px 16px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.user-message .message-bubble {
    background: #FF6B00;
    color: white;
}

.message-bubble p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    align-self: flex-end;
}

.user-message .message-time {
    align-self: flex-start;
}

.chat-suggestions {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: 10px;
}

/* 建议问题区域 */
.suggestion-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.suggestion-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.suggestion-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: #FF6B00;
    color: white;
}

.suggestion-item i {
    margin-right: 6px;
    font-size: 14px;
}

.chatbot-typing {
    display: none;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 10px;
}

.chatbot-typing.active {
    display: flex;
}

.typing-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #FF6B00;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.chatbot-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 8px 15px;
    margin-bottom: 10px;
}

.input-emoji-btn {
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
}

.input-emoji-btn:hover {
    color: #FF6B00;
}

/* 输入框按钮 */
.input-emoji-btn i {
    font-size: 16px;
}

.chatbot-footer input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    font-size: 0.95rem;
    color: #333;
}

.chatbot-footer input:focus {
    outline: none;
}

.btn-attach,
.btn-send {
    background: none;
    border: none;
    color: #999;
    padding: 5px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-attach:hover,
.btn-send:hover {
    color: #FF6B00;
}

.btn-send {
    margin-left: 5px;
}

.chatbot-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

/* 输入区域 */
.chatbot-input {
    font-size: 14px;
}

.powered-by {
    font-size: 11px;
    color: #999;
}

.transfer-human {
    font-size: 13px;
    color: #FF6B00;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

.transfer-human:hover {
    opacity: 0.8;
}

.transfer-human i {
    font-size: 14px;
    margin-right: 4px;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chatbot-container.active {
        transform: scale(1);
    }

    .suggestion-items {
        grid-template-columns: 1fr;
    }
} 