.collapse-indicator {
  transform: rotate(90deg);
}
.collapse-indicator {
  @apply absolute -left-6 top-2 cursor-pointer opacity-0 hover:opacity-100 h-5 w-6;
}
.collapse-indicator[data-hide] {
  transform: none;
  @apply opacity-100;
}

.ProseMirror pre,
.ProseMirror .inline-code {
  @apply bg-black bg-opacity-5 rounded-lg dark:bg-neutral-600 dark:bg-opacity-30 text-neutral-700 dark:text-neutral-200 pt-6 !important;
  font-family: "Helvetica", "Arial", sans-serif;
  tab-size: 2;
  font-variant-ligatures: normal;
}
.ProseMirror {
  font-size: 1.065rem;
  line-height: 1.5;
}
.ProseMirror a {
  @apply text-primary dark:text-primary !important;
}
.ProseMirror blockquote {
  @apply dark:border-neutral-700 dark:text-neutral-100;
}
.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4,
.ProseMirror h5,
.ProseMirror h6 {
  @apply dark:text-[color:var(--selected-dark-text)];
  margin-top: 1em !important;
  margin-bottom: 1em !important;
}
.ProseMirror p {
  @apply dark:text-[color:var(--selected-dark-text)];
}
.ProseMirror strong {
  color: inherit !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  @apply dark:text-[color:var(--selected-dark-text)];
}
.ProseMirror .mention {
  @apply py-0.5 px-1 rounded-md bg-primary text-primary bg-opacity-10 dark:text-primary hover:underline;
  cursor: pointer;
}

[dir="rtl"] .mention {
  display: inline-block;
  margin-left: 2px;
}

.ProseMirror .math-block {
  @apply dark:bg-neutral-800;
}
.math-node .math-src {
  @apply dark:text-purple-400 text-purple-500 !important;
}
img.ProseMirror-selectednode {
  @apply ring-2 ring-primary transition;
}

.ProseMirror {
  min-height: 400px;
  & > :first-child {
    margin-top: 0;
  }
  &:focus {
    outline: none;
  }
  li[data-checked="false"] {
    @apply dark:text-[color:var(--selected-dark-text)];
  }
  li[data-checked="true"] {
    @apply text-neutral-500 line-through dark:text-[color:var(--selected-dark-text)];
  }
  ul li {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    @apply pr-[1.25em] rtl:pr-[1.25em] !important;
    &::before {
      top: 0.45em !important;
    }
  }
  ol li {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    @apply pr-[1.25em] rtl:pr-[1.25em] !important;
  }
  li ul {
    margin-top: 0 !important;
  }
  ul[data-type="taskList"] {
    list-style: none;
    padding: 0;
    li {
      &::before {
        height: 0 !important;
        width: 0 !important;
      }
      > label {
        flex: 0 0 auto;
        margin-right: 0.5rem;
        user-select: none;
      }
      p {
        margin: 0;
      }
      input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        border: 2px solid #ccc;
        outline: none;
        cursor: pointer;
        transition: border-color 0.3s;
        transform: translateY(8px) translateX(-2px);
      }

      input[type="checkbox"]:checked {
        border-color: #fbbf24;
        background-color: #fbbf24;
      }

      /* Optional: You can add a custom background or other styles for the checked state */
      input[type="checkbox"]:checked::before {
        content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='M10.0007 15.1709L19.1931 5.97852L20.6073 7.39273L10.0007 17.9993L3.63672 11.6354L5.05093 10.2212L10.0007 15.1709Z' fill='rgba(255, 255, 255, 0.8)'%3E%3C/path%3E%3C/svg%3E");
        display: block;
        width: 100%;
        height: 100%;
        font-size: 16px;
        line-height: 20px;
        text-align: center;
        color: #fbbf24;
      }

      display: flex;
      align-items: flex-start;
      padding-left: 0 !important;
    }
  }
  .search-result {
    @apply bg-primary bg-opacity-20;

    &-current {
      @apply bg-secondary bg-opacity-50;
    }
  }
  .inline-code {
    @apply p-0.5 px-1 !important;
  }
  p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    @apply text-neutral-400 dark:text-neutral-700 float-left rtl:float-right;
    pointer-events: none;
    height: 0;
  }
  img {
    @apply rounded;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  .ProseMirror-selectednode {
    margin-top: 1em;
    margin-bottom: 1em;
    img {
      margin-top: 0 !important;
      margin-bottom: 0 !important;
    }
  }
  div:has(img) {
    margin-top: 1em;
    margin-bottom: 1em;
  }
}

/* Basic editor styles */
.tiptap {
  > * + * {
    margin-top: 0.75em;
  }

  table {
    @apply border-collapse table-fixed w-full overflow-hidden;

    td,
    th {
      @apply min-w-[1em] border-2 border-solid dark:border-neutral-600 p-3 box-border relative;
      word-wrap: break-word;
      max-width: 10px;
      text-align: initial; /* Reset text alignment */
    }

    th {
      @apply bg-neutral-700 bg-opacity-10 dark:bg-neutral-600 dark:bg-opacity-30 !important;
      text-align: initial; /* Reset text alignment */
    }

    .selectedCell:after {
      @apply bg-neutral-300 bg-opacity-20 content-[''] left-0 right-0 top-0 bottom-0 pointer-events-none absolute z-20;
    }

    /* Adjust padding for first child based on direction */
    td:first-child {
      @apply rtl:left-auto rtl:right-2; /* Adjust left and right properties for RTL */
    }

    .selectedCell:after {
      @apply absolute left-0 right-0 top-0 bottom-0 pointer-events-none;
    }

    .column-resize-handle {
      @apply absolute top-0 w-1 pointer-events-none;
    }
  }

  pre {
    background: #0d0d0d;
    color: #fff;
    font-family: var(--selected-font-code);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;

    code {
      color: inherit;
      padding: 0;
      background: none;
      font-size: 0.8rem;
    }
  }
}

.resize-cursor {
  cursor: ew-resize;
  cursor: col-resize;
}
.prose ul > li::before {
  @apply left-1 rtl:right-1;
}
.prose ol > li::before {
  @apply left-1 rtl:right-1;
}

.collapse-indicator {
  position: absolute;
  left: -30px; /* Adjust based on your layout */
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  transition: transform 0.3s;
}

mark {
  @apply bg-yellow-200 dark:bg-yellow-100 rounded;
}
