/**
 * 🍋 AI悬浮球聊天组件样式 - 柠檬娘专属
 * 设计风格：深色主题、贴合网站风格、黄绿渐变点缀
 * 版本：2.0.0
 * 更新日期：2026-04-28
 */

/* ================= 悬浮球样式 ================= */
.lemon-ai-floating-ball {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700 0%, #32CD32 100%);
    box-shadow: 0 4px 12px -2px rgba(255, 215, 0, 0.4);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.lemon-ai-floating-ball:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
}

.lemon-ai-floating-ball:active {
    transform: translateY(-1px) scale(1.05);
}

/* 悬浮球图标 */
.floating-ball-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lemon-emoji {
    font-size: 24px;
    animation: bounce 2s ease-in-out infinite;
    display: block;
}

/* 悬浮球文字 */
.floating-ball-text {
    display: none; /* 隐藏文字，保持紧凑 */
}

/* 悬浮球徽章 */
.floating-ball-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

/* ================= 聊天窗口样式 ================= */
.lemon-ai-chat-window {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 400px;
    height: 650px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid #333;
}

/* 窗口头部 */
.chat-window-header {
    background: linear-gradient(135deg, #FFD700 0%, #32CD32 100%);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon {
    font-size: 28px;
    animation: bounce 2s ease-in-out infinite;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.header-status {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.7);
    background: rgba(255, 255, 255, 0.3);
    padding: 3px 10px;
    border-radius: 12px;
}

.header-right {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: #000;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.header-btn:hover {
    background: rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

/* 窗口主体 */
.chat-window-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #121212;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 欢迎消息 */
.welcome-message {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(50, 205, 50, 0.1));
    border-radius: 8px;
    border: 1px solid #333;
    margin-bottom: 10px;
}

.welcome-avatar {
    font-size: 40px;
    flex-shrink: 0;
    animation: bounce 2s ease-in-out infinite;
}

.welcome-content {
    flex: 1;
}

.welcome-title {
    font-size: 15px;
    font-weight: 700;
    color: #FFD700;
    margin: 0 0 8px 0;
}

.welcome-text {
    font-size: 13px;
    color: #e0e0e0;
    line-height: 1.6;
    margin: 0;
}

/* 消息样式 */
.message {
    display: flex;
    animation: fadeInUp 0.3s ease;
    margin-bottom: 15px;
}

/* 用户消息：靠右对齐 */
.message-user {
    justify-content: flex-end;
}

.message-user-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    max-width: 75%;
}

/* AI消息：靠左对齐 */
.message-ai {
    justify-content: flex-start;
}

.message-ai-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    max-width: 85%; /* 从75%增加到85%，让AI气泡可以更靠右 */
}

.message-avatar {
    font-size: 32px;
    flex-shrink: 0;
    animation: bounce 2s ease-in-out infinite;
}

.message-bubble {
    max-width: 100%; /* 移除固定280px限制，使用100%自适应 */
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    overflow-wrap: break-word; /* 支持长单词换行 */
}

.user-bubble {
    background: linear-gradient(135deg, #FFD700 0%, #32CD32 100%);
    color: #000;
    border-bottom-right-radius: 4px;
}

.ai-bubble {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #333;
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.message-info {
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: #aaaaaa;
}

.message-role {
    font-weight: bold;
}

/* 输入指示器 */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    margin-top: 10px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #FFD700, #32CD32);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    font-size: 12px;
    color: #aaaaaa;
}

/* 窗口底部 */
.chat-window-footer {
    padding: 12px;
    background: #1e1e1e;
    border-top: 1px solid #333;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #121212;
    border-radius: 8px;
    padding: 4px 4px 4px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #FFD700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 6px 0;
    background: transparent;
    color: #e0e0e0;
}

.chat-input::placeholder {
    color: #666;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, #FFD700 0%, #32CD32 100%);
    color: #000;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.chat-send-btn:active {
    transform: scale(1.05);
}

.chat-input-tips {
    margin-top: 6px;
    text-align: center;
}

.tip-text {
    font-size: 10px;
    color: #aaaaaa;
}

/* ================= 动画效果 ================= */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ================= 响应式设计 ================= */
@media (max-width: 768px) {
    .lemon-ai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 10px;
        left: 10px;
        border-radius: 10px;
    }
    
    .lemon-ai-floating-ball {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
    }
    
    .lemon-emoji {
        font-size: 20px;
    }
    
    .message-bubble {
        max-width: 220px;
    }
}

/* ================= 滚动条美化 ================= */
.chat-window-body::-webkit-scrollbar {
    width: 5px;
}

.chat-window-body::-webkit-scrollbar-track {
    background: #121212;
    border-radius: 3px;
}

.chat-window-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #32CD32);
    border-radius: 3px;
}

.chat-window-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FFA500, #28a745);
}
