/* ============== 고객 지원 플로팅 버튼 스타일 ============== */


/* 플로팅 버튼 컨테이너 */

.support-floating-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    transition: opacity 0.3s ease, transform 0.3s ease;
}


/* 패널이 열렸을 때 플로팅 버튼 숨김 */

.support-floating-container.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}


/* 플로팅 버튼 */

.support-floating-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.support-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

.support-floating-button:active {
    transform: scale(0.95);
}


/* 미답변 배지 */

.support-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}


/* 플로팅 패널 (FAQ + 채팅) */

.support-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: slideUp 0.3s ease;
}

.support-panel.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 패널 헤더 */

.support-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.support-panel-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.support-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.support-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}


/* 탭 메뉴 */

.support-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.support-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
}

.support-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.support-tab.active {
    color: #667eea;
    background: white;
}

.support-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}


/* FAQ 섹션 */

.support-faq-section {
    padding: 20px;
    overflow-y: auto;
    max-height: 450px;
    display: none;
}

.support-faq-section.active {
    display: block;
}

.support-faq-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.support-faq-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateX(5px);
}

.support-faq-question {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-faq-answer {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
    white-space: pre-wrap;
    /* ✅ 추가: 줄바꿈 보존 */
    word-wrap: break-word;
    /* ✅ 추가: 긴 단어 자동 줄바꿈 */
}

.support-faq-item.expanded .support-faq-answer {
    display: block;
}

.support-faq-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.support-faq-item.expanded .support-faq-icon {
    transform: rotate(90deg);
}


/* 카테고리 필터 */

.support-category-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.support-category-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #e9ecef;
    background: white;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.support-category-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.support-category-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}


/* 채팅 섹션 */

.support-chat-section {
    display: none;
    flex-direction: column;
    flex: 1;
    /* ✅ 변경: height: 500px → flex: 1 */
    overflow: hidden;
    /* ✅ 추가 */
}

.support-chat-section.active {
    display: flex;
}


/* 빠른 문의 템플릿 */

.support-quick-templates {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    white-space: nowrap;
}

.support-template-btn {
    display: inline-block;
    padding: 8px 15px;
    margin-right: 8px;
    border-radius: 20px;
    background: white;
    border: 2px solid #e9ecef;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.support-template-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}


/* 예상 답변 시간 */


/* .support-response-time {
    padding: 12px 15px;
    background: #e7f5ff;
    border-left: 4px solid #339af0;
    margin: 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #1864ab;
    line-height: 1.5;
}

.support-response-time strong {
    font-weight: 700;
} */


/* 채팅 메시지 영역 */

.support-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 0;
    /* ✅ 추가: flex 자식 요소의 스크롤을 위해 필요 */
}


/* 채팅 메시지 */

.support-message {
    display: flex;
    margin-bottom: 15px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.support-message.user {
    justify-content: flex-end;
}

.support-message.admin {
    justify-content: flex-start;
}

.support-message.system {
    justify-content: center;
}


/* 메시지 버블 */

.support-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
    /* ← 이 줄 추가 */
}

.support-message.user .support-message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.support-message.admin .support-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    border: 1px solid #e9ecef;
}

.support-message.system .support-message-bubble {
    background: #e9ecef;
    color: #666;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 12px;
}


/* 메시지 시간 */

.support-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.support-message.admin .support-message-time {
    color: #999;
}


/* 이미지 메시지 */

.support-message-image {
    max-width: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.support-message-image:hover {
    transform: scale(1.05);
}


/* 채팅 입력 영역 */

.support-chat-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    align-items: center;
    /* ← flex-end를 center로 변경 */
    flex-shrink: 0;
    /* ✅ 추가: 입력창이 줄어들지 않도록 */
}

.support-textarea {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    height: 44px;
    min-height: 44px;
    /* ← 추가 */
    max-height: 164px;
    /* ← 44px + (20px * 6) = 7줄 */
    overflow-y: auto;
    /* ← 추가 */
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    line-height: 20px;
}

.support-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.support-attach-btn {
    padding: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    box-sizing: border-box;
    /* ← 추가 */
}

.support-attach-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-2px);
}

.support-send-btn {
    padding: 0 20px;
    /* ← 12px 20px를 0 20px로 변경 */
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 60px;
    height: 44px;
    flex-shrink: 0;
    /* ← 추가 */
}

.support-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.support-send-btn:active {
    transform: translateY(0);
}

.support-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* 이미지 미리보기 영역 */

.support-image-preview-area {
    padding: 0 15px 15px 15px;
    background: white;
    flex-shrink: 0;
}

#supportImagePreview {
    display: inline-block;
    position: relative;
}


/* 이미지 미리보기 */

.support-image-preview {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.support-preview-image {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.support-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* 로딩 상태 */

.support-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #667eea;
}

.support-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* 빈 상태 */

.support-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.support-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.support-empty-text {
    font-size: 14px;
    line-height: 1.6;
}


/* 이미지 확대 모달 */

.support-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.support-image-modal.active {
    display: flex;
}

.support-modal-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
}

.support-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* 반응형 - 모바일 */

@media (max-width: 768px) {
    .support-floating-container {
        bottom: 20px;
        right: 20px;
    }
    .support-floating-button {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    .support-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        /* ✅ 변경: 80vh → 85vh */
        height: 85vh;
        /* ✅ 추가: 명확한 높이 지정 */
        border-radius: 20px 20px 0 0;
        flex-direction: column;
    }
    .support-chat-messages {
        padding: 15px;
        flex: 1;
        min-height: 0;
    }
    .support-message-bubble {
        max-width: 85%;
    }
    .support-chat-input {
        padding: 12px;
        gap: 8px;
        flex-shrink: 0;
        /* ✅ 추가 */
    }
    .support-textarea {
        min-height: 40px;
        font-size: 14px;
    }
    .support-attach-btn {
        min-width: 40px;
        height: 40px;
        font-size: 18px;
        padding: 10px;
    }
    .support-send-btn {
        min-width: 50px;
        height: 40px;
        padding: 10px 16px;
        font-size: 14px;
    }
    .support-image-preview-area {
        padding: 0 12px 12px 12px;
    }
}

@media (max-width: 375px) {
    .support-panel {
        max-height: 90vh;
        height: 90vh;
    }
    .support-chat-input {
        padding: 10px;
        gap: 6px;
    }
    .support-attach-btn {
        min-width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .support-send-btn {
        min-width: 45px;
        height: 36px;
        padding: 8px 12px;
        font-size: 13px;
    }
}


/* 스크롤바 커스텀 */

.support-faq-section::-webkit-scrollbar,
.support-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.support-faq-section::-webkit-scrollbar-track,
.support-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.support-faq-section::-webkit-scrollbar-thumb,
.support-chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.support-faq-section::-webkit-scrollbar-thumb:hover,
.support-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}