.tiptap-editor {
  /* --tiptap-editor-border-color: transparent; */
  /* --body-bg, --body-fg, --border-color and --primary are used in the Django admin CSS */
  --_b: var(--tiptap-editor-background, var(--body-bg, #fff));
  --_f: var(--tiptap-editor-foreground, var(--body-fg, #333));
  --_r: var(--tiptap-editor-border-color, var(--border-color, #ccc));
  --_a: var(--tiptap-editor-active-color, var(--primary, #79aec8));
  --_d: var(--tiptap-editor-disabled-color, var(--border-color, #ccc));
  --_t: var(--tiptap-editor-typographic, #ccc);
}

.w-1 {
  width: 1.5rem;
}

.h-1 {
  height: 1.5rem;
}

.text-black {
  color: black;
  font-size: 16px !important;
}

.display-flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.flex-align-center {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.flex-direction-row {
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
}

.flex-direction-column {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}

.flex-content-space-between {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.the-editor-area {
  display: flex;
  flex-direction: column;
  resize: vertical;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: fit-content;
  max-width: 65vw;
  background: white;
  position: relative;
}

.the-editor-area::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='width:24px;height:24px' viewBox='0 0 24 24'%3E%3Cpath d='M22,22H20V20H22V22M22,18H20V16H22V18M18,22H16V20H18V22M18,18H16V16H18V18M14,22H12V20H14V22M22,14H20V12H22V14Z' /%3E%3C/svg%3E");
  position: absolute;
  color: white;
  bottom: 0;
  right: 0;
  width: 1em;
  height: 1em;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: scale(2) translate(-12px, -2px);
  font-size: 1.3em;
}

.tiptap-editor.form-control {
  height: auto !important;
}

.the-editor-area::-webkit-resizer {
  transform: scale(3);
}

.editor-content-rendered {
  /* max-height: 85vh; */
  overflow-y: auto;
}

.editor-content-rendered.jinjaSyntaxHighlightActivated .jinja-syntax {
  background: rgba(0, 255, 0, 0.205) !important;
  border-bottom: 1px solid rgb(0, 38, 255) !important;
  margin-bottom: -1px !important;
}

.menubar {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}

.menubar__group {
  display: flex;
  border: 1px solid var(--_r);
  border-radius: 9999px;
  padding: 2px;
}

.menubar__group:not(.menubar__group:has(button)) {
  display: none !important;
}

.menubar.show {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  /* justify-content: center; */
  /* border-bottom: 1px dashed var(--_r); */
  padding: 0.5rem 0 0.875rem 0;
}

.menubar__group button {
  cursor: pointer;
  width: 1.75em;
  height: 1.75em;
  transition: all 0.25s;
  background: var(--_b);
  color: var(--_f);
  border: none;
  display: inline-flex;
  position: relative;
  align-items: center;
  text-align: center;
  margin-left: 2px;
  margin-right: 2px;
  padding-inline: 0.125em;
}

.menubar__group button:first-child {
  margin-left: 0;
  margin-right: 2px;
  padding-left: 5px;
  width: 100%;
  border-top-left-radius: 9999px;
  border-bottom-left-radius: 9999px;
}

.menubar__group button:last-child {
  margin-left: 2px;
  margin-right: 0;
  padding-right: 5px;
  width: 100%;
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
}

.menubar__group button+button {
  border-left: none;
}


.menubar button:hover {
  filter: brightness(110%);
  background-color: #cbcbcb;
}

.menubar button.disabled:hover {
  cursor: not-allowed;
}

.menubar button.disabled svg {
  color: #A0A0A0;
}

.menubar button.is-active {
  background-color: black;
}

.menubar button.is-active svg {
  color: white;
}

.menubar button[id$="-addTable"] svg {
  transform: translateY(2px);
}

.menubar button[id$="-addTable"]:hover .table-config {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  cursor: initial;
}

.menubar button[id$="-addTable"]:hover .table-config .add-table-button {
  font-size: 1.2rem;
  margin: 5px 0 5px 0;
  background-color: black;
  cursor: pointer;
  border-radius: 6px;
  color: white;
  padding: 4px;
}

.menubar button[id$="-addTable"] .table-config {
  display: none;
  position: absolute;
  background-color: white;
  z-index: 10000;
  -webkit-box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3);
  padding: 1em;
  border-radius: 4px;
  transform: translate(-1em, 0);
}

.menubar button[id$="-addTable"] .table-config input {
  height: 1.5rem;
  border-radius: 6px;
  border: 2px solid grey;
  font-size: 1.2rem;
  min-width: 100px;
  padding: 4px;
}

.menubar button[id$="-addTable"] .table-config input:first-of-type {
  margin-right: 4px;
}

.menubar button[id$="-addTable"] .table-config input:last-of-type {
  margin-left: 4px;
}

.menubar button[id$="-addTable"] .table-config .inputs-container {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  margin-bottom: 1em;
}

.table-dimension-input {
  width: 40%;
}

.menubar button[id$="-addTable"] .table-config .inputs-container .table-dimension-input {
  color: black;
  background-color: white;
}

.not-saved-text {
  display: none;
}

.not-saved-text.show {
  display: inline;
  color: #ee0e29;
  font-weight: bold;
  font-size: 1.3em;
  height: 100%;
  align-self: center;
  margin: 0 0 0 0.5rem;
}

.not-saved-text-spacer {
  display: none;
}

.not-saved-text-spacer.show {
  display: block;
}

.ProseMirror {
  height: 100%;
  color: black !important;
  padding: .25em .5em;
  outline: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  margin: 0 !important;
}

.ProseMirror * {
  color: black !important;
}

.ProseMirror p {
  font-size: 16px !important;
}

.ProseMirror h1 {
  display: block !important;
  font-size: 2em !important;
  margin-block-start: 0.67em !important;
  margin-block-end: 0.67em !important;
  margin-inline-start: 0px !important;
  margin-inline-end: 0px !important;
  font-weight: bold !important;
}

.ProseMirror h2 {
  padding: 0;
  display: block !important;
  font-size: 1.5em !important;
  margin-block-start: 0.83em !important;
  margin-block-end: 0.83em !important;
  margin-inline-start: 0px !important;
  margin-inline-end: 0px !important;
  font-weight: bold !important;
  background: white !important;
}

.ProseMirror h3 {
  display: block !important;
  font-size: 1.17em !important;
  margin-block-start: 1em !important;
  margin-block-end: 1em !important;
  margin-inline-start: 0px !important;
  margin-inline-end: 0px !important;
  font-weight: bold !important;
  padding: 0 !important;
}

.ProseMirror>*+* {
  margin-top: 0.75em;
}

.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #a8a8a8;
  pointer-events: none;
  height: 0;
}

.ProseMirror ol {
  padding-left: 0px !important;
  list-style-type: decimal !important;
}

.ProseMirror ol li::marker {
  font-size: 16px !important;
}

.ProseMirror ol>li>ol {
  padding-left: 10px !important;
  margin-left: 10px !important;
  list-style-type: lower-latin !important;
}

.ProseMirror ol>li>ol>li>ol {
  padding-left: 10px !important;
  margin-left: 10px !important;
  list-style-type: lower-roman !important;
}

.ProseMirror ol>li>ol>li>ol>li>ol {
  padding-left: 10px !important;
  margin-left: 10px !important;
  list-style-type: upper-latin !important;
}

.ProseMirror ol>li>ol>li>ol>li>ol>li>ol {
  padding-left: 10px !important;
  margin-left: 10px !important;
  list-style-type: upper-roman !important;
}

.ProseMirror ul {
  list-style-type: disc !important;
  margin-block-start: 0 !important;
  margin-block-end: 0 !important;
  margin-inline-start: 0px !important;
  margin-inline-end: 0px !important;
}

.ProseMirror ul li {
  list-style: disc !important;
}

.ProseMirror ul>li>ul {
  padding-left: 10px !important;
  margin-left: 10px !important;
  list-style-type: disc !important;
}

.ProseMirror {
  margin: 1rem 0;
}

.ProseMirror>*+* {
  margin-top: 0.75em;
}

.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4,
.ProseMirror h5,
.ProseMirror h6 {
  line-height: 1.1;
  text-transform: none;
  padding: 0;
}

.ProseMirror pre {
  background: #0d0d0d !important;
  color: #fff !important;
  font-family: "JetBrainsMono", monospace !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.5rem !important;
}

.ProseMirror pre code {
  color: #fff !important;
  padding: 0 !important;
  background: none !important;
  font-size: 0.8rem !important;
}

.ProseMirror img {
  max-width: 100%;
  height: auto;
}

.ProseMirror blockquote {
  padding-left: 1rem;
  border-left: 2px solid rgba(13, 13, 13, 0.1);
}

.ProseMirror hr {
  border: none;
  border-top: 2px solid rgba(13, 13, 13, 0.1);
  margin: 2rem 0;
}

.ProseMirror a {
  text-decoration: underline;
}

/* Table-specific styling */
.ProseMirror table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.ProseMirror table td,
.ProseMirror table th,
.ProseMirror table[show_borders="false"]:hover td,
.ProseMirror table[show_borders="false"]:hover th {
  min-width: 1em;
  border: 2px solid #ccc;
  padding: 3px 5px;
  vertical-align: top;
  box-sizing: border-box;
  position: relative;
}

.ProseMirror table[show_borders="false"] td,
.ProseMirror table[show_borders="false"] th {
  border: none;
  box-sizing: border-box;
}

.ProseMirror table td>*,
.ProseMirror table th>* {
  margin-bottom: 0;
}

.ProseMirror table th {
  font-weight: bold;
  text-align: left;
  background-color: #f1f3f5;
}

.ProseMirror tr {
  background-color: white !important;
}

.ProseMirror table .selectedCell:after {
  z-index: 2;
  position: absolute;
  content: "";
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(200, 200, 255, 0.4);
  pointer-events: none;
}

.ProseMirror table .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: -2px;
  width: 4px;
  background-color: #adf;
  pointer-events: none;
}

.tableWrapper {
  overflow-x: auto;
}

.resize-cursor {
  cursor: ew-resize;
  cursor: col-resize;
}

div[data-tippy-root] {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

.selectedCell:after {
  z-index: 2;
  position: absolute;
  content: "";
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(200, 200, 255, 0.4);
  pointer-events: none;
}

.column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: -2px;
  width: 4px;
  background-color: #adf;
  pointer-events: none;
  cursor: col-resize !important;
}

.tableWrapper {
  padding: 1rem 0;
  overflow-x: auto;
}

.ProseMirror.resize-cursor {
  cursor: ew-resize !important;
  cursor: col-resize !important;
}

.spacer {
  height: 100%;
  border-right: 1px dotted grey;
  margin: 0 4px 0 5px;
}
