/* ── Diff page layout ────────────────────────────────────────────── */

.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.diff-column {
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

html[data-theme="light"] .diff-column {
    border-color: var(--border-light);
}

.diff-column-header {
    background: var(--accent-dark);
    color: var(--text-primary-dark);
    padding: 8px 16px;
    font-weight: bold;
    font-size: 0.9em;
    border-bottom: 1px solid var(--border-dark);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html[data-theme="light"] .diff-column-header {
    background: var(--accent-light);
    color: var(--text-primary-light);
    border-bottom-color: var(--border-light);
}

.diff-column-content {
    padding: 16px 20px;
    font-size: 0.92em;
    line-height: 1.7;
    overflow-x: auto;
}

/* ── Inline word highlights ──────────────────────────────────────── */

.diff-remove {
    background: rgba(220, 53, 53, 0.25);
    color: #ff8080;
    border-radius: 2px;
    padding: 0 1px;
    text-decoration: line-through;
    text-decoration-color: rgba(220, 53, 53, 0.6);
}

html[data-theme="light"] .diff-remove {
    background: rgba(220, 53, 53, 0.12);
    color: #c0392b;
    text-decoration-color: rgba(192, 57, 43, 0.5);
}

.diff-add {
    background: rgba(39, 174, 96, 0.25);
    color: #80e0a0;
    border-radius: 2px;
    padding: 0 1px;
}

html[data-theme="light"] .diff-add {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

/* ── Legend ─────────────────────────────────────────────────────── */

.diff-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 0.9em;
}

.diff-remove-sample {
    background: rgba(220, 53, 53, 0.25);
    color: #ff8080;
    padding: 2px 8px;
    border-radius: 2px;
    text-decoration: line-through;
}

html[data-theme="light"] .diff-remove-sample {
    background: rgba(220, 53, 53, 0.12);
    color: #c0392b;
}

.diff-add-sample {
    background: rgba(39, 174, 96, 0.25);
    color: #80e0a0;
    padding: 2px 8px;
    border-radius: 2px;
}

html[data-theme="light"] .diff-add-sample {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

/* ── Diff meta panel ─────────────────────────────────────────────── */

.diff-meta-cols {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.diff-arrow {
    font-size: 1.4em;
    color: var(--text-secondary-dark);
}

html[data-theme="light"] .diff-arrow {
    color: var(--text-secondary-light);
}

/* ── History / version shared ────────────────────────────────────── */

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
}

.history-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--link-dark);
    color: var(--text-primary-dark);
    font-weight: 600;
    transition: border-color 0.3s ease, color 0.3s ease;
}

html[data-theme="light"] .history-table th {
    border-bottom-color: var(--link-light);
    color: var(--text-primary-light);
}

.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-secondary-dark);
    vertical-align: top;
    transition: border-color 0.3s ease, color 0.3s ease;
}

html[data-theme="light"] .history-table td {
    border-bottom-color: var(--border-light);
    color: var(--text-secondary-light);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.date-cell {
    white-space: nowrap;
}

.action-cell {
    white-space: nowrap;
}

.history-nav {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-dark);
    transition: border-color 0.3s ease;
}

html[data-theme="light"] .history-nav {
    border-top-color: var(--border-light);
}

.version-banner {
    background: var(--accent-dark);
    border-left: 4px solid var(--link-dark);
    padding: 10px 16px;
    margin-bottom: 24px;
    font-size: 0.9em;
    color: var(--text-secondary-dark);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html[data-theme="light"] .version-banner {
    background: var(--accent-light);
    border-left-color: var(--link-light);
    color: var(--text-secondary-light);
}

.version-links {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.9em;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .diff-container {
        grid-template-columns: 1fr;
    }

    .diff-column-old {
        border-bottom: none;
        border-radius: 4px 4px 0 0;
    }

    .diff-column-new {
        border-radius: 0 0 4px 4px;
    }

    .history-table {
        font-size: 0.85em;
    }

    .history-table th:nth-child(3),
    .history-table td:nth-child(3) {
        display: none;
    }
}

@media print {
    .diff-container {
        grid-template-columns: 1fr 1fr;
    }

    .history-nav {
        display: none;
    }
}