/* RAG 관리 페이지 전용 스타일 */

.rag-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.rag-header {
    background: linear-gradient(135deg, #6f42c1 0%, #5a36a1 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.rag-body {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 250px);
}

/* 사이드바 */
.rag-sidebar {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    border-bottom: 1px solid #e9ecef;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-header {
    padding: 1rem;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-section-content {
    padding: 1rem;
    color: #495057 !important;
}

.project-stats-summary .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    text-align: center;
}

.project-stats-summary .stat-item {
    color: #495057 !important;
}

.project-stats-summary .stat-number {
    color: #6f42c1 !important;
}

.project-stats-summary .stat-label {
    color: #6c757d !important;
}

.filter-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    padding: 0.5rem;
}

.filter-checkboxes::-webkit-scrollbar {
    width: 4px;
}

.filter-checkboxes::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.filter-checkboxes::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

/* 메인 콘텐츠 */
.rag-main {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.rag-tabs {
    border-bottom: 1px solid #dee2e6;
}

.rag-tabs .nav-tabs {
    border-bottom: none;
    padding: 0 1rem;
}

/* 2026-05-20: button base 룰 (main.css line 227 `button { background: #007bff }`) override.
   nav-link 가 button element 라 광범위 룰의 영향을 받아 hover 시 blue fill + 흰 글자.
   base + hover + focus + active 모두 background: transparent 명시. */
.rag-tabs .nav-link,
.rag-tabs .nav-link:hover,
.rag-tabs .nav-link:focus,
.rag-tabs .nav-link.active:hover,
.rag-tabs .nav-link.active:focus {
    background-color: transparent;
}

.rag-tabs .nav-link {
    border: none;
    border-radius: 0;
    padding: 1rem 1.5rem;
    color: #6c757d;
    border-bottom: 3px solid transparent;
}

.rag-tabs .nav-link.active {
    background: none;
    color: #6f42c1;
    border-bottom-color: #6f42c1;
}

.rag-tabs .nav-link:hover {
    border-color: transparent;
    color: #6f42c1;
}

.tab-content {
    flex: 1;
    min-height: 0;
}

.pane-content {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
    color: #495057 !important;
}

/* 컬렉션 그리드 */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.collection-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    background: #fff;
}

.collection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #6f42c1;
}

.collection-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.collection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057 !important;
    margin-bottom: 0.5rem;
}

.collection-meta {
    font-size: 0.875rem;
    color: #6c757d !important;
    margin-bottom: 1rem;
}

.collection-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.collection-stats .stat-item {
    text-align: center;
    flex: 1;
}

.collection-stats .stat-number {
    font-size: 1rem;
    font-weight: 600;
    color: #6f42c1;
    display: block;
}

.collection-stats .stat-label {
    font-size: 0.7rem;
    color: #6c757d !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.collection-actions {
    display: flex;
    gap: 0.5rem;
}

/* 업로드 영역 */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #6f42c1;
    background: #f8f6ff;
}

.upload-area.drag-over {
    border-style: solid;
    background: #ede7ff;
}

.upload-content i {
    font-size: 3rem;
    color: #6f42c1;
    margin-bottom: 1rem;
}

.upload-content h6 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.upload-queue {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    background: #f8f9fa !important;
    color: #495057 !important;
}

.upload-queue-item {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 0.5rem;
    background: white !important;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    color: #495057 !important;
}

.upload-queue-item:last-child {
    margin-bottom: 0;
}

.upload-file-info {
    flex: 1;
}

.upload-file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-file-size {
    font-size: 0.875rem;
    color: #6c757d !important;
}

/* 검색 결과 */
.search-results {
    max-height: 75vh;
    overflow-y: auto;
    padding: 1rem 0;
}

.search-result-item {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    border-color: #6f42c1;
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.1);
}

.search-result-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.search-result-score {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e7e3ff;
    color: #5a36a1;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.search-result-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #495057 !important;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin: 0.75rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.search-result-highlight {
    background-color: #fff3cd !important;
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
    font-weight: 600;
    color: #495057 !important;
}

.search-result-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.875rem;
    color: #6c757d !important;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d !important;
    background: transparent !important;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 0;
}

/* 반응형 디자인 */
/* 2026-05-20: breakpoint 1200px → 768px — TM 관리 / 용어집 관리와 동일 통일.
   세 페이지가 같은 사이드 + main grid 구조이므로 데스크탑/모바일 임계점도 동일. */
@media (max-width: 768px) {
    .rag-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: auto;
    }

    .rag-sidebar {
        order: -1;
        max-height: 400px;
    }

    .rag-main {
        min-height: 600px;
    }
}

@media (max-width: 768px) {
    .rag-container {
        padding: 1rem 0.5rem;
    }
    
    .rag-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .rag-body {
        gap: 1rem;
    }
    
    .collections-grid {
        grid-template-columns: 1fr;
    }
    
    .project-stats-summary .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .collection-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .rag-container {
        padding: 0.5rem;
    }
    
    .rag-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .pane-content {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-content i {
        font-size: 2rem;
    }
}

/* 라이트 테마 강제 적용 (용어집 관리와 일관성 유지) */
.rag-sidebar,
.rag-main {
    background: white !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

.sidebar-section-header {
    background: #f8f9fa !important;
    color: #495057 !important;
    border-color: #e9ecef !important;
}

.collection-card {
    background: white !important;
    border-color: #e9ecef !important;
    color: #495057 !important;
}

.upload-area {
    background: #fafafa !important;
    border-color: #dee2e6 !important;
    color: #495057 !important;
}

.search-result-item {
    background: white !important;
    border-color: #e9ecef !important;
    color: #495057 !important;
}

.upload-area:hover,
.upload-area.drag-over {
    background: #f8f6ff !important;
    border-color: #6f42c1 !important;
}

.upload-area.drag-over {
    background: #ede7ff !important;
} 

/* 문서 목록 모달 스타일 */
.document-list-container {
    max-height: 600px;
    overflow-y: auto;
}

.document-list-summary {
    background: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.document-list-summary .fw-bold {
    font-size: 1.25rem;
    color: #495057;
}

.document-list-table {
    margin-top: 1rem;
}

.document-list-table .table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.document-list-table .table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    padding: 0.75rem 0.5rem;
}

.document-list-table .table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.document-list-table .table tbody tr:hover {
    background-color: #f5f5f5;
}

.document-list-table .fw-medium {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
}

.document-list-table .text-muted {
    font-size: 0.8rem;
}

.delete-document-btn {
    transition: all 0.2s ease;
}

.delete-document-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.document-list-actions {
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    margin: 1rem -1rem -1rem -1rem;
    padding: 1rem;
}

/* 모달 크기 확장 */
.modal-lg .modal-container {
    max-width: 900px;
    width: 90%;
}

/* 파일 아이콘 색상 */
.bi-file-earmark-pdf {
    color: #dc3545 !important;
}

.bi-file-earmark-word {
    color: #0d6efd !important;
}

.bi-file-earmark-text {
    color: #6c757d !important;
}

.bi-file-earmark-code {
    color: #20c997 !important;
}

.bi-file-earmark {
    color: #6c757d !important;
}

/* 반응형 문서 목록 모달 */
@media (max-width: 768px) {
    .modal-lg .modal-container {
        max-width: 95%;
        margin: 1rem auto;
    }
    
    .document-list-summary .row {
        text-align: center;
    }
    
    .document-list-table .table {
        font-size: 0.8rem;
    }
    
    .document-list-table .table th,
    .document-list-table .table td {
        padding: 0.5rem 0.25rem;
    }
    
    .document-list-table .fw-medium {
        font-size: 0.85rem;
    }
    
    .document-list-actions {
        text-align: center;
    }
    
    .document-list-actions .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .document-list-summary .col-md-4 {
        margin-bottom: 1rem;
    }
    
    .document-list-table .table-responsive {
        font-size: 0.75rem;
    }
    
    /* 모바일에서 테이블 컬럼 숨김 */
    .document-list-table .table th:nth-child(3),
    .document-list-table .table td:nth-child(3) {
        display: none;
    }
} 

/* 문서 목록 모달 크기 개선 */
#globalModal.modal-visible .modal-container.modal-lg {
    max-width: 90vw !important;
    width: 90vw !important;
    max-height: 90vh !important;
    margin: 2vh auto !important;
}

#globalModal.modal-visible .modal-content {
    height: 100% !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
}

#globalModal.modal-visible .modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    max-height: calc(90vh - 120px) !important; /* 헤더와 푸터 공간 확보 */
    padding: 1rem !important;
}

/* 문서 목록 컨테이너 스타일 개선 */
.document-list-container {
    width: 100% !important;
    min-height: 400px !important;
}

.document-list-table {
    width: 100% !important;
    overflow-x: auto !important;
}

.document-list-table .table {
    width: 100% !important;
    margin-bottom: 0 !important;
}

/* 테이블 행 클릭 가능하게 스타일링 */
.document-list-table .table tbody tr {
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

.document-list-table .table tbody tr:hover {
    background-color: #f8f9fa !important;
}

.document-list-table .table tbody tr.clicked {
    background-color: #e3f2fd !important;
}

/* 삭제 버튼은 클릭 이벤트 전파 방지 */
.delete-document-btn {
    z-index: 10 !important;
}

/* 문서 상세 정보 모달 (추가) */
.document-detail-modal {
    max-width: 95vw !important;
    width: 95vw !important;
}

.document-detail-content {
    max-height: 80vh !important;
    overflow-y: auto !important;
}

/* 처리 설정 정보 스타일 */
.processing-info {
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.5rem !important;
    padding: 1.25rem !important;
    margin-bottom: 1.5rem !important;
}

.processing-info h6 {
    color: #495057 !important;
    margin-bottom: 1rem !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #e9ecef !important;
    padding-bottom: 0.5rem !important;
}

.info-item {
    text-align: center !important;
}

.info-label {
    font-size: 0.875rem !important;
    color: #6c757d !important;
    font-weight: 500 !important;
    margin-bottom: 0.5rem !important;
}

.info-value {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.25rem !important;
}

.info-value .badge {
    font-size: 0.875rem !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.375rem !important;
}

.info-value small {
    font-size: 0.75rem !important;
    margin-top: 0.25rem !important;
}

/* 문서 요약 정보 스타일 개선 */
.document-summary {
    background-color: #fff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 0.5rem !important;
    padding: 1.25rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* 청크 미리보기 스타일 개선 */
.chunk-preview {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.5rem !important;
    padding: 1.25rem !important;
    margin-bottom: 1rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    transition: box-shadow 0.15s ease-in-out !important;
}

.chunk-preview:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1) !important;
}

.chunk-preview h6 {
    color: #495057 !important;
    font-size: 0.95rem !important;
    margin-bottom: 0.75rem !important;
    border-bottom: 1px solid #e9ecef !important;
    padding-bottom: 0.5rem !important;
    font-weight: 600 !important;
}

.chunk-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    color: #212529 !important;
    background-color: #f8f9fa !important;
    padding: 1rem !important;
    border-radius: 0.375rem !important;
    border: 1px solid #e9ecef !important;
}

.chunk-meta {
    border-top: 1px solid #e9ecef !important;
    padding-top: 0.5rem !important;
    margin-top: 0.75rem !important;
}

/* 섹션 헤더 스타일 */
.document-chunks h6 {
    color: #495057 !important;
    font-weight: 600 !important;
    margin-bottom: 1rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 2px solid #e9ecef !important;
}

/* 반응형 디자인 개선 */
@media (max-width: 768px) {
    #globalModal.modal-visible .modal-container.modal-lg {
        max-width: 95vw !important;
        width: 95vw !important;
        margin: 1vh auto !important;
    }
    
    #globalModal.modal-visible .modal-body {
        max-height: calc(90vh - 100px) !important;
        padding: 0.5rem !important;
    }
    
    .document-list-summary .col-md-4 {
        margin-bottom: 1rem !important;
    }
    
    .processing-info .col-md-4 {
        margin-bottom: 1rem !important;
    }
    
    .document-summary .col-md-4 {
        margin-bottom: 1rem !important;
    }
    
    .document-list-table .table th,
    .document-list-table .table td {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    /* 모바일에서는 토큰 수 열 숨기기 */
    .document-list-table .table th:nth-child(3),
    .document-list-table .table td:nth-child(3) {
        display: none !important;
    }
    
    .chunk-content {
        font-size: 0.8rem !important;
        padding: 0.75rem !important;
    }
    
    .processing-info,
    .document-summary,
    .chunk-preview {
        padding: 1rem !important;
    }
}

/* 문서 목록 탭 전용 스타일 */
.documents-list {
    width: 100%;
}

.documents-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
}

.documents-items {
    margin-top: 1rem;
}

.document-row {
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    background: white;
    transition: all 0.2s ease;
}

.document-row:hover {
    border-color: #6f42c1;
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.1);
}

.document-header {
    padding: 1rem;
    cursor: pointer;
    user-select: none;
}

.document-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.document-main-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.document-details {
    min-width: 0;
    flex: 1;
}

.document-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.document-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.delete-document-btn,
.expand-btn {
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    transition: all 0.2s ease;
}

.delete-document-btn:hover {
    border-color: #dc3545;
    background: #dc3545;
    color: white;
}

.expand-btn:hover {
    border-color: #6f42c1;
    background: #6f42c1;
    color: white;
}

/* 문서 상세 정보 expandable 영역 */
.document-details-content {
    overflow: hidden;
    transition: all 0.3s ease;
}

.document-details-content.collapsed {
    max-height: 0;
    padding: 0;
}

.document-details-content.expanded {
    max-height: 2000px; /* 충분히 큰 값 */
    border-top: 1px solid #e9ecef;
}

.document-details-expanded {
    background: #f8f9fa;
}

.details-summary {
    background: white;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.summary-item {
    text-align: center;
}

.summary-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.chunks-list {
    background: white;
    border-radius: 0.375rem;
    padding: 1rem;
}

.chunks-container {
    max-height: 900px;
    overflow-y: auto;
}

.chunk-item {
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
    background: #fafafa;
}

.chunk-item:last-child {
    margin-bottom: 0;
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0.25rem 0.25rem 0 0;
}

.chunk-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
}

.chunk-tokens {
    font-size: 0.75rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 0.1rem 0.5rem;
    border-radius: 0.25rem;
}

.chunk-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.loading-spinner-small {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}

/* 문서 목록 탭 반응형 디자인 */
@media (max-width: 768px) {
    .document-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .document-main-info {
        width: 100%;
    }

    .document-actions {
        align-self: flex-end;
    }

    .document-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .details-summary .row {
        --bs-gutter-x: 0.5rem;
    }

    .summary-item {
        margin-bottom: 0.5rem;
    }

    .chunk-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 576px) {
    .document-header {
        padding: 0.75rem;
    }

    .details-summary,
    .chunks-list {
        padding: 0.75rem;
    }

    .chunk-content {
        font-size: 0.85rem;
    }

    .documents-header .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .documents-header .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
} 

/* ========== RAG 문서 목록 스타일 (추가) ========== */

/* 문서 상세 정보 영역 스타일 */
.document-details-expanded {
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.details-summary {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

/* 기술 정보 영역 (좌측) */
.technical-info {
    background-color: #fff;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e9ecef;
    height: 100%;
}

.technical-info h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
}

.technical-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.technical-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f1f3f4;
}

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

.technical-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.technical-value {
    font-size: 0.875rem;
    color: #212529;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* 문서 통계 영역 (우측) */
.document-stats {
    background-color: #fff;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e9ecef;
    height: 100%;
}

.document-stats h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    color: #212529;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* 청크 목록 영역 */
.chunks-list {
    margin-top: 20px;
}

.chunks-list h6 {
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.chunks-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background-color: #fff;
}

.chunk-item {
    border-bottom: 1px solid #e9ecef;
    padding: 15px;
    transition: background-color 0.2s ease;
}

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

.chunk-item:hover {
    background-color: #f8f9fa;
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chunk-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: #007bff;
}

.chunk-tokens {
    font-size: 0.75rem;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 2px 8px;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
}

.chunk-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .technical-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .technical-label {
        font-size: 0.75rem;
    }
    
    .technical-value {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .details-summary .row {
        flex-direction: column;
    }
    
    .technical-info,
    .document-stats {
        margin-bottom: 15px;
    }
} 

/* 검색 로딩 상태 */
.search-loading-container {
    margin: 2rem 0;
    animation: fadeIn 0.3s ease-in-out;
}

.search-loading-container .card-body {
    padding: 2rem;
}

.search-loading-container .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 검색 에러 메시지 */
.search-error-container {
    margin: 2rem 0;
    animation: slideIn 0.3s ease-in-out;
}

.search-error-container .alert {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.2);
}

.error-content {
    padding: 0.5rem 0;
}

.error-main {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.error-suggestion {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #ffc107;
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: 4px;
    font-size: 0.95rem;
}

.error-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.retry-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background-color: #0056b3;
}

.close-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #5a6268;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 검색 취소 버튼 스타일 */
#cancelSearchBtn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

#cancelSearchBtn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* 검색 결과 향상 */
.search-results {
    min-height: 400px;
}

.search-results .empty-state {
    padding: 3rem;
    text-align: center;
    color: #6c757d;
}

.search-results .empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .error-actions {
        flex-direction: column;
    }
    
    .search-loading-container .card-body {
        padding: 1.5rem;
    }
    
    .search-loading-container .spinner-border {
        width: 2rem;
        height: 2rem;
    }
} 

/* 검색 결과 아이템 스타일 */
.search-result-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-result-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-title {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.result-title strong {
    color: #343a40;
    font-size: 1.1rem;
}

.result-meta {
    color: #6c757d;
    font-size: 0.875rem;
}

.result-content {
    margin-bottom: 0.75rem;
}

.result-content p {
    margin: 0;
    color: #495057;
    line-height: 1.5;
    font-size: 0.95rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.result-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* 스코어 배지 스타일 */
.badge.bg-primary {
    background-color: #007bff !important;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .result-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    .search-result-item {
        padding: 0.75rem;
    }
} 
/* ── 컴팩트 필터 (컬렉션/문서 선택) — A안 ── */
.rag-filter-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.rag-filter-head .rag-filter-title { font-size: .8rem; font-weight: 600; color: #374151; }
.rag-filter-head .rag-filter-title .text-muted { font-weight: 400; }
.rag-filter-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.rag-filter-link { background: none; border: none; padding: 0; font-size: .72rem; color: #2563eb; cursor: pointer; line-height: 1; }
.rag-filter-link:hover { text-decoration: underline; }
.rag-filter-link.muted { color: #6b7280; }
.rag-filter-sep { color: #d1d5db; font-size: .72rem; }
.rag-filter-count { font-size: .72rem; color: #6b7280; white-space: nowrap; }
.rag-filter-count .sel { color: #2563eb; font-weight: 600; }
.rag-filter-list { max-height: 170px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: .5rem; padding: .2rem; background: #fff; }
.rag-filter-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .45rem; border-radius: .375rem; cursor: pointer; margin: 0; }
.rag-filter-row:hover { background: #f3f4f6; }
.rag-filter-row input { flex: 0 0 auto; margin: 0; cursor: pointer; }
.rag-filter-row .rag-filter-name { flex: 1 1 auto; font-size: .8rem; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rag-filter-row .rag-filter-badge { flex: 0 0 auto; font-size: .68rem; color: #6b7280; background: #f3f4f6; border-radius: .6rem; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.rag-filter-empty { font-size: .78rem; color: #9ca3af; padding: .4rem .2rem; margin: 0; }

/* ── 검색 결과 카드: 긴 텍스트로 인한 가로 무한 확장 방지 ── */
.search-results .search-result-item { max-width: 100%; overflow: hidden; }
.search-results .result-content,
.search-results .result-header { min-width: 0; }
.search-results .result-title { flex-wrap: wrap; min-width: 0; }
.search-results .result-title > span:first-child { overflow-wrap: anywhere; word-break: break-word; }
/* 원문/번역 라벨 행(d-flex)의 값 칸이 줄바꿈되도록 */
.search-results .result-content .d-flex { min-width: 0; }
.search-results .result-content .d-flex > span { min-width: 0; }
.search-results .result-content .d-flex > span:last-child { overflow-wrap: anywhere; word-break: break-word; }
.search-results .result-preview { overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; }
/* 전체보기 영역 — 본문/메타데이터 줄바꿈 + pre 가로 스크롤 가둠 */
.search-results .rag-full-text { overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; }
.search-results .rag-meta-pre { white-space: pre-wrap; word-break: break-all; overflow-x: auto; max-width: 100%; font-size: 0.82rem; margin: 0; }
.search-results .result-toggle { color: #6b7280; }
.search-results .result-toggle:hover { color: #2563eb; }

/* ── Sheet RAG 구조화 설정 — 용도 프리셋 버튼(라이트 스타일, 검정 hover 제거) ── */
#sheetRagIntentGroup .intent-btn {
    display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
    padding: .35rem .6rem; border: 1px solid #d0d7de; border-radius: .5rem;
    background: #fff; color: #374151; font-size: .82rem; line-height: 1.2; cursor: pointer;
}
#sheetRagIntentGroup .intent-btn small { color: #9ca3af; font-size: .68rem; }
#sheetRagIntentGroup .intent-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
#sheetRagIntentGroup .btn-check:checked + .intent-btn { background: #eef2ff; border-color: #6366f1; color: #3730a3; }
#sheetRagIntentGroup .btn-check:checked + .intent-btn small { color: #6366f1; }
/* 헤더 없음 체크박스 강조 박스 */
.sheet-check-box { background: #f8f9fa; border: 1px solid #e5e7eb; border-radius: .5rem; padding: .45rem .6rem; }
.sheet-check-box .form-check-label { font-weight: 500; }

/* ── 검색 결과 카드: 하단 줄 전체를 펼치기/접기 토글 바로 ── */
.search-results .result-toggle-bar {
    display: flex; align-items: center; justify-content: center;
    padding: .35rem; cursor: pointer; color: #9ca3af;
    border-top: 1px solid #f0f1f3; user-select: none; transition: background .12s, color .12s;
}
.search-results .result-toggle-bar:hover { background: #f8f9fa; color: #2563eb; }
.search-results .result-toggle-bar i { font-size: 1rem; }

/* ── 검색 결과 펼침 영역: 높이 제한 + 내부 스크롤 (긴 메타데이터도 카드 높이 일정, 접기 바 항상 노출) ── */
.search-results .result-full-content { max-height: 320px; overflow-y: auto; }
.search-results .result-full-content .rag-meta-pre { max-height: none; }
