/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #F6A700;
    --primary-hover: #dd9600;
    --postech-red: #A61955;
    --postech-red-hover: #8a1445;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
    --warning-color: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #F6A700 0%, #ff8c00 100%);
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

body {
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.7;
    font-weight: 400;
    letter-spacing: -0.02em;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.header-content {
    display: grid;
    grid-template-columns: 7fr 3fr;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.header-title {
    text-align: left;
}

.header-logo {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.header-logo img {
    max-width: 180px;
    height: auto;
}

.header h1 {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--postech-red);
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: left;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.subtitle:first-of-type {
    color: var(--postech-red);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Warning Notice */
.warning-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
    font-size: 0.925rem;
    font-weight: 500;
    color: #92400e;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.warning-notice i {
    color: #f59e0b;
    font-size: 1.1rem;
    margin-top: 0.1rem;
}

.warning-notice span {
    display: block;
    flex: 1;
}

.warning-notice i {
    font-size: 1.25rem; /* 1.8rem → 1.25rem (약 30% 감소) */
    color: #ffc107;
    flex-shrink: 0;
    margin-top: 0.1rem; /* 아이콘 약간 아래로 조정 */
}

/* Upload Section */
.upload-section {
    background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

/* Upload Tabs */
.upload-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: #f8fafc;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Local file tab - POSTECH Red */
.tab-btn[data-tab="local"].active {
    color: var(--postech-red);
    border-bottom-color: var(--postech-red);
}

.tab-btn i {
    font-size: 1.2rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* File Info */
.file-info {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 1.5rem;
}

.file-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-info-header > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.file-info-header i {
    color: var(--success-color);
    font-size: 1.2rem;
}

.file-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.file-stats span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.document-preview {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Question Section */
.question-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.question-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.question-section h2 i {
    color: var(--primary-color);
}

/* Search Guide Box - Improved */
.search-guide-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.search-guide-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #1e40af;
    font-size: 1.1rem;
    font-weight: 700;
}

.search-guide-header i {
    color: #fbbf24;
    font-size: 1.3rem;
}

.search-guide-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-tip-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    flex-wrap: wrap;
}

.tip-label {
    font-weight: 600;
    color: #1e40af;
    min-width: 90px;
}

.tip-example {
    flex: 1;
    min-width: 150px;
}

.tip-example code {
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.9rem;
}

.tip-desc {
    color: #64748b;
    font-size: 0.9rem;
}

.question-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Button Group for Search */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

#questionInput {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

#questionInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Answer Section */
.answer-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.answer-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.answer-section h2 i {
    color: var(--primary-color);
}

.answer-container {
    min-height: 200px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.02);
    }
}

.loading p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* Answer Content */
.answer-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.answer-text {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
}

.answer-text h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#answerText {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1rem;
}

/* AI Answer Box */
.ai-answer-box {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid #8b5cf6;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}

.ai-answer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #8b5cf6;
    color: #6d28d9;
    font-size: 1.3rem;
    font-weight: 700;
}

.ai-answer-header i {
    font-size: 1.5rem;
    color: #8b5cf6;
}

.ai-answer-content {
    color: var(--text-primary);
}

.ai-answer-content p {
    margin-bottom: 0.75rem;
}

/* Related Sentences */
.related-sentences {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    padding: 1.5rem;
}

.related-sentences h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #92400e;
}

.related-sentences h3 i {
    color: #f59e0b;
}

/* Select All Container */
.select-all-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px solid #e2e8f0;
}

.selected-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.selected-count strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Button Small */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-left: auto;
}

/* Sentence Checkbox Wrapper */
.sentence-checkbox-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.sentence-checkbox-wrapper .checkbox-label {
    margin-top: 0.5rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.keyword-number {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.sentence-content-wrapper {
    flex: 1;
}

.sentence-item {
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #a78bfa;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.sentence-item:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
    border-left-width: 6px;
}

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

/* Relevance-based styling */
.sentence-item.relevance-high {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.sentence-item.relevance-medium {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.sentence-item.relevance-low {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.sentence-item.relevance-minimal {
    border-left-color: #94a3b8;
    background: #f8fafc;
}

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

/* Link Button */
.btn-link {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-link:hover {
    background: #eff6ff;
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-link i {
    font-size: 0.75rem;
}

.sentence-number {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.relevance-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.relevance-badge.high {
    background: #10b981;
    color: white;
}

.relevance-badge.medium {
    background: #3b82f6;
    color: white;
}

.relevance-badge.low {
    background: #f59e0b;
    color: white;
}

.relevance-badge.minimal {
    background: #94a3b8;
    color: white;
}

.sentence-text {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    white-space: pre-wrap; /* Preserve line breaks and spaces from original document */
    word-wrap: break-word; /* Break long words if necessary */
}

.sentence-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sentence-meta i {
    margin-right: 0.25rem;
}

/* Keyword highlighting */
.keyword-highlight {
    background: #fef08a;
    color: #854d0e;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Keyword outline (for other occurrences in same result) */
.keyword-outline {
    border: 2px solid #854d0e;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
    background: transparent;
}

/* Sentence underline (for full sentence containing keyword in modal) */
.sentence-underline {
    border-bottom: 3px solid #fef08a;
    padding-bottom: 0.1rem;
    display: inline;
}

/* Match count badge */
.match-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Search summary */
.search-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    color: #166534;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.search-summary i {
    color: #22c55e;
    font-size: 1.3rem;
    margin-top: 0.125rem;
}

.search-summary small {
    display: block;
    margin-top: 0.25rem;
    color: #15803d;
    opacity: 0.9;
}

/* Report Section */
.report-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 2px solid #4f46e5;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.report-header h3 {
    margin: 0;
    color: #4f46e5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.report-content {
    color: var(--text-primary);
}

.report-title h2 {
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.report-date {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

.report-note {
    color: #10b981;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0.5rem 0 0 0;
    padding: 0.5rem 1rem;
    background: #f0fdf4;
    border-radius: 6px;
    display: inline-block;
}

.report-note i {
    margin-right: 0.5rem;
}

.report-summary {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.report-summary h3 {
    margin-top: 0;
    color: #4f46e5;
}

.report-summary ul {
    margin: 1rem 0 0 0;
    padding-left: 1.5rem;
}

.report-summary li {
    margin: 0.5rem 0;
    line-height: 1.8;
}

.report-analysis {
    margin: 2rem 0;
}

.report-analysis h3 {
    color: #4f46e5;
    margin-bottom: 1.5rem;
}

.report-doc-section {
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.report-doc-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: #4f46e5;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-size: 0.9rem;
}

.doc-stat {
    color: var(--text-secondary);
    margin: 0.5rem 0 1rem 0;
}

.report-findings h5 {
    color: var(--text-primary);
    margin: 1rem 0 0.5rem 0;
}

.findings-list {
    list-style: disc;
    padding-left: 1.5rem;
}

.findings-list li {
    margin: 0.75rem 0;
    line-height: 1.8;
}

.report-conclusion {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.report-conclusion h3 {
    margin-top: 0;
    color: #92400e;
}

.report-conclusion p {
    margin: 0.75rem 0;
    line-height: 1.8;
}

/* Report Analysis Content */
.report-analysis-content {
    padding: 1rem 0;
}

.analysis-text {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    line-height: 1.8;
    margin: 0.5rem 0 1.5rem 0;
    border-left: 3px solid #4f46e5;
}

.key-points {
    margin: 1rem 0;
}

.key-point-item {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #4f46e5;
}

.point-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.point-number {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: bold;
}

.point-marker {
    color: #4f46e5;
    font-size: 1rem;
    font-weight: bold;
    flex-shrink: 0;
}

.point-title {
    color: #4f46e5;
    font-size: 0.95rem;
}

.point-content {
    margin-left: 1.5rem;
}

.point-content p {
    margin: 0;
    line-height: 1.8;
    color: var(--text-primary);
}

.original-excerpts {
    margin: 1rem 0;
}

.excerpt-item {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 2px solid #94a3b8;
}

.excerpt-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.excerpt-number {
    color: #64748b;
    font-weight: bold;
    flex-shrink: 0;
}

.excerpt-position {
    color: #94a3b8;
    font-size: 0.85rem;
}

.excerpt-text {
    margin: 0;
    line-height: 1.7;
    color: #475569;
    font-style: italic;
}

.more-info {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* Detailed Analysis Section */
.report-detailed-analysis {
    background: #fefce8;
    border-left: 4px solid #eab308;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.report-detailed-analysis h3 {
    margin-top: 0;
    color: #854d0e;
}

.detailed-analysis-content {
    margin-top: 1rem;
}

.analysis-category {
    margin: 2rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.analysis-category h4 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.category-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #4f46e5;
}

.item-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.item-number {
    color: #4f46e5;
    font-weight: bold;
    font-size: 0.95rem;
}

.item-source {
    color: #64748b;
    font-size: 0.9rem;
    padding: 0.2rem 0.6rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.item-position {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-left: auto;
}

.item-content {
    line-height: 1.8;
    color: #334155;
    font-style: italic;
}

.analysis-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 2px solid #4f46e5;
}

.analysis-summary h4 {
    margin: 0 0 1rem 0;
    color: #4f46e5;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.stats-table th,
.stats-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.stats-table th {
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 600;
}

.stats-table tr:hover {
    background: #f8fafc;
}

.stats-table td:nth-child(2),
.stats-table td:nth-child(3) {
    text-align: center;
    font-weight: 500;
}

/* Synthesis Section */
.report-synthesis {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.report-synthesis h3 {
    margin-top: 0;
    color: #1e40af;
}

.synthesis-content p {
    margin: 1rem 0;
    line-height: 1.8;
}

.synthesis-content ul {
    margin: 0.5rem 0;
    padding-left: 2rem;
}

.synthesis-content li {
    margin: 0.5rem 0;
}

.conclusion-content {
    margin-top: 1rem;
}

.conclusion-section {
    margin: 2rem 0;
}

.conclusion-section h4 {
    color: #1e293b;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.conclusion-box {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #10b981;
    line-height: 1.8;
}

.conclusion-box p {
    margin: 0.75rem 0;
}

.conclusion-box strong {
    color: #1e293b;
}

.highlight-high {
    color: #dc2626;
    font-weight: 600;
    background: #fef2f2;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.highlight-medium {
    color: #ea580c;
    font-weight: 600;
    background: #fff7ed;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.highlight-low {
    color: #2563eb;
    font-weight: 600;
    background: #eff6ff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.findings-table {
    overflow-x: auto;
}

.conclusion-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.conclusion-table th,
.conclusion-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.conclusion-table th {
    background: #f8fafc;
    color: #1e293b;
    font-weight: 600;
}

.conclusion-table td:nth-child(2),
.conclusion-table td:nth-child(3),
.conclusion-table td:nth-child(4) {
    text-align: center;
}

.conclusion-table tr:hover {
    background: #f8fafc;
}

.assessment-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}

.insights-list {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    line-height: 1.8;
}

.insight-item {
    margin: 1rem 0;
    padding-left: 0.5rem;
}

.insight-item strong {
    color: #4f46e5;
}

.implications-box {
    background: #fefce8;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #eab308;
    line-height: 1.8;
}

.implications-box p {
    margin: 0 0 1rem 0;
}

.implications-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
    list-style: none;
}

.implications-list li {
    margin: 1rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.implications-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #eab308;
    font-weight: bold;
}

.implications-list strong {
    color: #854d0e;
}

.report-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
}

.report-timestamp {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:disabled {
    background: #6b7280;
}

/* Cloud Integration Buttons */
.btn-google {
    background: #4285f4;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-google:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.btn-google:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

.btn-notion {
    background: #000;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-notion:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-notion:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

/* Cloud Input Group */
.cloud-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
}

.cloud-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.cloud-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Cloud Help */
.cloud-help {
    background: #f8fafc;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: left;
}

.cloud-help p {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-primary);
}

.cloud-help ol,
.cloud-help ul {
    margin: 0.5rem 0 1rem 1.5rem;
    color: var(--text-secondary);
}

.cloud-help li {
    margin: 0.5rem 0;
}

.cloud-help code {
    background: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* Loading Status */
.loading-status {
    text-align: center;
    padding: 1.5rem;
    background: #f0f9ff;
    border-radius: 8px;
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 500;
}

.loading-status i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.loading-status span {
    font-weight: 700;
}
    cursor: not-allowed;
    transform: none;
}

/* Documents List */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.document-item {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.document-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.doc-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.doc-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.doc-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.btn-icon-small {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-icon-small:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.doc-item-stats {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* History Section */
.history-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

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

.history-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.history-header h2 i {
    color: var(--primary-color);
}

.history-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.history-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.history-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.975rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, #F6A700 0%, #dd9600 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(246, 167, 0, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #dd9600 0%, #c48500 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(246, 167, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(100, 116, 139, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.3);
}

.btn-info:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.4);
}

/* AI Question Button */
.btn-ai {
    background: linear-gradient(135deg, #A61955 0%, #8a1445 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(166, 25, 85, 0.3);
}

.btn-ai:hover {
    background: linear-gradient(135deg, #8a1445 0%, #6e1137 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(166, 25, 85, 0.4);
}

/* POSTECH Red Buttons */
.btn-postech-red {
    background: var(--postech-red);
    color: white;
}

.btn-postech-red:hover {
    background: var(--postech-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(166, 25, 85, 0.4);
}

.btn-postech-red-secondary {
    background: transparent;
    border: 2px solid var(--postech-red);
    color: var(--postech-red);
}

.btn-postech-red-secondary:hover {
    background: var(--postech-red);
    color: white;
    transform: translateY(-2px);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--danger-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    z-index: 1001;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.modal-header h2 i {
    color: var(--primary-color);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.5rem; /* 좌우 padding 증가 */
}

.document-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    flex-wrap: wrap;
}

.document-stats span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.document-stats i {
    color: var(--primary-color);
}

.full-document-content {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 3rem; /* 2rem → 2.5rem 3rem으로 증가 */
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap; /* Preserve line breaks and spaces from original document */
    word-wrap: break-word; /* Break long words if necessary */
}

.full-document-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* Document section in modal */
.modal-doc-section {
    scroll-margin-top: 2rem;
}

.modal-doc-section h4 {
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
    padding: 0.5rem 0;
}

/* Pre-formatted document content */
.document-content-pre {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.8;
    color: var(--text-primary);
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin: 0;
    font-size: 0.95rem;
    overflow-x: auto;
}

/* Highlight target in document */
.highlight-target {
    background: #ffd700 !important;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
    animation: pulse 1s 3;
}

/* Enhanced pulse animation for highlight */
@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
    }
    50% { 
        opacity: 0.9; 
        transform: scale(1.01);
        box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.5);
    }
}

.full-document-content p:last-child {
    margin-bottom: 0;
}

/* Document table styles (for detected tables in PDF) */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    font-size: 0.95rem;
}

.doc-table th,
.doc-table td {
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    text-align: left;
}

.doc-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.doc-table td {
    color: var(--text-secondary);
}

.doc-table tbody tr:hover {
    background: #f9fafb;
}

/* Document line (for non-table content) */
.doc-line {
    white-space: pre-wrap;
    line-height: 1.8;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.document-content-pre {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    color: var(--text-primary);
    background: transparent;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
}

.copy-options {
    display: flex;
    align-items: center;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem 1rem 2rem 1rem;
    color: white;
    font-size: 0.9rem;
    line-height: 1.8;
}

.footer p {
    margin: 0;
}

.footer-title {
    font-weight: 700;
    font-size: 1.1em;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .header-title {
        text-align: center;
    }

    .header-logo {
        justify-content: center;
    }

    .subtitle {
        text-align: center;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .file-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

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

    .modal-content {
        max-height: 95vh;
        margin: 0.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .document-stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .full-document-content {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
    
    .report-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .report-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .report-actions .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
