/* Tekstsammenligning – side-ved-side diff (Bootstrap 5.2-kompatibel) */

.text-diff-inputs .form-control {
  min-height: 14rem;
}

.text-diff-result-wrap {
  overflow-x: auto;
}

.text-diff-table {
  font-size: 0.8125rem;
  table-layout: fixed;
}

.text-diff-table th,
.text-diff-table td {
  vertical-align: top;
  word-break: break-word;
}

.text-diff-table .diff-num {
  width: 2.75rem;
  max-width: 2.75rem;
  text-align: right;
  color: var(--bs-secondary);
  user-select: none;
  white-space: nowrap;
}

.text-diff-table .diff-line {
  font-family: var(--bs-font-monospace);
}

/* Høyere spesifisitet + !important slår Bootstrap .table sine cellebakgrunner */
.text-diff-table > tbody > tr > td.diff-line--equal {
  background-color: rgba(25, 135, 84, 0.1) !important;
}

.text-diff-table > tbody > tr > td.diff-line--removed {
  background-color: rgba(220, 53, 69, 0.14) !important;
}

.text-diff-table > tbody > tr > td.diff-line--added {
  background-color: rgba(13, 110, 253, 0.12) !important;
}

.text-diff-table > tbody > tr > td.diff-line--empty {
  background-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--equal,
html[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--equal {
  background-color: rgba(25, 135, 84, 0.32) !important;
}

[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--removed,
html[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--removed {
  background-color: rgba(220, 53, 69, 0.35) !important;
}

[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--added,
html[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--added {
  background-color: rgba(13, 110, 253, 0.32) !important;
}

[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--empty,
html[data-theme="dark"] .text-diff-table > tbody > tr > td.diff-line--empty {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.text-diff-table thead.text-diff-thead th {
  background-color: var(--bs-gray-100);
  color: var(--bs-body-color);
}

[data-theme="dark"] .text-diff-table thead.text-diff-thead th,
html[data-theme="dark"] .text-diff-table thead.text-diff-thead th {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--bs-body-color, #dee2e6);
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Reservert plass for AdSense i fullskjerm (fylles ved første åpning) */
.text-diff-modal-ad-slot {
  flex-shrink: 0;
}

.diff-legend-swatch {
  width: 0.65rem;
  height: 0.65rem;
  vertical-align: middle;
  margin-right: 0.15rem;
}

.diff-legend-swatch--equal {
  background-color: rgba(25, 135, 84, 0.35);
}

.diff-legend-swatch--removed {
  background-color: rgba(220, 53, 69, 0.45);
}

.diff-legend-swatch--added {
  background-color: rgba(13, 110, 253, 0.4);
}

[data-theme="dark"] .diff-legend-swatch--equal,
html[data-theme="dark"] .diff-legend-swatch--equal {
  background-color: rgba(25, 135, 84, 0.55);
}

[data-theme="dark"] .diff-legend-swatch--removed,
html[data-theme="dark"] .diff-legend-swatch--removed {
  background-color: rgba(220, 53, 69, 0.55);
}

[data-theme="dark"] .diff-legend-swatch--added,
html[data-theme="dark"] .diff-legend-swatch--added {
  background-color: rgba(13, 110, 253, 0.5);
}

/* Stor visning (modal): mer høyde til tekstfelt */
.text-diff-modal-body #text-diff-workspace .text-diff-inputs .form-control {
  min-height: min(38vh, 22rem);
}

.text-diff-modal-body #text-diff-workspace .text-diff-result-wrap {
  max-height: min(45vh, 24rem);
  overflow: auto;
}

@media (min-width: 992px) {
  .text-diff-modal-body #text-diff-workspace .text-diff-inputs .form-control {
    min-height: min(32vh, 20rem);
  }

  .text-diff-modal-body #text-diff-workspace .text-diff-result-wrap {
    max-height: none;
    overflow-x: auto;
  }
}
