/*
 * Dialog "Was ist neu" of the CFML apps (markup: cf-shared/ui/changelog).
 *
 * A native <dialog>, so it needs no framework: focus trap, Escape and the top layer come from
 * the browser. Colours follow Bootstrap's tokens where the page has them - including its dark
 * mode via data-bs-theme - and fall back to the system colours otherwise. An app with its own
 * palette sets them through the argument cssClass.
 */
.cf-changelog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--bs-border-color, rgba(127, 127, 127, 0.35));
  border-radius: 12px;
  background: var(--bs-body-bg, Canvas);
  color: var(--bs-body-color, CanvasText);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  line-height: 1.5;
}

.cf-changelog[open] {
  display: flex;
  flex-direction: column;
}

.cf-changelog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* While the dialog is open the page behind it does not scroll along. */
html:has(.cf-changelog[open]) {
  overflow: hidden;
}

.cf-changelog-head,
.cf-changelog-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 16px 20px;
}

.cf-changelog-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--bs-border-color, rgba(127, 127, 127, 0.25));
}

.cf-changelog-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--bs-border-color, rgba(127, 127, 127, 0.25));
}

.cf-changelog-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.cf-changelog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 20px;
}

.cf-changelog-entry {
  padding: 14px 0;
}

.cf-changelog-entry + .cf-changelog-entry {
  border-top: 1px solid var(--bs-border-color, rgba(127, 127, 127, 0.2));
}

.cf-changelog-entry-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}

.cf-changelog-entry-title time {
  margin-left: 0.4em;
  font-size: 0.85em;
  font-weight: 400;
  opacity: 0.7;
}

.cf-changelog-entry-title time:only-child {
  margin-left: 0;
  font-size: inherit;
  font-weight: inherit;
  opacity: 1;
}

.cf-changelog-entry ul {
  margin: 0;
  padding-left: 1.25em;
}

.cf-changelog-entry li {
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.cf-changelog-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.cf-changelog-x:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.15);
}

.cf-changelog-btn {
  min-height: 40px;
  padding: 6px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--bs-primary, #0d6efd);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.cf-changelog-btn:hover {
  filter: brightness(1.1);
}

.cf-changelog-x:focus-visible,
.cf-changelog-btn:focus-visible {
  outline: 2px solid var(--bs-primary, #0d6efd);
  outline-offset: 2px;
}

@media print {
  .cf-changelog {
    display: none;
  }
}
