/* 容器过渡效果 */
#chat-container, #config-container {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
}

#chat-container.active, #config-container.active {
    opacity: 1;
    transform: translateY(0);
}

/* 下拉提示动画 */
.dropdown-hint {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.dropdown-hint.active {
    opacity: 1;
    transform: translateY(0);
}

/* 按钮加载动画 */
.script-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.script-btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: button-loading-spinner 0.75s linear infinite;
}

@keyframes button-loading-spinner {
    from { transform: rotate(0turn); }
    to { transform: rotate(1turn); }
}

/* 清除消息动画 */
@keyframes message-fade-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.message-fade-out {
    animation: message-fade-out 0.3s forwards;
}

/* 粒子消散动画效果 */
@keyframes particle-fade {
    0% { 
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: var(--particle-color, #9683EC);
    animation: particle-fade 0.6s ease-out forwards;
}

/* Telegram风格粒子效果 */
.telegram-particle {
    position: absolute;
    backface-visibility: hidden;
    will-change: transform, opacity;
    width: 2px;
    height: 2px;
    border-radius: 50%;
}

/* 消息消失的容器淡出效果 */
@keyframes container-fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

.message.deleting {
    animation: container-fade-out 0.5s ease-out forwards;
    position: relative;
    overflow: visible !important;
    pointer-events: none;
}

/* 消息删除过程中的动画 */
.message.deleting > *:not(.particle-container):not(.telegram-particle) {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

/* 消息删除过程中的动画 - 添加模糊和透明效果 */
.message.deleting > *:not(.particle-container):not(.telegram-particle) {
    opacity: 0;
    filter: blur(3px);
    transform: scale(0.98);
    transition: opacity 0.3s ease-out, filter 0.3s ease-out, transform 0.3s ease-out;
}

/* 自定义确认对话框样式 */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.confirm-dialog p {
    margin: 0 0 20px 0;
    color: #334155;
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.confirm-dialog button {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
}

.confirm-dialog-cancel {
    background: #e2e8f0;
    color: #475569;
}

.confirm-dialog-confirm {
    background: #ef4444;
    color: white;
}

/* 细化粒子动画 */
@keyframes particle-float {
    0% { 
        opacity: 1;
        transform: translate(0, 0) rotate(0) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rotation, 0)) scale(0);
    }
}

/* Telegram风格粒子动画 */
@keyframes particle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: var(--opacity, 1);
    }
    40% {
        opacity: var(--opacity, 0.8);
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 闪光粒子的动画 */
@keyframes sparkle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    30% {
        opacity: 0.8;
        transform: translate(calc(var(--tx) * 0.3), calc(var(--ty) * 0.3)) scale(1.2);
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 消息删除样式 */
.message.deleting {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: scale(0.95);
    position: relative;
    overflow: visible !important;
    pointer-events: none;
}

/* 消息视觉克隆样式 */
.message-visual-clone {
    position: absolute;
    pointer-events: none;
    z-index: 9998;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.message-visual-clone.deleting {
    opacity: 0;
    filter: blur(3px);
    transform: scale(0.95);
}

/* 粒子容器样式 */
.particle-container {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    will-change: transform;
    transform: translateZ(0);
}

/* 粒子样式 */
.telegram-particle {
    position: absolute;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
}

.telegram-sparkle {
    position: absolute;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    filter: brightness(1.5);
}

/* 消息类型动画 */
@keyframes user-message-appear {
    from { opacity: 0; transform: translateY(20px) translateX(20px); }
    to { opacity: 1; transform: translateY(0) translateX(0); }
}

@keyframes ai-message-appear {
    from { opacity: 0; transform: translateY(20px) translateX(-20px); }
    to { opacity: 1; transform: translateY(0) translateX(0); }
}

.user-message {
    animation: user-message-appear 0.3s ease forwards;
}

.ai-message {
    animation: ai-message-appear 0.3s ease forwards;
}

/* 输入框焦点效果 */
@keyframes input-focus-pulse {
    0% { box-shadow: 0 0 0 0 rgba(150, 131, 236, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(150, 131, 236, 0); }
    100% { box-shadow: 0 0 0 0 rgba(150, 131, 236, 0); }
}

#user-input:focus {
    animation: input-focus-pulse 1.5s ease-out infinite;
}

/* 输入框动画 */
@keyframes input-container-appear {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#input-container {
    animation: input-container-appear 0.5s ease-out forwards;
}

/* 输入框模糊效果动画 */
@keyframes blur-in {
    from { backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
    to { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}

/* 输入框获得焦点时的高亮模糊效果 */
@keyframes focus-blur-pulse {
    0% { 
        backdrop-filter: blur(10px) brightness(1);
        -webkit-backdrop-filter: blur(10px) brightness(1);
    }
    50% { 
        backdrop-filter: blur(12px) brightness(1.02);
        -webkit-backdrop-filter: blur(12px) brightness(1.02);
    }
    100% { 
        backdrop-filter: blur(10px) brightness(1);
        -webkit-backdrop-filter: blur(10px) brightness(1);
    }
}

/* 添加输入容器的动画效果 */
#input-container {
    animation: blur-in 0.3s forwards;
}

#input-container:focus-within {
    animation: focus-blur-pulse 2s infinite;
}

/* 打字指示器动画 */
@keyframes typing-dots {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.typing-indicator span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.7);
    margin: 0 2px;
}

.typing-indicator span:nth-child(1) {
    animation: typing-dots 0.8s infinite 0s;
}
.typing-indicator span:nth-child(2) {
    animation: typing-dots 0.8s infinite 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation: typing-dots 0.8s infinite 0.4s;
}

/* 打字指示器动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 5px 0;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.8);
    margin: 0 3px;
    animation: typing-dot 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% { 
        transform: translateY(0); 
    }
    30% { 
        transform: translateY(-4px); 
    }
}

/* 删除按钮样式改进 - 同时适用于用户和AI消息 */
.message .message-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: all 0.2s;
    transform: scale(0.8);
    cursor: pointer;
    z-index: 5;
}

.message:hover .message-delete-btn {
    opacity: 1;
    transform: scale(1);
}

.message-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

/* 优化粒子爆炸效果，使其更平滑 */
.telegram-particle {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* 调整批量删除消息时的动画 */
@keyframes batch-delete-fade {
    0% { opacity: 1; transform: scale(1); filter: blur(0px); }
    100% { opacity: 0; transform: scale(0.8); filter: blur(3px); }
}

.batch-deleting {
    pointer-events: none !important;
}

/* 消息删除粒子效果 */
@keyframes particle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: var(--opacity, 1);
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

@keyframes sparkle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    30% {
        opacity: 0.8;
        transform: translate(calc(var(--tx) * 0.3), calc(var(--ty) * 0.3)) scale(1.2);
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 消息删除淡出效果 */
.deleting {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

/* 确认对话框样式 */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.confirm-dialog > div {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    width: 320px;
    text-align: center;
}

.confirm-dialog h3 {
    margin-top: 0;
    color: #333;
}

.confirm-dialog p {
    margin-bottom: 20px;
    color: #666;
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.confirm-dialog button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    min-width: 80px;
}

.confirm-dialog-cancel {
    background-color: #e2e8f0;
    color: #475569;
}

.confirm-dialog-confirm {
    background-color: #ef4444;
    color: white;
}

/* Live2D动画和过渡效果 */
.waifu-fading {
    filter: blur(8px);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 1.2s ease, filter 1.2s ease, transform 1.2s ease;
}

/* 确保工具栏正常淡出 */
#waifu.waifu-fading #waifu-tool {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* 确保消息气泡正常淡出 */
#waifu.waifu-fading #waifu-tips {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* waifu 粒子效果 */
@keyframes waifu-particle-fly {
    0% { 
        transform: translate(0, 0) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: translate(var(--tx), var(--ty)) scale(0); 
        opacity: 0; 
    }
}

.waifu-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
}

/* 添加卡片波纹效果的CSS更新 */
@keyframes ripple-expand {
  0% {
    transform: scale(0);
    opacity: 0.7;
  }
  100% {
    transform: scale(var(--scale-multiplier, 20));
    opacity: 0;
  }
}

.model-card-ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  pointer-events: none;
  transform: scale(0);
  animation: ripple-expand 0.8s ease-out forwards;
  z-index: 0;
}

.model-card-ripple.emphasize {
  background: rgba(255,255,255,0.9);
  animation-duration: 0.5s;
}

/* 添加卡片选择时的动画 */
@keyframes select-glow {
  0% { box-shadow: 0 0 0 rgba(150, 131, 236, 0.5); }
  50% { box-shadow: 0 0 15px rgba(150, 131, 236, 0.8); }
  100% { box-shadow: 0 0 0 rgba(150, 131, 236, 0.5); }
}

.selecting {
  animation: select-glow 1.5s infinite;
}

/* 交互提示动画 */
@keyframes tip-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.card-tip {
  animation: tip-float 2s ease-in-out infinite;
}

/* 子卡片特殊效果 */
@keyframes pulse-border {
  0% { border-color: #e2e8f0; }
  50% { border-color: rgba(150, 131, 236, 0.7); }
  100% { border-color: #e2e8f0; }
}

.model-subcard.pulsing {
  animation: pulse-border 1.5s infinite;
}

/* 推送通知的动画 */
@keyframes notification-enter {
  0% { 
    opacity: 0;
    transform: translateX(30px);
  }
  100% { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes notification-exit {
  0% { 
    opacity: 1;
    transform: translateX(0);
  }
  100% { 
    opacity: 0;
    transform: translateX(30px);
  }
}

.push-notification.enter {
  animation: notification-enter 0.3s forwards;
}

.push-notification.exit {
  animation: notification-exit 0.3s forwards;
}

/* 模型图标旋转效果 */
@keyframes icon-rotate {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(10deg); }
  75% { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}

.model-card:hover .model-card-icon,
.model-subcard:hover .model-subcard-icon {
  animation: icon-rotate 0.8s ease;
}
