/* ===== AI 챗봇 스타일 ===== */

/* 플로팅 챗 버튼 */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: chatbot-pulse 2.5s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.65);
    animation: none;
}

.chatbot-toggle i {
    font-size: 24px;
    color: #fff;
    transition: opacity 0.2s ease;
}

.chatbot-toggle .icon-close {
    display: none;
}

.chatbot-toggle.open .icon-chat {
    display: none;
}

.chatbot-toggle.open .icon-close {
    display: block;
}

/* 알림 뱃지 */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 11px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.5); }
    50% { box-shadow: 0 4px 32px rgba(37, 99, 235, 0.8), 0 0 0 8px rgba(37, 99, 235, 0.1); }
}

/* 챗봇 창 */
.chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 370px;
    height: 540px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.chatbot-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* 챗봇 헤더 */
.chatbot-header {
    background: linear-gradient(135deg, #0b1220 0%, #1e3a5f 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.chatbot-avatar i {
    font-size: 20px;
    color: #fff;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #0b1220;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-info h4 {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.chatbot-header-info span {
    color: #94a3b8;
    font-size: 12px;
}

.chatbot-header-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 메시지 영역 */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8faff;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

/* 메시지 버블 */
.message {
    display: flex;
    gap: 8px;
    max-width: 100%;
    animation: message-appear 0.3s ease;
}

@keyframes message-appear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot {
    align-items: flex-end;
}

.message.user {
    flex-direction: row-reverse;
    align-items: flex-end;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar i {
    font-size: 13px;
    color: #fff;
}

.message-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
}

.message.bot .message-bubble {
    background: #fff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

/* 타이핑 인디케이터 */
.typing-indicator {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.typing-bubble {
    background: #fff;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* 빠른 답변 버튼 */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding-left: 38px;
}

.quick-reply-btn {
    background: #fff;
    border: 1.5px solid #2563eb;
    color: #2563eb;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: #2563eb;
    color: #fff;
}

/* 입력 영역 */
.chatbot-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    resize: none;
    background: #f8faff;
    color: #1a1a2e;
    transition: border-color 0.2s;
    max-height: 80px;
    overflow-y: auto;
}

.chatbot-input:focus {
    border-color: #2563eb;
    background: #fff;
}

/* Corporate Chatbot Refinement */
.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: #0f1724;
    box-shadow: 0 18px 36px rgba(15, 23, 36, 0.2);
    animation: none;
}

.chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(15, 23, 36, 0.24);
}

.chatbot-badge {
    display: none;
}

.chatbot-window {
    border-radius: 24px;
    box-shadow: 0 28px 64px rgba(15, 23, 36, 0.18);
}

.chatbot-header {
    background: #0f1724;
}

.chatbot-avatar {
    border-radius: 14px;
    background: #20324a;
}

.message.user .message-bubble {
    background: #20324a;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

.chatbot-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send-btn i {
    font-size: 15px;
    color: #fff;
    margin-left: 2px;
}

/* 하단 브랜딩 */
.chatbot-footer-brand {
    text-align: center;
    padding: 6px 0 8px;
    font-size: 11px;
    color: #94a3b8;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.chatbot-footer-brand span {
    color: #2563eb;
    font-weight: 600;
}

/* 반응형 */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 130px);
        right: 10px;
        bottom: 90px;
        border-radius: 16px;
    }

    .chatbot-toggle {
        right: 20px;
        bottom: 20px;
        width: 56px;
        height: 56px;
    }
}
