html {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

body {
  height: 100%;
}

.pointer {
  cursor: pointer;
}

.grab {
  cursor: grab;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.gap-3 {
  gap: 1.5rem;
}

@media (max-width: 576px) {
  .flex-fill-child > * {
    flex: 1 1 auto !important;
  }
}

:disabled, .disabled {
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

thead th,
legend,
label {
  font-family: var(--font-medium);
}

strong,
b,
.font-weight-bold {
  font-family: var(--font-semibold);
}

a.btn:not(.btn-link) {
  text-decoration: none;
}

.tabs > .card-header {
  border-bottom: 1px solid var(--extra-light) !important;
  padding-top: 0 !important;
  padding-left: 0.8rem !important;
  padding-right: 0.8rem !important;

  .card-header-tabs {
    border-bottom: 0 !important;
  }
}

.card-header {
  .nav-item {
    font-family: var(--font-medium) !important;
    margin-bottom: 0 !important;

    .nav-link {
      padding: 0.5rem !important;

      &:not(.active):not(.disabled) {
        color: var(--dark) !important;
      }
    }
  }
}

.b-form-tag {
  align-items: center !important;
}

// Used for back button
.back {
  &:hover {
    text-decoration: none;

    .back-icon {
      transition: transform 0.3s ease-out;
      transform: translateX(-4px);
    }
  }
}

[dir="rtl"] {
  .back {
    .back-icon {
      display: none;
    }
  }
}

.table.b-table {
  th {
    white-space: nowrap;
  }

  tr {
    &:first-child td {
      border: none;
    }

    th {
      border: 0;
    }
  }
}

fieldset.required {
  legend > div:first-child > span:first-child::after {
    content: "*";
    color: var(--danger);
  }
}

// Padding because of toolbar
.b-toaster.b-toaster-bottom-right {
  bottom: 75px;
}

// Fixes dropdowns in scrollable modals
.modal-dialog-scrollable .modal-content {
  overflow: initial;
}

.dropdown-menu * {
  font-family: var(--font-regular) !important;

  .dropdown-item {
    outline: none !important;

    * {
      border: 0 !important;
      box-shadow: none !important;
      background-color: transparent !important;
    }

    &:active * {
      color: var(--white) !important;
    }
  }
}

.vue-grid-layout {
  transition: none !important;
}

.vue-grid-item {
  transition: none !important;
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--secondary);
  background-clip: content-box;
  border: 3px solid transparent;
  border-radius: 7px;

  &:hover {
    background-color: var(--primary);
  }
}

::-webkit-scrollbar-corner {
  background: transparent;
}

.sidebar-spacer {
  min-width: 0px;
  transition: min-width 0.15s ease-in-out;

  &.expanded {
    min-width: calc(var(--sidebar-width));
    transition: min-width 0.15s ease-in-out;
  }
}

// Supporting CSS to improve print-to-PDF option
@media print {
  @page {
    size: auto;
  }

  body {
    margin: 0;
  }

  header, footer, aside, nav {
    display: none;
  }

  .block {
    break-inside: avoid;
    width: 100%;
  }
}


// Rich text editor stuff
/* Basic editor styles */
.rt-content {
  position: static;

  :first-child {
    margin-top: 0 !important;
  }

  p {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Headings */
  h1, h2, h3, h4, h5, h6 {
    line-height: 1.1;
    margin-top: 2.5rem;
    text-wrap: pretty;
  }

  h1, h2 {
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  h4, h5, h6 {
    font-size: 1rem;
  }

  /* Lists */
  ul, ol {
    padding: 0 1rem;
    margin: 1.25rem 1rem 1.25rem 0.4rem;

    li p {
      margin-top: 0.25em;
      margin-bottom: 0.25em;
    }
  }

  ol {
    margin-left: 0.1rem !important;
  }

  /* Blockquote */
  blockquote {
    border-left: 3px solid var(--light);
    margin: 1.5rem 0;
    padding-left: 1rem;
    font-style: italic;
  }

  /* Code and preformatted text */
  code {
    background-color: var(--light);
    border-radius: 0.4rem;
    color: var(--dark);
    font-size: 0.85rem;
    padding: 0.25em 0.3em;
  }

  pre {
    background: var(--dark);
    border-radius: 0.5rem;
    color: var(--light);
    font-family: 'JetBrainsMono', monospace;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: pre-wrap;

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

  /* Task list - official Tiptap structure */
  ul[data-type='taskList'] {
    list-style: none;
    margin-left: 0;
    padding: 0;

    li {
      align-items: flex-start;
      display: flex;
      margin-bottom: 0.25rem;

      > label {
        flex: 0 0 auto;
        margin-bottom: 0 !important;
        user-select: none;
      }

      > div {
        flex: 1 1 auto;
      }
    }

    input[type='checkbox'] {
      pointer-events: none;
      cursor: default;
      width: 0.9rem;
      height: 0.9rem;
      margin: 0.175rem 0.5rem 0rem 0rem !important
    }

    ul[data-type='taskList'] {
      margin: 0;
    }
  }

  /* Links */
  a {
    color: var(--primary);
    text-decoration: underline;

    &:hover {
      color: var(--dark);
    }
  }

  /* Horizontal rule */
  hr {
    border: none;
    border-top: 1px solid var(--light);
    margin: 2rem 0;
  }

  /* Images */
  img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1em 0;
  }

  /* Emphasis */
  strong, b {
    font-weight: 600;
  }

  em, i {
    font-style: italic;
  }

  /* Strikethrough */
  s, del {
    text-decoration: line-through;
  }

  /* Subscript and superscript */
  sub, sup {
    font-size: 0.75em;
    line-height: 0;
  }

  sub {
    vertical-align: sub;
  }

  sup {
    vertical-align: super;
  }

  /* Mark/highlight */
  mark {
    background-color: var(--primary);
    color: var(--white);
    padding: 0.1em 0.3em;
    border-radius: 3px;
  }

  table {
    border-collapse: collapse;
    margin: 0;
    overflow: hidden;
    table-layout: fixed;
    width: 100%;

    td,
    th {
      border: 1px solid var(--extra-light);
      box-sizing: border-box;
      min-width: 1em;
      padding: 6px 8px;
      position: relative;
      vertical-align: top;

      > * {
        margin-bottom: 0;
      }
    }

    th {
      background-color: var(--extra-light);
      font-weight: bold;
      text-align: left;
    }

    .selectedCell:after {
      background: var(--light);
      content: '';
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      pointer-events: none;
      position: absolute;
      z-index: 2;
    }

    .column-resize-handle {
      background-color: var(--primary);
      bottom: -2px;
      pointer-events: none;
      position: absolute;
      right: -2px;
      top: 0;
      width: 4px;
    }
  }

  .tableWrapper {
    margin: 1.5rem 0;
    overflow-x: auto;
  }

  .mention {
    background-color: var(--extra-light);
    border-radius: 0.5rem;
    padding: 0rem 0.2rem;
    box-decoration-break: clone;
    color: var(--primary);
    border: 1px solid var(--extra-light);
  }

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

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

.ProseMirror.ProseMirror-focused {
  outline: none;
}
