/* 文本差异分析器工具样式 */
.text-diff-tool {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 文本编辑器样式 */
.diff-textarea {
    border: none;
    border-radius: 0;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    background: #fafafa;
}

.diff-textarea:focus {
    box-shadow: none;
    background: #ffffff;
}

/* 工具栏样式 */
.text-toolbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px 6px 0 0;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.text-toolbar .btn {
    min-width: 80px;
}

/* 差异显示样式 */
.diff-container {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: auto;
    max-height: 500px;
}

.diff-line {
    padding: 0.25rem 0.5rem;
    border-left: 3px solid transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.diff-line-number {
    display: inline-block;
    width: 60px;
    text-align: right;
    margin-right: 1rem;
    color: #6c757d;
    font-size: 0.875rem;
    user-select: none;
}

.diff-line-content {
    display: inline-block;
    width: calc(100% - 70px);
}

/* 差异类型样式 */
.diff-added {
    background-color: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.diff-removed {
    background-color: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.diff-modified {
    background-color: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.diff-unchanged {
    background-color: #ffffff;
    color: #495057;
}

.diff-context {
    background-color: #e9ecef;
    color: #6c757d;
}

/* 并排对比样式 */
.diff-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #dee2e6;
}

.diff-side-column {
    background: #ffffff;
}

.diff-side-column-left {
    border-right: 2px solid #28a745;
}

.diff-side-column-right {
    border-left: 2px solid #dc3545;
}

/* 行内对比样式 */
.diff-inline {
    font-family: monospace;
}

.diff-inline-added {
    background-color: #d4edda;
    text-decoration: underline;
    text-decoration-color: #28a745;
    text-decoration-style: wavy;
}

.diff-inline-removed {
    background-color: #f8d7da;
    text-decoration: line-through;
    text-decoration-color: #dc3545;
}

/* 统计信息样式 */
.diff-stats {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.diff-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.diff-stat-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.diff-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
}

.diff-stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

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

.diff-stat-removed .diff-stat-value {
    color: #dc3545;
}

.diff-stat-modified .diff-stat-value {
    color: #ffc107;
}

.diff-stat-unchanged .diff-stat-value {
    color: #6c757d;
}

/* 差异摘要样式 */
.diff-summary {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.diff-summary h6 {
    color: #1976d2;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.diff-summary .badge {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

/* 高亮差异样式 */
.diff-highlight {
    background-color: #ffeb3b;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: bold;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .diff-side-by-side {
        grid-template-columns: 1fr;
    }

    .diff-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .diff-stat-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .diff-textarea {
        font-size: 13px;
    }

    .diff-line-number {
        width: 40px;
        font-size: 0.75rem;
        margin-right: 0.5rem;
    }

    .diff-line-content {
        width: calc(100% - 50px);
    }

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

    .diff-stat-value {
        font-size: 1.1rem;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .text-diff-tool {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .diff-textarea {
        background: #2d3748;
        color: #e9ecef;
    }

    .text-toolbar {
        background: #2d3748;
        border-color: #4a5568;
    }

    .diff-container {
        background: #2d3748;
        border-color: #4a5568;
    }

    .diff-line-number {
        color: #a0aec0;
    }

    .diff-added {
        background-color: #22543d;
        color: #9ae6b4;
    }

    .diff-removed {
        background-color: #542d2d;
        color: #feb2b2;
    }

    .diff-modified {
        background-color: #54542d;
        color: #faf089;
    }

    .diff-unchanged {
        background-color: #2d3748;
        color: #e9ecef;
    }

    .diff-context {
        background-color: #4a5568;
        color: #a0aec0;
    }

    .diff-stats {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #e2e8f0;
    }

    .diff-stat-item {
        background: rgba(255, 255, 255, 0.1);
    }

    .diff-summary {
        background: #1e3a8a;
        border-color: #3730a3;
    }
}

/* 打印样式 */
@media print {
    .text-toolbar,
    .card-header,
    footer {
        display: none !important;
    }

    .diff-container {
        max-height: none;
        overflow: visible;
        border: 1px solid #000;
    }

    .diff-line {
        page-break-inside: avoid;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .diff-added {
        background-color: #000;
        color: #fff;
        border-left-color: #fff;
    }

    .diff-removed {
        background-color: #000;
        color: #fff;
        border-left-color: #fff;
        text-decoration: line-through;
    }

    .diff-modified {
        background-color: #000;
        color: #fff;
        border-left-color: #fff;
        border-style: dashed;
    }
}

/* 加载动画 */
.diff-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.diff-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态样式 */
.diff-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.diff-empty i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.diff-empty h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.diff-empty p {
    font-size: 0.875rem;
    margin: 0;
}