/* ===== CHATBOT STYLES ===== */

/* 챗봇 컨테이너 */
.chatbot-container {
    position: fixed;
    bottom: 60px;
    right: 30px;
    z-index: 9999;
    font-family: 'Noto Sans KR', sans-serif;
}

/* 토글 버튼 - 이미지 자체가 버튼 */
.chatbot-toggle {
    width: 100px;
    height: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 15px rgba(0, 168, 204, 0.5));
}

/* 챗봇 아이콘 이미지 */
.chatbot-icon {
    width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

/* 닫기 아이콘 */
.chatbot-close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    color: var(--primary-cyan-dark);
    font-size: 32px;
    font-weight: 700;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
}

/* 열렸을 때 - 이미지 숨기고 X 표시 */
.chatbot-container.open .chatbot-icon {
    opacity: 0;
    transform: scale(0);
}

.chatbot-container.open .chatbot-close-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.chatbot-container.open .chatbot-toggle {
    background: linear-gradient(135deg, #a8e6f0 0%, var(--primary-cyan) 100%);
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.8);
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 15px rgba(0, 168, 204, 0.4);
}

/* 챗봇 창 */
.chatbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 360px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.chatbot-container.open .chatbot-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 챗봇 헤더 */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-cyan-dark) 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chatbot-header-text {
    display: flex;
    flex-direction: column;
}

.chatbot-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.chatbot-status {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
}

/* 메시지 영역 */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8fcfd;
}

/* 스크롤바 스타일 */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--primary-cyan-light);
    border-radius: 3px;
}

/* 메시지 */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.5;
    word-break: keep-all;
    white-space: pre-line;   /* 줄바꿈 유지 */
}

.chat-message.bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e8f4f8;
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-cyan-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* FAQ 버튼들 */
.chat-faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px 0;
}

.chat-faq-buttons button {
    padding: 8px 12px;
    border: 1px solid var(--primary-cyan);
    background: white;
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary-cyan-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.chat-faq-buttons button:hover {
    background: var(--primary-cyan);
    color: white;
}

/* 입력 영역 */
.chatbot-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e8f4f8;
    display: flex;
    gap: 10px;
}

#chatbotInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

#chatbotInput:focus {
    border-color: var(--primary-cyan);
}

#chatbotInput::placeholder {
    color: #aaa;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-cyan-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

.chatbot-send span {
    color: white;
    font-size: 18px;
}

/* 로딩 인디케이터 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e8f4f8;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-cyan);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===== 반응형 ===== */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 50px;
        right: 30px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }

    .chatbot-icon {
        width: 38px;
        right: 4px;
        bottom: 7px;
    }
    
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 70vh;
        right: -10px;
        bottom: 70px;
    }
    
    .chatbot-header {
        padding: 12px 15px;
    }
    
    .chatbot-name {
        font-size: 13px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .message-content {
        font-size: 12px;
        padding: 10px 14px;
    }
    
    .chat-faq-buttons button {
        font-size: 11px;
        padding: 6px 10px;
    }
}