/* 🎬 Sapie 챗봇 애니메이션 효과 - chatbot-animations.css */

/* Sapie 아바타 글로우 효과 */
.message-avatar.sapie-avatar {
    animation: sapieGlow 3s ease-in-out infinite alternate;
}

@keyframes sapieGlow {
    0% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.05) saturate(1.1);
    }
    100% {
        filter: brightness(1.1) saturate(1.2);
        transform: scale(1.02);
    }
}

/* 고민 중 메시지 애니메이션 */
.thinking-message {
    animation: thinkingAppear 0.5s ease-out;
}

@keyframes thinkingAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 고민 중 아바타 애니메이션 */
.thinking-avatar {
    animation: thinkingPulse 1.5s ease-in-out infinite !important;
    border-color: rgba(255, 193, 7, 0.6) !important;
}

@keyframes thinkingPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1) saturate(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    25% {
        transform: scale(1.05);
        filter: brightness(1.1) saturate(1.1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.2) saturate(1.2);
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0.2);
    }
    75% {
        transform: scale(1.05);
        filter: brightness(1.1) saturate(1.1);
    }
}

/* 고민 중 메시지 내용 스타일 */
.thinking-content {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 50%, #e8ebff 100%) !important;
    border: 1px solid rgba(167,183,251, 0.25) !important;
    color: #333 !important;
    font-style: italic;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* 고민 중 텍스트 애니메이션 */
@keyframes thinkingDots {
    0%, 20% {
        opacity: 0.7;
        transform: scale(1);
    }
    10% {
        opacity: 1;
        transform: scale(1.02);
    }
    80%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    90% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* 고민 중 메시지 반짝이는 효과 */
.thinking-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: thinkingShimmer 2s ease-in-out infinite;
}

@keyframes thinkingShimmer {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

/* 챗봇 창 열기 애니메이션 */
#chatbot-window.opening {
    animation: chatbotSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chatbotSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 챗봇 창 닫기 애니메이션 */
#chatbot-window.closing {
    animation: chatbotSlideDown 0.3s ease-in;
}

@keyframes chatbotSlideDown {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
}

/* 메시지 전송 시 버튼 애니메이션 */
.sending #chat-send-btn {
    animation: buttonSending 0.6s ease-in-out;
}

@keyframes buttonSending {
    0% { transform: scale(1); }
    50% { transform: scale(0.95) rotate(5deg); }
    100% { transform: scale(1); }
}

/* 플로팅 버튼 클릭 시 특별 효과 */
.chatbot-icon-clicked {
    animation: iconClick 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconClick {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.3) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* 아바타 호버 효과 */
.message-avatar:hover {
    transform: scale(1.15) rotate(5deg);
    border-color: rgba(167,183,251, 0.6);
    box-shadow: 0 4px 12px rgba(167,183,251, 0.4);
    filter: brightness(1.1);
}

/* 메시지 등장 애니메이션 */
.chat-message {
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 고민 중 메시지 말풍선 꼬리 추가 */
.thinking-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 14px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 8px 0;
    border-color: transparent #fff9e6 transparent transparent; /* 고민 중 배경색과 맞춤 */
    filter: drop-shadow(-1px 0 1px rgba(255, 193, 7, 0.2)); /* 고민 중 테두리 색상과 맞춤 */
    z-index: 1;
}

/* 기존 고민 중 메시지 스타일에 position relative 추가 (꼬리가 제대로 위치하도록) */
.thinking-content {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 50%, #ffeaa7 100%) !important;
    border: 1px solid rgba(255, 193, 7, 0.3) !important;
    color: #856404 !important;
    font-style: italic;
    font-weight: 500;
    position: relative !important; /* 🆕 추가 */
    overflow: hidden;
}