/* Fix CkEditor Style Dropdown width */
.cke.cke_combopanel {
  min-width: 300px;
  max-width: 600px;
}

.js .cke.cke_combopanel {
  width: auto;
}

/* fix fieldset labels in the ckeditor dialog */
.cke_dialog .cke_dialog_ui_fieldset > legend {
  position: inherit;
  top: 0;
}

/* Hide the second Anchor link ID select because it is redundant */
.cke_dialog table[style*='width:260px;'] .cke_dialog_ui_hbox_last {
  display: none;
}

/* Hide the CkEditor diff author row */
.diff th.author {
  display: none;
}

.cke_dialog_contents {
  width: 100%;
  min-width: 300px;
}

/* Replace the button icon for url_embed. */
.ck.ck-toolbar button[data-cke-tooltip-text="Url Embed"] {
  background-image: url("../images/url_embed.svg");
  background-repeat: no-repeat;
}

.ck.ck-button[data-cke-tooltip-text="Url Embed"]:not(.ck-disabled):hover {
  background-image: url("../images/url_embed.svg");
  background-repeat: no-repeat;
}

button[data-cke-tooltip-text="Url Embed"] svg {
  display: none;
}

.ck.ck-balloon-panel {
  z-index: auto !important;
}

/* Warning color */
.ck.ck-content {
  --warning-color: #950404;

  :where(h1, h2, h3, h4, h5, h6):has(> br[data-cke-filler]),
  a:empty {
    position: relative;
    box-shadow: 0 0 0 1px #fff;
    outline: dashed 1px var(--warning-color);

    &::after {
      position: absolute;
      top: 0;
      right: 0;
      padding: .125rem .25rem;
      background-color: var(--warning-color);
      color: #fff;
      content: "❕ Headings must have content";
      font-size: 16px;
      font-weight: normal;
      transform: translateY(-100%);
    }
  }

  a:empty {
    min-height: 1.5em;
    min-width: 3em;
    display: inline-block;

    &::after {
      content: "❕ Links must have content";
      left: 0;
      right: auto;
      width: max-content;
    }
  }
}
