/* 챗봇 위젯 스타일 */

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 챗봇 열기 버튼 */
.chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10000;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle-btn:active {
    transform: scale(0.95);
}

/* 챗봇 윈도우 */
.chatbot-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 400px;
    height: 600px;
    min-height: 400px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    resize: none; /* 기본 리사이즈 비활성화 */
}

.chatbot-window.active {
    display: flex;
}

.chatbot-window.minimized {
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    overflow: hidden !important;
}

.chatbot-window.minimized .chatbot-header {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    min-height: auto !important;
    height: auto !important;
    flex-shrink: 0 !important;
    line-height: 1.2 !important;
}

.chatbot-window.minimized .chatbot-body {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    min-height: 0 !important;
    flex: 0 0 0 !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chatbot-window.minimized .chatbot-body iframe {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* 다크모드 지원 */
[data-bs-theme="dark"] .chatbot-window {
    background: #1a1a1a;
    color: #e0e0e0;
}

/* 헤더 */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: 20px; /* 리사이즈 핸들 공간 확보 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: move;
    user-select: none;
    position: relative;
    z-index: 5;
}

.chatbot-header-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chatbot-btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 본문 (iframe) */
.chatbot-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.chatbot-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* 리사이즈 핸들 */
.chatbot-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 15; /* 헤더 위에 표시 */
    transition: background 0.2s ease;
}

.chatbot-resize-handle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    transition: background 0.2s ease;
}

.chatbot-resize-handle:hover::after {
    background: rgba(255, 255, 255, 0.9);
}

.chatbot-window.minimized .chatbot-resize-handle {
    display: none;
}

/* 다크모드 리사이즈 핸들 */
[data-bs-theme="dark"] .chatbot-resize-handle:hover {
    background: rgba(255, 255, 255, 0.3);
}

[data-bs-theme="dark"] .chatbot-resize-handle::after {
    background: rgba(255, 255, 255, 0.6);
}

[data-bs-theme="dark"] .chatbot-resize-handle:hover::after {
    background: rgba(255, 255, 255, 0.9);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
}

/* 애니메이션 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-window.active {
    animation: slideUp 0.3s ease;
}

