/**
 * 小木 AI 导购员组件样式 - 飘动泡泡版
 */

/* 主容器 - 小木头像固定右下角 */
#xiaomu-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 小木头像 */
.xiaomu-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 167, 38, 0.9), rgba(255, 112, 67, 0.9));
    box-shadow:
        0 4px 15px rgba(255, 167, 38, 0.3),
        0 0 0 3px rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    backdrop-filter: blur(10px);
}

.xiaomu-avatar:hover {
    transform: scale(1.15) rotate(5deg);
}

.xiaomu-avatar::before {
    content: '🌳';
    font-size: 26px;
    animation: xiaomu-wobble 3s ease-in-out infinite;
}

.xiaomu-avatar img {
    display: none;
}

.xiaomu-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

/* ====== 飘浮泡泡容器 ====== */
#xiaomu-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99998;
    overflow: hidden;
}

/* ====== 单个泡泡 - 像小朋友吹的透明气泡 ====== */
.xiaomu-bubble {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;

    /* 透明彩虹泡泡效果 */
    background: radial-gradient(ellipse at 30% 30%,
            rgba(255, 255, 255, 0.8) 0%,
            rgba(255, 255, 255, 0.3) 20%,
            rgba(255, 200, 255, 0.15) 40%,
            rgba(200, 220, 255, 0.1) 60%,
            rgba(255, 255, 255, 0.05) 80%,
            transparent 100%);

    border-radius: 50%;

    /* 泡泡光泽 */
    box-shadow:
        inset -8px -8px 20px rgba(255, 255, 255, 0.5),
        inset 4px 4px 15px rgba(255, 200, 255, 0.2),
        0 0 20px rgba(255, 255, 255, 0.3);

    /* 彩虹边框 */
    border: 1px solid rgba(255, 255, 255, 0.4);

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;

    opacity: 0;
    transform: scale(0);
    animation: bubble-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 泡泡内的文字 */
.xiaomu-bubble-text {
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    max-width: 120px;
    word-wrap: break-word;
}

/* 泡泡悬停效果 */
.xiaomu-bubble:hover {
    transform: scale(1.05);
    box-shadow:
        inset -8px -8px 25px rgba(255, 255, 255, 0.6),
        inset 4px 4px 20px rgba(255, 200, 255, 0.3),
        0 0 30px rgba(255, 200, 255, 0.4);
}

/* ====== 聊天框 - 毛玻璃 ====== */
.xiaomu-chat-box {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    max-height: 350px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.92),
            rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    overflow: hidden;
}

.xiaomu-chat-box.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.xiaomu-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.xiaomu-chat-header span::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    margin-left: 6px;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.xiaomu-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.xiaomu-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #6b7280;
}

.xiaomu-chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
}

.xiaomu-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.5;
    animation: xiaomu-msg-in 0.3s ease;
}

.xiaomu-msg-xiaomu {
    align-self: flex-start;
    background: rgba(255, 167, 38, 0.12);
    color: #374151;
    border-bottom-left-radius: 4px;
}

.xiaomu-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-bottom-right-radius: 4px;
}

.xiaomu-login-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(168, 85, 247, 0.05);
}

.xiaomu-login-prompt span {
    color: #9ca3af;
    font-size: 10px;
}

.xiaomu-login-btn {
    padding: 4px 10px;
    background: transparent;
    color: #a855f7;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 10px;
    border: 1px solid rgba(168, 85, 247, 0.25);
    transition: all 0.2s;
}

.xiaomu-login-btn:hover {
    background: rgba(168, 85, 247, 0.1);
}

.xiaomu-chat-input-area {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(249, 250, 251, 0.5);
}

.xiaomu-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    font-size: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

.xiaomu-input:focus {
    border-color: rgba(255, 167, 38, 0.4);
}

.xiaomu-send {
    padding: 8px 14px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.xiaomu-send:hover {
    transform: scale(1.05);
}

/* ====== 动画 ====== */
@keyframes xiaomu-wobble {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

@keyframes bubble-appear {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bubble-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-15px) rotate(2deg);
    }

    50% {
        transform: translateY(-5px) rotate(-1deg);
    }

    75% {
        transform: translateY(-20px) rotate(1deg);
    }
}

@keyframes bubble-pop {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.5;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes xiaomu-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端 */
@media (max-width: 480px) {
    #xiaomu-container {
        bottom: 16px;
        right: 16px;
    }

    .xiaomu-avatar {
        width: 46px;
        height: 46px;
    }

    .xiaomu-avatar::before {
        font-size: 22px;
    }

    .xiaomu-chat-box {
        width: 260px;
        max-height: 320px;
    }

    .xiaomu-bubble {
        max-width: 140px !important;
        max-height: 140px !important;
    }

    .xiaomu-bubble-text {
        font-size: 11px;
        max-width: 90px;
    }
}