/* diff.css - Scope all styles under .diff-app to prevent side effects on other pages */

.diff-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2d3748;
    max-width: 900px;
    margin: 10px auto 30px auto;
    padding: 0 10px;
}

.diff-app * {
    box-sizing: border-box;
}

/* Header Banner */
.diff-app .diff-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 24px 28px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(30, 58, 138, 0.25);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.diff-app .diff-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.diff-app .diff-header-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 4px 0 0 0;
}

/* Main Card Container */
.diff-app .diff-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #edf2f7;
    margin-bottom: 24px;
}

/* Input Columns Grid */
.diff-app .diff_inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.diff-app .diff_col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.diff-app .diff-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.diff-app .diff-col-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.diff-app .diff-col-stats {
    font-size: 0.775rem;
    color: #64748b;
}

.diff-app .diff_col textarea {
    width: 100%;
    min-height: 240px;
    padding: 12px 14px;
    font-family: SFMono-Regular, Consolas, Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
    resize: vertical;
    transition: all 0.2s ease;
}

.diff-app .diff_col textarea:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Actions Controls Toolbar */
.diff-app .diff_controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 0 20px 0;
    flex-wrap: wrap;
}

.diff-app .diff-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.diff-app #diff_button {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.diff-app #diff_button:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.diff-app .diff-btn-secondary {
    color: #475569;
    background: #edf2f7;
}

.diff-app .diff-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.diff-app .diff-btn-outline {
    background: transparent;
    border: 1px solid #cbd5e0;
    color: #4a5568;
}

.diff-app .diff-btn-outline:hover {
    background: #f7fafc;
    border-color: #a0aec0;
}

/* Diff Results Styling */
.diff-app .diff_summary,
.diff-app .diff_same,
.diff-app .diff_error {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.diff-app .diff_summary {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.diff-app .diff_same {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.diff-app .diff_error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    white-space: pre-wrap;
}

/* Diff Table Container & Wrapper */
.diff-app .diff-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    margin: 16px 0;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.diff-app .diff_table {
    width: 100%;
    min-width: 600px;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    font-family: SFMono-Regular, Consolas, Monaco, monospace;
    font-size: 0.85rem;
}

.diff-app .diff_col_no {
    width: 50px;
}

.diff-app .diff_col_text {
    width: calc(50% - 50px);
}

.diff-app .diff_table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid #cbd5e1;
    border-right: 1px solid #e2e8f0;
    text-align: left;
}

.diff-app .diff_table th:last-child {
    border-right: none;
}

.diff-app .diff_table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    line-height: 1.5;
}

.diff-app .diff_table tr:last-child td {
    border-bottom: none;
}

.diff-app .diff_no {
    width: 50px;
    text-align: right;
    color: #94a3b8;
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    user-select: none;
    font-size: 0.8rem;
}

.diff-app .diff_text {
    white-space: pre-wrap;
    word-break: break-all;
    border-right: 1px solid #e2e8f0;
}

.diff-app .diff_text:last-child {
    border-right: none;
}

/* Specific Cell Highlighting */
/* Equal: Clean white background */
.diff-app .diff_row_equal td.diff_text {
    background-color: #ffffff;
}

/* Insert: New cell green highlight, Old cell muted empty */
.diff-app .diff_row_insert td.diff_cell_new {
    background-color: #dcfce7;
    color: #14532d;
}
.diff-app .diff_row_insert td.diff_cell_old {
    background-color: #f8fafc;
}

/* Delete: Old cell red highlight, New cell muted empty */
.diff-app .diff_row_delete td.diff_cell_old {
    background-color: #fee2e2;
    color: #7f1d1d;
}
.diff-app .diff_row_delete td.diff_cell_new {
    background-color: #f8fafc;
}

/* Change: Old cell red highlight, New cell green highlight */
.diff-app .diff_row_change td.diff_cell_old {
    background-color: #fee2e2;
    color: #7f1d1d;
}
.diff-app .diff_row_change td.diff_cell_new {
    background-color: #dcfce7;
    color: #14532d;
}

/* Unified Diff Box */
.diff-app .diff-unified-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    margin-bottom: 8px;
}

.diff-app .diff_unified {
    background-color: #0f172a;
    color: #38bdf8;
    padding: 16px 18px;
    border-radius: 10px;
    font-family: SFMono-Regular, Consolas, Monaco, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 0;
}

/* Related Tools Section */
.diff-app .diff-related-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #edf2f7;
}

.diff-app .diff-related-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.diff-app .diff-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.diff-app .diff-related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.diff-app .diff-related-item:hover {
    border-color: #3b82f6;
    color: #1d4ed8;
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* Toast */
.diff-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #2d3748;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 9999;
}

.diff-toast.show {
    opacity: 1;
    transform: translateY(0);
}
