/* ===== 整体容器 ===== */
.text-comparison-wrapper {
    max-width: 1500px;
    margin: 20px auto;
    padding: 35px 40px;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ===== 头部 ===== */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f0f2f5;
}

.header h1 {
    color: #1a2332;
    font-size: 30px;
    margin: 0 0 6px 0;
}

.header .subtitle {
    color: #7f8c8d;
    font-size: 15px;
    margin: 0;
}

/* ===== 输入区域 ===== */
.comparison-inputs {
    display: flex;
    gap: 30px;
    flex-wrap: nowrap;
}

.input-group {
    flex: 1;
    min-width: 0;
    position: relative;
}

.input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 16px;
}

.input-group textarea {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #e0e4e8;
    border-radius: 12px;
    font-size: 15px;
    line-height: 2;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    box-sizing: border-box;
    min-height: 280px;
    background: #fafbfc;
}

.input-group textarea:focus {
    outline: none;
    border-color: #4a90d9;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.1);
}

.input-group .char-count {
    display: block;
    text-align: right;
    font-size: 13px;
    color: #95a5a6;
    margin-top: 6px;
    padding-right: 4px;
}

/* ===== 按钮 ===== */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 25px 0 15px 0;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 14px 45px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 144, 217, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
    transform: translateY(-2px);
}

/* ===== 统计区域 ===== */
.stats-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 25px;
    background: linear-gradient(135deg, #f8f9fa, #eef1f5);
    border-radius: 12px;
    margin: 15px 0 25px 0;
}

.stats-header {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1a2332;
    padding: 8px 0 12px 0;
    border-bottom: 2px dashed #dde1e6;
}

.stats-body {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 10px 35px;
    background: white;
    border-radius: 10px;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-item .stat-label {
    display: block;
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

.stat-item .stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #1a2332;
    margin-top: 4px;
}

/* 风险等级颜色 */
.stat-value.high-risk {
    color: #dc3545;
}

.stat-value.medium-risk {
    color: #ffc107;
}

.stat-value.low-risk {
    color: #fd7e14;
}

.stat-value.safe {
    color: #28a745;
}

/* ===== 结果区域 ===== */
#resultsArea {
    margin-top: 30px;
    border-top: 3px solid #f0f2f5;
    padding-top: 25px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.results-header h3 {
    color: #1a2332;
    font-size: 22px;
    margin: 0;
}

/* ===== 图例 ===== */
.legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.legend-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.phrase-exact {
    background: #ff0000;
    border: 2px solid #ff0000;
}

.legend-color.word-approx {
    background: #0055ff;
    border: 2px solid #0055ff;
}

/* ===== 结果显示 ===== */
.highlighted-results {
    display: flex;
    gap: 30px;
    flex-wrap: nowrap;
}

.result-col {
    flex: 1;
    min-width: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8ecf0;
    overflow: hidden;
}

.result-col h4 {
    color: #2c3e50;
    margin: 0;
    padding: 14px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e8ecf0;
    font-size: 16px;
}

.text-display {
    padding: 20px 22px;
    max-height: 600px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 2.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

/* ===== 文字标色 ===== */
/* 完全匹配：红色 */
.text-display .phrase-exact {
    color: #ff0000 !important;
    font-weight: 700;
}

/* 近似匹配：相同词标蓝 */
.text-display .word-approx {
    color: #0055ff !important;
    font-weight: 700;
}

/* ===== 滚动条 ===== */
.text-display::-webkit-scrollbar {
    width: 6px;
}

.text-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.text-display::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 3px;
}

.text-display::-webkit-scrollbar-thumb:hover {
    background: #a0a8b0;
}

/* ===== 响应式 ===== */
@media (max-width: 992px) {
    .text-comparison-wrapper {
        padding: 20px;
    }
    .comparison-inputs {
        flex-direction: column;
        flex-wrap: wrap;
    }
    .input-group {
        min-width: unset;
    }
    .input-group textarea {
        min-height: 180px;
    }
    .highlighted-results {
        flex-direction: column;
        flex-wrap: wrap;
    }
    .result-col {
        min-width: unset;
    }
    .stats-area {
        gap: 10px;
    }
    .stats-body {
        gap: 15px;
    }
    .stat-item {
        min-width: 80px;
        padding: 8px 20px;
    }
    .stat-item .stat-value {
        font-size: 26px;
    }
}

@media (max-width: 600px) {
    .text-comparison-wrapper {
        padding: 12px;
    }
    .header h1 {
        font-size: 22px;
    }
    .btn-primary,
    .btn-secondary {
        padding: 12px 25px;
        font-size: 14px;
    }
    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .text-display {
        font-size: 14px;
        padding: 14px 16px;
        line-height: 2.2;
    }
    .stat-item .stat-value {
        font-size: 22px;
    }
    .stats-header {
        font-size: 14px;
    }
    .legend {
        flex-wrap: wrap;
        gap: 10px;
    }
}



/* ===== 下载按钮 ===== */
.btn-download {
    padding: 10px 30px;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.4);
}

/* ===== 结果头部操作区 ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}




/* ===== PDF 报告样式（打印/导出用） ===== */
#pdf-report-container {
    display: none;
}

.pdf-report-content {
    font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
    padding: 30px 35px;
    max-width: 1000px;
    margin: 0 auto;
    background: #ffffff;
}

.pdf-report-content .report-header {
    text-align: center;
    border-bottom: 3px solid #4a90d9;
    padding-bottom: 18px;
    margin-bottom: 25px;
}

.pdf-report-content .report-header h1 {
    color: #1a2332;
    font-size: 26px;
    margin: 0;
}

.pdf-report-content .report-header .sub {
    color: #7f8c8d;
    font-size: 13px;
    margin: 4px 0 0 0;
}

.pdf-report-content .report-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    background: #f8f9fa;
    padding: 18px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.pdf-report-content .report-stats .stat {
    text-align: center;
}

.pdf-report-content .report-stats .stat .label {
    font-size: 13px;
    color: #7f8c8d;
}

.pdf-report-content .report-stats .stat .value {
    font-size: 26px;
    font-weight: 700;
}

.pdf-report-content .report-stats .stat .value.high-risk {
    color: #dc3545;
}
.pdf-report-content .report-stats .stat .value.medium-risk {
    color: #ffc107;
}
.pdf-report-content .report-stats .stat .value.low-risk {
    color: #fd7e14;
}
.pdf-report-content .report-stats .stat .value.safe {
    color: #28a745;
}

.pdf-report-content .report-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 10px 0 20px 0;
}

.pdf-report-content .report-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
}

.pdf-report-content .report-legend .dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.pdf-report-content .report-legend .dot.red {
    background: #ff0000;
}
.pdf-report-content .report-legend .dot.blue {
    background: #0055ff;
}
.pdf-report-content .report-legend .dot.gray {
    background: transparent;
    border: 1px solid #ddd;
}

.pdf-report-content .report-section {
    margin-bottom: 25px;
}

.pdf-report-content .report-section h3 {
    background: #f0f2f5;
    padding: 10px 18px;
    border-radius: 6px;
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #1a2332;
}

.pdf-report-content .report-section .content {
    padding: 0 8px;
    font-size: 14px;
    line-height: 2.2;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1a2332;
}

.pdf-report-content .report-section .content .phrase-exact {
    color: #ff0000;
    font-weight: 700;
}

.pdf-report-content .report-section .content .word-approx {
    color: #0055ff;
    font-weight: 700;
}

.pdf-report-content .report-footer {
    text-align: center;
    border-top: 2px solid #f0f2f5;
    padding-top: 16px;
    margin-top: 25px;
    color: #95a5a6;
    font-size: 12px;
}