
/* 按钮动画相关样式 */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
    50% { transform: scale(1.05); box-shadow: 0 6px 16px rgba(0,0,0,0.18); }
    100% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to { transform: scale(2.5); opacity: 0; }
}

/* 新消息提醒动画 */
@keyframes newMessage {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(0deg); }
    75% { transform: scale(1.05) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    background-color: #ff4b4b;
    border-radius: 50%;
    border: 2px solid white;
    animation: blink 1s infinite;
    z-index: 10001;
}

/* 移动端适配样式 */
@media screen and (max-width: 768px) {
    #chat-widget-container {
        width: 90% !important;
        height: 80% !important;
        right: 5% !important;
        bottom: 80px !important;
        max-height: 500px;
    }
    
    #chat-widget-button {
        width: 50px !important;
        height: 50px !important;
        right: 20px !important;
        bottom: 20px !important;
        font-size: 24px !important;
    }
    
    .notification-dot {
        width: 15px;
        height: 15px;
    }
}

/* 小屏幕手机适配 */
@media screen and (max-width: 480px) {
    #chat-widget-container {
        width: 100% !important;
        height: 100% !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
    }
    
    #chat-widget-button {
        width: 45px !important;
        height: 45px !important;
        right: 15px !important;
        bottom: 125px !important;
        font-size: 22px !important;
    }
}

/* 欢迎语样式 */
/* 文字动画效果 */
@keyframes textCoolAnimation {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.welcome-message span {
    display: inline-block;
    opacity: 0;
    transform: scale(0.8);
    animation: textCoolAnimation 0.5s forwards;
}

/* 打字机光标动画 */
@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.welcome-message .cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background-color: black;
    margin-left: 3px;
    vertical-align: middle;
    animation: blinkCursor 1s infinite;
}

/* 修改文字动画为简单显示 */
.welcome-message span {
    opacity: 0;
    display: inline-block;
}

.welcome-message span.typed {
    opacity: 1;
    transition: opacity 0.1s;
}
.welcome-message {
    position: fixed;
    bottom: 30px; /* 与浮动按钮底部对齐 */
    right: 100px; /* 按钮右侧位置 = 按钮right(30px) + 按钮宽度(60px) + 间距(10px) */
    padding: 12px 24px;
    background: white; /* 白色背景 */
    color: black; /* 黑色文字 */
    border-radius: 20px;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    /* 添加文字动画延迟计算 */
    animation-delay: calc(var(--char-index) * 0.1s);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .welcome-message {
        right: 85px; /* 移动端减小间距 */
        padding: 10px 18px;
        font-size: 14px;
    }
    
    #chat-widget-button::before {
        border-width: 6px 10px 6px 0; /* 缩小箭头 */
        left: -10px;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .welcome-message {
        padding: 8px 16px;
        font-size: 12px;
        bottom: 125px; /* 与浮动按钮bottom值保持一致 */
        right: 85px; /* 按钮宽度(60px) + 间距(25px) */
        left: auto; /* 移除水平居中 */
        transform: none; /* 移除居中变换 */
        width: auto; /* 恢复自适应宽度 */
        max-width: calc(100% - 120px); /* 限制最大宽度避免换行 */
        text-align: right; /* 文本右对齐指向按钮 */
        z-index: 9999;
    }
}

/* 浮动按钮样式 */
#chat-widget-button {
    position: relative; /* 添加相对定位，使伪元素可绝对定位 */
}

/* 为浮动聊天按钮添加指向欢迎语的箭头 */
#chat-widget-button::after {
  content: '';
  position: absolute;
  left: -16px; /* 向左移动以适应更长的箭头 */
  top: 50%;
  transform: translateY(-50%);
  border-width: 10px 16px 10px 0; /* 增加箭头尺寸（原为8px 10px） */
  border-style: solid;
  border-color: transparent #4e8cff transparent transparent;
  z-index: 10001;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* 添加轻微阴影增强立体感 */
}

/* 响应式调整 - 移动端适配 */
@media (max-width: 768px) {
  #chat-widget-button::after {
    left: -12px;
    border-width: 8px 12px 8px 0; /* 移动端同比放大（原为6px 8px） */
  }
}

.welcome-container {
    display: flex;
    align-items: center;
}

.welcome-play-btn:hover {
    background: #3a75e0;
}

/* 添加箭头可见性增强样式 */
#chat-widget-button {
  position: relative; /* 确保箭头相对按钮定位 */
  overflow: visible !important; /* 允许箭头超出按钮区域显示 */
}

/* 调试用：临时添加边框以便观察按钮范围 */
/* #chat-widget-button { border: 1px solid red; } */
/* 移动端聊天窗口适配 */
@media (max-width: 768px) {
  #chat-widget-container {
    width: 100% !important;
    height: 100% !important;
    bottom: 170px !important;
    right: 0 !important;
    border-radius: 0 !important;
  }
}