/* ── 文本对比 专题页样式 ── */

/* ── 输入区域 ── */
.diff-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.diff-input-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.diff-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}

.diff-textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Fira Code', 'Noto Sans SC', monospace;
    line-height: 1.6;
    resize: vertical;
    background: #fafafa;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.diff-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    background: white;
}

/* ── 对比统计 ── */
.diff-summary {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.7rem 1rem;
    background: #f8f9fb;
    border: 1px solid #e8eaf0;
    border-radius: 8px;
    flex-wrap: wrap;
}

.diff-stat {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.diff-stat-add strong { color: #059669; }
.diff-stat-del strong { color: #dc2626; }
.diff-stat-mod strong { color: #d97706; }
.diff-stat-eq strong { color: #666; }

.diff-stat::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.diff-stat-add::before { background: #d1fae5; border: 1px solid #059669; }
.diff-stat-del::before { background: #fee2e2; border: 1px solid #dc2626; }
.diff-stat-mod::before { background: #fef3c7; border: 1px solid #d97706; }
.diff-stat-eq::before { background: #f0f0f0; border: 1px solid #ccc; }

/* ── 对比结果 ── */
.diff-result {
    margin-top: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.diff-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.diff-result-col {
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
}

.diff-result-col:first-child {
    border-right: 1px solid #e0e0e0;
}

/* 行样式 */
.diff-line {
    display: flex;
    min-height: 1.6em;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line-num {
    min-width: 36px;
    padding: 0 6px;
    text-align: right;
    color: #aaa;
    background: rgba(0,0,0,0.02);
    border-right: 1px solid #e8eaf0;
    user-select: none;
    flex-shrink: 0;
    font-size: 0.78rem;
}

.diff-line-text {
    padding: 0 8px;
    flex: 1;
}

/* 差异颜色 */
.diff-line.diff-add {
    background: #d1fae5;
}

.diff-line.diff-add .diff-line-num {
    background: #a7f3d0;
    color: #065f46;
}

.diff-line.diff-del {
    background: #fee2e2;
}

.diff-line.diff-del .diff-line-num {
    background: #fecaca;
    color: #991b1b;
}

.diff-line.diff-mod {
    background: #fef3c7;
}

.diff-line.diff-mod .diff-line-num {
    background: #fde68a;
    color: #92400e;
}

.diff-line.diff-empty {
    background: #f5f5f5;
}

.diff-line.diff-empty .diff-line-num {
    background: #eee;
}

/* 行内差异高亮 */
.diff-inline-add {
    background: #6ee7b7;
    border-radius: 2px;
}

.diff-inline-del {
    background: #fca5a5;
    border-radius: 2px;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .diff-input-grid {
        grid-template-columns: 1fr;
    }

    .diff-result-grid {
        grid-template-columns: 1fr;
    }

    .diff-result-col:first-child {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
}
