/* 벡터 미리보기 사이드바 스타일 */
.vector-preview-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.vector-preview-sidebar.open {
    right: 0;
}

/* 헤더 */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.preview-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.preview-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.preview-close-btn:hover {
    color: #333;
}

/* 문서 제목 */
.preview-document-title {
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 500;
    color: #0066cc;
    background: #f0f7ff;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 탭 */
.preview-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-btn.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
    font-weight: 500;
}

.tab-btn i {
    font-size: 16px;
}

/* 컨텐츠 영역 */
.preview-content {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.tab-content {
    padding: 20px;
}

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

.loading i {
    font-size: 20px;
}

/* 정보 섹션 */
.info-section {
    margin-bottom: 25px;
}

.info-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.info-item {
    display: flex;
    margin-bottom: 10px;
}

.info-label {
    flex: 0 0 120px;
    font-weight: 500;
    color: #666;
}

.info-value {
    flex: 1;
    color: #333;
}

/* 청크 검색 */
.chunks-search {
    position: relative;
    margin-bottom: 20px;
}

.chunks-search input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chunks-search input:focus {
    outline: none;
    border-color: #0066cc;
}

.chunks-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* 청크 컨테이너 */
.chunks-container {
    margin-bottom: 20px;
}

.chunk-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
}

.chunk-item.highlighted {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
    transform: translateY(-2px);
}

.chunk-item.highlighted::before {
    content: "🎯 질의에 활용됨";
    position: absolute;
    top: -10px;
    right: 10px;
    background: #ff9800;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chunk-index {
    font-weight: 600;
    color: #0066cc;
}

.chunk-item.highlighted .chunk-index {
    color: #e65100;
    font-weight: 700;
}

.chunk-score {
    font-size: 13px;
    color: #666;
}

.chunk-item.highlighted .chunk-score {
    background: #ff9800;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.chunk-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.chunk-item.highlighted .chunk-content {
    color: #bf360c;
    font-weight: 500;
}

.chunk-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-tag {
    font-size: 12px;
    padding: 3px 8px;
    background: #e7f3ff;
    color: #0066cc;
    border-radius: 3px;
}

.chunk-item.highlighted .meta-tag {
    background: #ffcc80;
    color: #e65100;
    font-weight: 500;
}

/* 페이지네이션 */
.chunks-pagination {
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover {
    background: #f8f9fa;
    border-color: #0066cc;
    color: #0066cc;
}

.pagination button.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 메타데이터 */
.metadata-sections {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.metadata-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.metadata-section-title {
    margin: 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metadata-section-title i {
    color: #0066cc;
    font-size: 14px;
}

.metadata-grid {
    display: grid;
    gap: 0;
    background: #fff;
}

.metadata-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    border-bottom: 1px solid #f0f0f0;
}

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

.metadata-key {
    padding: 10px 16px;
    font-weight: 500;
    color: #666;
    font-size: 13px;
    background: #fafbfc;
    border-right: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}

.metadata-value {
    padding: 10px 16px;
    color: #333;
    font-size: 14px;
    word-break: break-word;
    display: flex;
    align-items: center;
}

/* 특정 값 스타일링 */
.metadata-value:has-text("완료") {
    color: #2e7d32;
    font-weight: 500;
}

.metadata-value:has-text("실패") {
    color: #c62828;
    font-weight: 500;
}

/* 에러 및 빈 상태 */
.error-message,
.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.error-message {
    color: #d32f2f;
}

/* 반응형 */
@media (max-width: 768px) {
    .vector-preview-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .tab-btn {
        font-size: 13px;
    }
    
    .tab-btn i {
        font-size: 14px;
    }
}

/* 스크롤바 스타일 */
.preview-content::-webkit-scrollbar {
    width: 8px;
}

.preview-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.preview-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* 강조된 청크 pulse 애니메이션 */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
    }
    50% {
        box-shadow: 0 8px 24px rgba(255, 152, 0, 0.4);
        transform: translateY(-4px);
    }
    100% {
        box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
    }
}