/* 右侧悬浮功能区 */
.right-floating-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.floating-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: -2px 2px 10px rgba(67, 97, 238, 0.3);
    position: relative;
    margin-left: auto;
}

.floating-btn:hover {
    background: linear-gradient(135deg, #3f37c9 0%, #4cc9f0 100%);
    transform: translateX(-5px);
    box-shadow: -5px 5px 15px rgba(67, 97, 238, 0.4);
}

.floating-btn i {
    font-size: 1.5rem;
}

.floating-btn span {
    font-size: 0.75rem;
    writing-mode: vertical-rl;
    letter-spacing: 2px;
}

/* 二维码弹窗 */
.qr-popup {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    display: flex;
    gap: 15px;
}

.qr-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

.qr-popup::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.qr-item {
    text-align: center;
}

.qr-item img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    margin-bottom: 8px;
}

.qr-item p {
    font-size: 0.9rem;
    color: #212529;
    font-weight: 600;
    margin: 0;
}

/* 在线客服对话框 */
.chat-panel {
    position: fixed;
    right: 80px;
    bottom: 100px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel.show {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.chat-message.bot {
    flex-direction: row;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.bot .chat-avatar {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
}

.chat-message.user .chat-avatar {
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
    color: white;
}

.chat-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.bot .chat-content {
    background: white;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.chat-message.user .chat-content {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.chat-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: linear-gradient(135deg, #3f37c9 0%, #4cc9f0 100%);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.4);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .right-floating-panel {
        right: 10px;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
    }
    
    .floating-btn span {
        display: none;
    }
    
    .qr-popup {
        right: 60px;
        padding: 15px;
    }
    
    .qr-item img {
        width: 120px;
        height: 120px;
    }
    
    .chat-panel {
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        bottom: 80px;
        height: 60vh;
    }
    
    .back-to-top {
        right: 15px;
        bottom: 20px;
        width: 45px;
        height: 45px;
    }
}
