/**
 * 📄 추출 텍스트 미리보기 - 아이콘 및 모달 스타일
 */

/* 컴팩트한 아이콘 형태 미리보기 */
.document-preview-compact {
    display: flex;
    justify-content: flex-end;
    padding: 10px 15px;
}

.btn-preview-icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    color: #374151;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-preview-icon:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #eef2ff 0%, #f9fafb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.btn-preview-icon i {
    font-size: 1.25rem;
    color: #667eea;
}

.preview-label {
    font-weight: 600;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.preview-badge {
    background: #eef2ff;
    color: #4c51bf;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0;
}

/* 모달 내부 미리보기 스타일 - 정렬 강화 */
.document-preview-body-modal {
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'D2Coding', 'Pretendard Variable', 'Pretendard', monospace;
    font-size: 0.9375rem;
    font-weight: 450;
    line-height: 1.9; /* 줄간격 증가 */
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
    letter-spacing: 0.01em; /* 가독성 향상 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* 텍스트 블록 정렬 */
.document-preview-body-modal p {
    margin-bottom: 1.2em;
    text-align: justify; /* 양쪽 정렬 */
}

/* 주요 정보 강조 */
.document-preview-body-modal strong,
.document-preview-body-modal b {
    font-weight: 700;
    color: #0f172a;
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 섹션 구분선 */
.document-preview-body-modal hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 20px 0;
}

/* 스크롤바 스타일링 */
.document-preview-body-modal::-webkit-scrollbar {
    width: 8px;
}

.document-preview-body-modal::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.document-preview-body-modal::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.document-preview-body-modal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 기존 document-preview-card 숨김 */
.document-preview-card {
    display: none;
}

/* 분석 결과 스타일 강화 - 높이 제한 제거 */
.detailed-explanation {
    padding: 24px 28px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 12px;
    border-left: 5px solid #667eea;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    /* 높이 제한 제거 - 전체 내용 표시 */
    max-height: none !important;
    overflow: visible;
}

.detailed-explanation p {
    margin: 0 0 1.2em 0; /* 문단 간격 */
    line-height: 1.9; /* 넓은 줄간격 */
    color: #1e293b;
    font-size: 0.9375rem;
    text-align: justify; /* 양쪽 정렬 */
    word-break: keep-all; /* 한글 단어 단위 줄바꿈 */
}

.detailed-explanation p:last-child {
    margin-bottom: 0;
}

/* 강조된 텍스트 스타일 */
.detailed-explanation strong {
    font-weight: 700;
    color: #0f172a;
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.detailed-explanation em {
    font-style: italic;
    color: #4338ca;
    font-weight: 600;
}

/* 줄바꿈 스타일 */
.detailed-explanation br {
    line-height: 2;
}

.structured-data-summary {
    margin-top: 20px;
}

.structured-data-summary .data-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 15px;
}

.structured-data-summary .data-section h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
    letter-spacing: -0.015em;
}

.structured-data-summary .data-section p {
    margin: 8px 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #334155;
}

.structured-data-summary .data-section ul {
    margin: 10px 0;
    padding-left: 24px;
}

.structured-data-summary .data-section li {
    margin-bottom: 8px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #334155;
}

.raw-response {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e5e7eb;
}

.raw-response pre {
    margin: 0;
    font-family: 'D2Coding', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 모달 버튼 스타일링 */
.modal-footer .btn-secondary {
    padding: 10px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: #64748b;
    transition: all 0.3s ease;
}

.modal-footer .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.modal-footer .btn-primary {
    padding: 10px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.modal-footer .btn-primary i {
    margin-right: 6px;
}

/* 모달 헤더 스타일링 */
.modal-header {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-bottom: 2px solid #e5e7eb;
    padding: 18px 24px;
}

.modal-header .modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.modal-header .modal-title i {
    color: #667eea;
    margin-right: 10px;
}

.modal-header .btn-close {
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-header .btn-close:hover {
    background: #f1f5f9;
    transform: rotate(90deg);
}

/* 모달 바디 여백 */
.modal-body {
    padding: 24px;
    background: #fafbfc;
}

/* 모달 푸터 정렬 */
.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* 모달 반응형 */
@media (max-width: 768px) {
    .document-preview-compact {
        justify-content: center;
    }
    
    .btn-preview-icon {
        width: 100%;
        justify-content: center;
    }
    
    .document-preview-body-modal {
        font-size: 0.875rem;
        padding: 15px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn-secondary,
    .modal-footer .btn-primary {
        width: 100%;
    }
}

