/* 在线客服插件样式 */
.online-chat-box {
    position: fixed;
    right: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.online-chat-box[data-position="left"] {
    right: auto;
    left: 20px;
}

.chat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: #2196F3;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    position: relative;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.chat-item:hover {
    transform: scale(1.1);
    color: #fff;
}

.chat-icon {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}

/* 图标图片样式 */
.chat-icon-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.3);
    display: block;
}

.chat-text {
    display: none;
    position: absolute;
    right: 60px;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 14px;
    animation: fadeIn 0.2s ease;
}

.online-chat-box[data-position="left"] .chat-text {
    right: auto;
    left: 60px;
}

.chat-item:hover .chat-text {
    display: block;
}

/* 二维码弹窗通用样式 */
.qrcode-popup {
    display: none;
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    text-align: center;
    z-index: 10;
    min-width: 160px;
    animation: fadeIn 0.2s ease;
}

.online-chat-box[data-position="left"] .qrcode-popup {
    right: auto;
    left: 60px;
}

.qrcode-popup img {
    width: 140px;
    height: 140px;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.qrcode-popup p {
    margin: 10px 0 0;
    font-size: 13px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
}

.qrcode-popup .qrcode-number {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.chat-item:hover .qrcode-popup {
    display: block;
}

/* QQ客服样式 */
.chat-qq {
    background: #12B7F5;
}

.chat-qq:hover {
    background: #0D9DD9;
}

/* 微信客服样式 */
.chat-wechat {
    background: #07C160;
}

.chat-wechat:hover {
    background: #06AD56;
}

/* 电话样式 */
.chat-phone {
    background: #FF6B00;
}

.chat-phone:hover {
    background: #E55A00;
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.online-chat-box[data-position="left"] .qrcode-popup {
    animation-name: fadeInLeft;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* AI客服按钮 - 桌面端隐藏，仅手机端显示 */
.chat-item-ai {
    display: none !important;
}

/* 手机端隐藏AI客服独立悬浮按钮（已集成到在线客服栏） */
@media (max-width: 768px) {
    body.ai-chatbot-integrated .chatbot-float-btn {
        display: none !important;
        opacity: 0 !important;
        transition: none !important;
    }

    /* AI客服对话框在手机端置于最上层 */
    body.ai-chatbot-integrated .chatbot-widget {
        z-index: 10002 !important;
    }
}

/* 返回顶部按钮样式 */
.back-to-top-btn {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    z-index: 8999;
    transition: all 0.3s ease;
    user-select: none;
}

/* 客服在左边时，返回顶部按钮位置 */
.back-to-top-btn.position-left {
    right: auto;
    left: 20px;
}

.back-to-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
    background: #218838;
}

.back-to-top-btn:active {
    transform: translateY(0);
}

/* 手机端二维码弹窗动画 */
@keyframes fadeInMobile {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 响应式适配 - 手机端横排底部悬浮 */
@media (max-width: 768px) {
    /* 手机端：横排固定在底部 - 磨砂玻璃效果，宽度自适应 */
    .online-chat-box {
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 15px !important;
        width: auto;
        flex-direction: row !important;
        justify-content: center;
        gap: 10px;
        padding: 8px 14px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        /* 磨砂玻璃效果 - 灰色调，任何背景都可见 */
        background: rgba(120, 120, 120, 0.1);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        /* 半透明边框 */
        border: 1px solid rgba(255, 255, 255, 0.3);
        /* 两边半圆效果 */
        border-radius: 50px;
    }

    /* 手机端按钮：圆形，只显示图标 - 更小 */
    .chat-item {
        width: 42px !important;
        height: 42px !important;
        min-height: 42px;
        border-radius: 50% !important;
        margin: 0;
        flex: none !important;
        max-width: none !important;
        flex-direction: column;
        padding: 0 !important;
    }

    /* AI客服按钮 - 手机端显示 */
    .chat-item-ai {
        display: flex !important;
    }

    .chat-item:hover {
        transform: none;
    }

    /* 手机端不显示文字 */
    .chat-text {
        display: none !important;
    }

    /* 图标样式 */
    .chat-icon {
        font-size: 13px;
    }

    .chat-icon-img {
        width: 100% !important;
        height: 100% !important;
        margin: 0;
    }

    /* 二维码弹窗 - 手机端改为底部弹出 */
    .qrcode-popup {
        display: none !important;
        position: fixed;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        bottom: 90px !important;
        transform: translateX(-50%) !important;
        background: #fff;
        padding: 15px;
        border-radius: 12px;
        box-shadow: 0 4px 30px rgba(0,0,0,0.3);
        z-index: 10001;
        min-width: 180px;
        animation: fadeInMobile 0.2s ease !important;
    }

    .chat-item.show-qrcode .qrcode-popup {
        display: block !important;
    }

    .qrcode-popup img {
        width: 150px;
        height: 150px;
    }

    .qrcode-popup p {
        font-size: 14px;
    }

    /* 返回顶部按钮 - 手机端与毛玻璃栏水平对齐 */
    .back-to-top-btn {
        bottom: calc(23px + env(safe-area-inset-bottom, 0px)) !important;
        right: 15px !important;
        width: 40px;
        height: 40px;
    }

    .back-to-top-btn.position-left {
        left: 15px !important;
        right: auto !important;
    }
}
