/* TravelWing FAQ v2.0 - Frontend Styles */

/* 컨테이너 */
.twfaq-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 언어 선택 */
.twfaq-lang-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.twfaq-lang-selector button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.twfaq-lang-selector button:hover {
    border-color: #0066cc;
    color: #0066cc;
}

.twfaq-lang-selector button.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

/* ==================== 대화창 스타일 ==================== */

.twfaq-chat-container {
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: #fff;
    margin-bottom: 30px;
}

.twfaq-chat-header {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.twfaq-chat-icon {
    font-size: 24px;
}

.twfaq-chat-title {
    font-size: 16px;
    font-weight: 600;
}

/* 메시지 영역 */
.twfaq-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.twfaq-message {
    display: flex;
    max-width: 85%;
}

.twfaq-message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.twfaq-message.bot {
    margin-right: auto;
}

.twfaq-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.twfaq-message.user .twfaq-message-content {
    background: #0066cc;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.twfaq-message.bot .twfaq-message-content {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* 입력 영역 */
.twfaq-chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.twfaq-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.twfaq-chat-input:focus {
    border-color: #0066cc;
}

.twfaq-chat-send {
    padding: 12px 24px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.twfaq-chat-send:hover {
    background: #0052a3;
}

.twfaq-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.twfaq-chat-footer {
    padding: 12px 20px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.twfaq-inquiry-link {
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.twfaq-inquiry-link:hover {
    color: #0066cc;
    text-decoration: underline;
}

/* 타이핑 인디케이터 */
.twfaq-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.twfaq-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.twfaq-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.twfaq-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.twfaq-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==================== 기존 검색 모드 스타일 ==================== */

.twfaq-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.twfaq-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.twfaq-input:focus {
    border-color: #0066cc;
}

.twfaq-btn {
    padding: 12px 24px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
}

.twfaq-btn:hover {
    background: #0052a3;
}

/* 결과 영역 */
.twfaq-result {
    background: #f0f7ff;
    border: 1px solid #0066cc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.twfaq-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #cce0f5;
}

.twfaq-result-question {
    font-weight: 600;
    color: #0066cc;
}

.twfaq-result-score {
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}

.twfaq-result-answer {
    line-height: 1.7;
    color: #333;
    white-space: pre-wrap;
}

.twfaq-result-link {
    margin-top: 12px;
}

.twfaq-result-link a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

.twfaq-result-link a:hover {
    text-decoration: underline;
}

/* 매칭 실패 */
.twfaq-no-result {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.twfaq-no-result-text {
    color: #cc0000;
    margin-bottom: 12px;
}

.twfaq-inquiry-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #0066cc;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
}

.twfaq-inquiry-btn:hover {
    background: #0052a3;
    color: #fff;
}

/* 로딩 */
.twfaq-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #666;
}

.twfaq-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== FAQ 목록 ==================== */

.twfaq-faq-list {
    margin-top: 30px;
}

.twfaq-list-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

/* 카테고리 탭 */
.twfaq-category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.twfaq-tab {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.twfaq-tab:hover {
    border-color: #0066cc;
    color: #0066cc;
}

.twfaq-tab.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

/* 아코디언 */
.twfaq-accordion {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.twfaq-accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.twfaq-accordion-item:last-child {
    border-bottom: none;
}

.twfaq-accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: background 0.2s;
}

.twfaq-accordion-header:hover {
    background: #f8f9fa;
}

.twfaq-q-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #0066cc;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.twfaq-q-text {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.twfaq-arrow {
    color: #999;
    font-size: 12px;
    transition: transform 0.2s;
}

.twfaq-accordion-item.open .twfaq-arrow {
    transform: rotate(180deg);
}

.twfaq-accordion-content {
    display: none;
    padding: 0 20px 20px 56px;
    background: #f8f9fa;
}

.twfaq-accordion-item.open .twfaq-accordion-content {
    display: block;
}

.twfaq-a-text {
    line-height: 1.7;
    color: #555;
    white-space: pre-wrap;
}

.twfaq-detail-link {
    display: inline-block;
    margin-top: 12px;
    color: #0066cc;
    text-decoration: none;
    font-size: 13px;
}

.twfaq-detail-link:hover {
    text-decoration: underline;
}

.twfaq-empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* 반응형 */
@media (max-width: 600px) {
    .twfaq-chat-messages {
        height: 350px;
    }
    
    .twfaq-message {
        max-width: 90%;
    }
    
    .twfaq-chat-send span {
        display: none;
    }
    
    .twfaq-chat-send::after {
        content: '→';
        font-size: 18px;
    }
    
    .twfaq-chat-send {
        padding: 12px 16px;
    }
    
    .twfaq-search-box {
        flex-direction: column;
    }
    
    .twfaq-lang-selector {
        justify-content: center;
    }
}
