/* 悬浮球容器 */
.floating-ball-container {
    position: fixed;
    top: auto;
    bottom: 130px;
    right: 30px;
    width: 70px;
    height: 70px;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-ball-container:hover {
    transform: scale(1.1);
}

/* 深夜模式 */
.floating-ball-container.night-mode {
    opacity: 0.85;
    filter: brightness(0.7);
}

.floating-ball-container.night-mode .floating-ball-icon {
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3), 0 0 20px rgba(255, 255, 255, 0.1);
}

/* 悬浮球主体 */
.floating-ball-inner {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-ball-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: breathe 3s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(139, 92, 246, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 40px rgba(139, 92, 246, 0.6);
    }
}

/* 角色头像 */
.floating-ball-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* 波纹效果 */
.ai-wave-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    animation: wave 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes wave {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* 心情状态指示器 */
.floating-ball-mood {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 3;
    transition: all 0.3s ease;
}

/* 想念模式 - 显示想念表情 */
.floating-ball-mood.miss-mode {
    animation: pulse 2s ease-in-out infinite;
    background: rgba(255, 182, 193, 0.95);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* 深夜模式 - 显示星星 */
.floating-ball-container.night-mode .floating-ball-mood {
    display: flex;
    background: rgba(30, 30, 50, 0.9);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* 对话气泡 */
.floating-ball-chat-bubble {
    position: absolute;
    top: auto;
    bottom: 130px;
    right: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.98) 0%, rgba(139, 92, 246, 0.98) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 18px 22px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.3);
    min-width: 240px;
    max-width: 300px;
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10000;
}

.floating-ball-chat-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.floating-ball-chat-bubble::after {
    content: '';
    position: absolute;
    top: auto;
    bottom: -8px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(139, 92, 246, 0.98);
}

/* 对话内容 */
.chat-bubble-content {
    text-align: left;
}

.chat-bubble-text {
    font-size: 15px;
    color: white;
    font-weight: 600;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.5;
}

.chat-bubble-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    gap: 8px;
}

.chat-bubble-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-bubble-btn-primary {
    background: white;
    color: #3b82f6;
}

.chat-bubble-btn-primary:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.chat-bubble-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-bubble-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 深夜模式星星动画 */
.floating-ball-container.night-mode .floating-ball-icon::before {
    content: '✨';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    animation: twinkle 2s ease-in-out infinite;
    z-index: 4;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(-50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .floating-ball-container {
        top: auto;
        bottom: 120px;
        right: 20px;
        width: 60px;
        height: 60px;
    }

    .floating-ball-icon {
        width: 60px;
        height: 60px;
    }

    .floating-ball-avatar {
        width: 45px;
        height: 45px;
    }

    .floating-ball-mood {
        width: 24px;
        height: 24px;
        font-size: 14px;
        top: -4px;
        right: -4px;
    }

    .floating-ball-chat-bubble {
        top: auto;
        bottom: 120px;
        right: -10px;
        min-width: 200px;
        max-width: 260px;
        padding: 14px 18px;
    }

    .chat-bubble-text {
        font-size: 14px;
    }

    .chat-bubble-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 隐藏状态 */
.floating-ball-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}
