/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

.c-rich-text-editor {
  margin: 0px auto;
  max-width: 1100px;
  position: relative;
  line-height: 1.7;

  > * {
    box-sizing: border-box;
  }

  @apply !font-sans font-normal text-gray-900-50;

  .editor-container {
    background: #fff;
    position: relative;
    cursor: text;
    @apply mt-2 rounded-bl-md rounded-br-md;
  }

  .editor-container.plain-text {
    @apply rounded-tl-md rounded-tr-md;
  }

  span.editor-image {
    cursor: default;
    display: inline-block;
    position: relative;
    user-select: none;
  }

  .editor-image img {
    max-width: 100%;
    cursor: default;
  }

  .editor-image img.focused {
    outline: 2px solid rgb(60, 132, 244);
    user-select: none;
  }

  .editor-image img.focused.draggable {
    cursor: grab;
  }

  .editor-image img.focused.draggable:active {
    cursor: grabbing;
  }

  .editor-image .image-caption-container {
    display: block;
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    padding: 0;
    margin: 0;
    border-top: 1px solid #fff;
    background-color: rgba(255, 255, 255, 0.9);
    min-width: 100px;
    color: #000;
    overflow: hidden;
  }

  .editor-image .image-caption-button {
    display: block;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    width: 30%;
    padding: 10px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    min-width: 100px;
    color: #fff;
    cursor: pointer;
    user-select: none;
  }

  .editor-image .image-caption-button:hover {
    background-color: rgba(60, 132, 244, 0.5);
  }

  .editor-scroller {
    min-height: 150px;
    border: 0;
    resize: none;
    cursor: text;
    display: block;
    position: relative;
    outline: 0;
    resize: vertical;
  }

  .editor {
    height: 100%;
    position: relative;
  }

  .test-recorder-output {
    margin: 20px auto 20px auto;
    width: 100%;
  }

  pre {
    line-height: 1.1;
    color: #fff;
    margin: 0;
    padding: 10px;
    overflow: auto;
    max-height: 180px;
    @apply bg-purple-50-900 text-sm;
  }

  pre::-webkit-scrollbar {
    background: transparent;
    width: 10px;
  }

  pre::-webkit-scrollbar-thumb {
    background: #999;
  }

  .editor-dev-button {
    position: relative;
    display: block;
    width: 40px;
    height: 40px;
    font-size: 12px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    outline: none;
    box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.3);
    background-color: #444;
  }

  .editor-dev-button::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: block;
    background-size: contain;
    filter: invert(1);
  }

  .editor-dev-button:hover {
    background-color: #555;
  }

  .editor-dev-button.active {
    background-color: rgb(233, 35, 35);
  }

  .test-recorder-toolbar {
    display: flex;
  }

  .test-recorder-button {
    position: relative;
    display: block;
    width: 32px;
    height: 32px;
    font-size: 10px;
    padding: 6px 6px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    outline: none;
    box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.4);
    background-color: #222;
    transition: box-shadow 50ms ease-out;
  }

  .test-recorder-button:active {
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.4);
  }

  .test-recorder-button + .test-recorder-button {
    margin-left: 4px;
  }

  .test-recorder-button::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    display: block;
    background-size: contain;
    filter: invert(1);
  }

  #options-button {
    position: fixed;
    left: 20px;
    bottom: 20px;
  }

  #test-recorder-button {
    position: fixed;
    left: 70px;
    bottom: 20px;
  }

  #paste-log-button {
    position: fixed;
    left: 120px;
    bottom: 20px;
  }

  #options-button::after {
    background-image: url(images/icons/gear.svg);
  }

  #test-recorder-button::after {
    background-image: url(images/icons/journal-code.svg);
  }

  #paste-log-button::after {
    background-image: url(images/icons/clipboard.svg);
  }

  #test-recorder-button-snapshot {
    margin-right: auto;
  }

  #test-recorder-button-snapshot::after {
    background-image: url(images/icons/camera.svg);
  }

  #test-recorder-button-copy::after {
    background-image: url(images/icons/clipboard.svg);
  }

  #test-recorder-button-download::after {
    background-image: url(images/icons/download.svg);
  }

  .typeahead-popover {
    background: #fff;
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 25px;
  }

  .typeahead-popover ul {
    padding: 0;
    list-style: none;
    margin: 0;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: scroll;
  }

  .typeahead-popover ul::-webkit-scrollbar {
    display: none;
  }

  .typeahead-popover ul {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .typeahead-popover ul li {
    margin: 0;
    min-width: 180px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    border-radius: 8px;
  }

  .typeahead-popover ul li.selected {
    background: #eee;
  }

  .typeahead-popover li {
    margin: 0 8px 0 8px;
    padding: 8px;
    color: #050505;
    cursor: pointer;
    line-height: 16px;
    font-size: 15px;
    display: flex;
    align-content: center;
    flex-direction: row;
    flex-shrink: 0;
    background-color: #fff;
    border-radius: 8px;
    border: 0;
  }

  .typeahead-popover li.active {
    display: flex;
    width: 20px;
    height: 20px;
    background-size: contain;
  }

  .typeahead-popover li:first-child {
    border-radius: 8px 8px 0px 0px;
  }

  .typeahead-popover li:last-child {
    border-radius: 0px 0px 8px 8px;
  }

  .typeahead-popover li:hover {
    background-color: #eee;
  }

  .typeahead-popover li .text {
    display: flex;
    line-height: 20px;
    flex-grow: 1;
    min-width: 150px;
  }

  .typeahead-popover li .icon {
    display: flex;
    width: 20px;
    height: 20px;
    user-select: none;
    margin-right: 8px;
    line-height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .component-picker-menu {
    width: 200px;
  }

  .auto-embed-menu {
    width: 150px;
  }

  i.palette {
    background-image: url(images/icons/palette.svg);
  }

  i.bucket {
    background-image: url(images/icons/paint-bucket.svg);
  }

  i.bold {
    background-image: url(images/icons/type-bold.svg);
  }

  i.italic {
    background-image: url(images/icons/type-italic.svg);
  }

  i.clear {
    background-image: url(images/icons/trash.svg);
  }

  i.code {
    background-image: url(images/icons/code.svg);
  }

  i.underline {
    background-image: url(images/icons/type-underline.svg);
  }

  i.strikethrough {
    background-image: url(images/icons/type-strikethrough.svg);
  }

  i.subscript {
    background-image: url(images/icons/type-subscript.svg);
  }

  i.superscript {
    background-image: url(images/icons/type-superscript.svg);
  }

  i.link {
    background-image: url(images/icons/link.svg);
  }

  i.horizontal-rule {
    background-image: url(images/icons/horizontal-rule.svg);
  }

  .icon.plus {
    background-image: url(images/icons/plus.svg);
  }

  .icon.caret-right {
    background-image: url(images/icons/caret-right-fill.svg);
  }

  .icon.dropdown-more {
    background-image: url(images/icons/dropdown-more.svg);
  }

  .icon.font-color {
    background-image: url(images/icons/font-color.svg);
  }

  .icon.font-family {
    background-image: url(images/icons/font-family.svg);
  }

  .icon.bg-color {
    background-image: url(images/icons/bg-color.svg);
  }

  i.image {
    background-image: url(images/icons/file-image.svg);
  }

  i.table {
    background-image: url(images/icons/table.svg);
  }

  i.close {
    background-image: url(images/icons/close.svg);
  }

  .icon.left-align,
  i.left-align {
    background-image: url(images/icons/text-left.svg);
  }

  i.center-align {
    background-image: url(images/icons/text-center.svg);
  }

  i.right-align {
    background-image: url(images/icons/text-right.svg);
  }

  i.justify-align {
    background-image: url(images/icons/justify.svg);
  }

  i.indent {
    background-image: url(images/icons/indent.svg);
  }

  i.outdent {
    background-image: url(images/icons/outdent.svg);
  }

  i.undo {
    background-image: url(images/icons/arrow-counterclockwise.svg);
  }

  i.redo {
    background-image: url(images/icons/arrow-clockwise.svg);
  }

  i.mic {
    background-image: url(images/icons/mic.svg);
  }

  i.import {
    background-image: url(images/icons/upload.svg);
  }

  i.export {
    background-image: url(images/icons/download.svg);
  }

  i.diagram-2 {
    background-image: url(images/icons/diagram-2.svg);
  }

  i.user {
    background-image: url(images/icons/user.svg);
  }

  i.equation {
    background-image: url(images/icons/plus-slash-minus.svg);
  }

  i.gif {
    background-image: url(images/icons/filetype-gif.svg);
  }

  i.copy {
    background-image: url(images/icons/copy.svg);
  }

  i.success {
    background-image: url(images/icons/success.svg);
  }

  i.prettier {
    background-image: url(images/icons/prettier.svg);
  }

  i.prettier-error {
    background-image: url(images/icons/prettier-error.svg);
  }

  .link-editor {
    box-sizing: border-box;
  }
  .link-editor .button.active,
  .toolbar .button.active {
    @apply bg-purple-50-900;
  }
  .link-editor {
    @apply !rounded-lg border border-solid border-gray-100-800 !shadow-lg;
  }
  .link-editor .link-input {
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0;
    padding: 8px 24px;
    /* background-color: #eee; */
    font-size: 15px;
    color: rgb(5, 5, 5);
    outline: 0;
    position: relative;
    font-family: inherit;

    @apply border-gray text-sm text-s-blue-600-300;
  }

  .link-editor div.link-edit {
    background-image: url(images/icons/pencil-fill.svg);
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
    width: 35px;
    vertical-align: -0.25em;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    cursor: pointer;
  }
  .link-editor .link-input {
    box-sizing: border-box;
  }
  .link-editor .link-input a {
    color: rgb(33, 111, 219);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    @apply text-s-blue-600-300;
  }

  .link-editor .link-input a:hover {
    text-decoration: underline;
  }

  .link-editor .font-size-wrapper,
  .link-editor .font-family-wrapper {
    display: flex;
    margin: 0 4px;
  }

  .link-editor select {
    padding: 6px;
    border: none;
    background-color: rgba(0, 0, 0, 0.075);
    border-radius: 4px;
  }

  #block-controls {
    display: block;
    position: absolute;
    right: 10px;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 2px 0px;
    top: 16px;
    z-index: 10;
    border-radius: 8px;
    border: 1px solid rgb(206, 208, 212);
    overflow: hidden;
  }

  #block-controls button {
    border: 1px solid white;
    background-color: #fff;
    display: block;
    transition: background-color 0.1s ease;
    cursor: pointer;
    outline: none;
    border-radius: 8px;
    padding: 3px;
  }

  #block-controls button:hover {
    background-color: #efefef;
  }

  #block-controls button:focus-visible {
    border-color: blue;
  }

  #block-controls span.block-type {
    background-size: contain;
    display: block;
    width: 18px;
    height: 18px;
    margin: 2px;
  }

  #block-controls span.block-type.paragraph {
    background-image: url(images/icons/text-paragraph.svg);
  }

  #block-controls span.block-type.h1 {
    background-image: url(images/icons/type-h1.svg);
  }

  #block-controls span.block-type.h2 {
    background-image: url(images/icons/type-h2.svg);
  }

  #block-controls span.block-type.quote {
    background-image: url(images/icons/chat-square-quote.svg);
  }

  #block-controls span.block-type.ul {
    background-image: url(images/icons/list-ul.svg);
  }

  #block-controls span.block-type.ol {
    background-image: url(images/icons/list-ol.svg);
  }

  #block-controls span.block-type.code {
    background-image: url(images/icons/code.svg);
  }

  .characters-limit {
    color: #888;
    font-size: 12px;
    text-align: right;
    display: block;
    position: absolute;
    left: 12px;
    bottom: 5px;
  }

  .characters-limit.characters-limit-exceeded {
    color: red;
  }

  .icon.paragraph {
    background-image: url(images/icons/text-paragraph.svg);
  }

  .icon.h1 {
    background-image: url(images/icons/type-h1.svg);
  }

  .icon.h2 {
    background-image: url(images/icons/type-h2.svg);
  }

  .icon.h3 {
    background-image: url(images/icons/type-h3.svg);
  }

  .icon.h4 {
    background-image: url(images/icons/type-h4.svg);
  }

  .icon.h5 {
    background-image: url(images/icons/type-h5.svg);
  }

  .icon.h6 {
    background-image: url(images/icons/type-h6.svg);
  }

  .icon.bullet-list,
  .icon.bullet {
    background-image: url(images/icons/list-ul.svg);
  }

  .icon.check-list,
  .icon.check {
    background-image: url(images/icons/square-check.svg);
  }

  .icon.numbered-list,
  .icon.number {
    background-image: url(images/icons/list-ol.svg);
  }

  .icon.quote {
    background-image: url(images/icons/chat-square-quote.svg);
  }

  .icon.code {
    background-image: url(images/icons/code.svg);
  }

  .switches {
    z-index: 6;
    position: fixed;
    left: 10px;
    bottom: 70px;
    animation: slide-in 0.4s ease;
  }

  @keyframes slide-in {
    0% {
      opacity: 0;
      transform: translateX(-200px);
    }
    100% {
      opacity: 1;
      transform: translateX(0);
    }
  }

  [role='separator'] {
    @apply h-px bg-gray-200-700;
  }

  .actions i.indent {
    background-image: url(images/icons/indent.svg);
  }

  .actions i.outdent {
    background-image: url(images/icons/outdent.svg);
  }

  .actions i.lock {
    background-image: url(images/icons/lock-fill.svg);
  }

  .actions i.image {
    background-image: url(images/icons/file-image.svg);
  }

  .actions i.table {
    background-image: url(images/icons/table.svg);
  }

  .actions i.unlock {
    background-image: url(images/icons/lock.svg);
  }

  .actions i.left-align {
    background-image: url(images/icons/text-left.svg);
  }

  .actions i.center-align {
    background-image: url(images/icons/text-center.svg);
  }

  .actions i.right-align {
    background-image: url(images/icons/text-right.svg);
  }

  .actions i.justify-align {
    background-image: url(images/icons/justify.svg);
  }

  .actions i.disconnect {
    background-image: url(images/icons/plug.svg);
  }

  .actions i.connect {
    background-image: url(images/icons/plug-fill.svg);
  }

  table.disable-selection {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  table.disable-selection span::selection {
    background-color: transparent;
  }

  table.disable-selection br::selection {
    background-color: transparent;
  }

  .table-cell-action-button-container {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
  }

  .connecting {
    font-size: 15px;
    color: #999;
    overflow: hidden;
    position: absolute;
    text-overflow: ellipsis;
    top: 10px;
    left: 10px;
    user-select: none;
    white-space: nowrap;
    display: inline-block;
    pointer-events: none;
  }

  .ltr {
    text-align: left;
  }

  .rtl {
    text-align: right;
  }

  .toolbar {
    @apply flex h-12 w-full justify-between overflow-auto rounded-tl-md rounded-tr-md py-1 pr-2 pl-4 align-middle;
  }

  .toolbar button.toolbar-item {
    @apply flex shrink-0 cursor-pointer items-center justify-between rounded-md border-0 bg-transparent p-2 align-middle;
  }

  .toolbar button.toolbar-item:disabled {
    @apply cursor-not-allowed;
  }

  .toolbar button.toolbar-item.spaced {
    @apply mr-0.5;
  }

  .toolbar button.toolbar-item i.format {
    background-size: contain;
    display: inline-block;
    height: 18px;
    width: 18px;
    vertical-align: -0.25em;
    display: flex;
    opacity: 0.6;
  }

  .toolbar button.toolbar-item:disabled .icon,
  .toolbar button.toolbar-item:disabled .text,
  .toolbar button.toolbar-item:disabled i.format,
  .toolbar button.toolbar-item:disabled .chevron-down {
    opacity: 0.2;
  }

  .toolbar button.toolbar-item.active {
    @apply bg-purple-50-900;
  }

  .toolbar button.toolbar-item.active i {
    opacity: 1;
  }

  .toolbar .toolbar-item:hover:not([disabled]) {
    @apply bg-purple-50-900;
  }

  .toolbar .toolbar-item.font-family .text {
    display: block;
    max-width: 40px;
  }

  .toolbar .code-language {
    width: 150px;
  }

  .toolbar .toolbar-item .text {
    display: flex;
    line-height: 20px;
    vertical-align: middle;
    font-size: 14px;
    color: #777;
    text-overflow: ellipsis;
    overflow: hidden;
    height: 20px;
    text-align: left;
    padding-right: 10px;
  }

  .toolbar .toolbar-item .icon {
    display: flex;
    width: 20px;
    height: 20px;
    user-select: none;
    margin-right: 8px;
    line-height: 16px;
    background-size: contain;
  }

  .toolbar i.chevron-down {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    display: flex;
    user-select: none;
  }

  .toolbar i.chevron-down.inside {
    width: 16px;
    height: 16px;
    display: flex;
    margin-left: -25px;
    margin-top: 11px;
    margin-right: 10px;
    pointer-events: none;
  }

  .toolbar .divider {
    width: 1px;
    background-color: #eee;
    margin: 0 4px;
  }

  .github-corner:hover .octo-arm {
    animation: octocat-wave 560ms ease-in-out;
  }
  @keyframes octocat-wave {
    0%,
    100% {
      transform: rotate(0);
    }
    20%,
    60% {
      transform: rotate(-25deg);
    }
    40%,
    80% {
      transform: rotate(10deg);
    }
  }
  @media (max-width: 500px) {
    .github-corner:hover .octo-arm {
      animation: none;
    }
    .github-corner .octo-arm {
      animation: octocat-wave 560ms ease-in-out;
    }
  }

  .spacer {
    letter-spacing: -2px;
  }

  button.item i {
    opacity: 0.6;
  }

  button.item.dropdown-item-active {
    background-color: rgba(223, 232, 250, 0.3);
  }

  button.item.dropdown-item-active i {
    opacity: 1;
  }

  hr {
    padding: 4px 0;
    border: 1px solid red;
    border: none;
    margin: 1em 0;
    cursor: pointer;
  }

  hr:after {
    content: '';
    display: block;
    height: 1px;
    background-color: #ccc;
    line-height: 1px;
    @apply bg-purple-100-800;
  }

  hr.selected {
    outline: 2px solid rgb(60, 132, 244);
    user-select: none;
  }

  .ContentEditable__root {
    tab-size: 1;
    min-height: calc(100% - 16px);
    @apply relative block border-0 px-6 py-2 !pt-0 text-sm outline-0;
  }

  .TableNode__contentEditable {
    min-height: 20px;
    border: 0px;
    resize: none;
    min-height: 100%;
    cursor: text;
    display: block;
    position: relative;
    tab-size: 1;
    outline: 0px;
    padding: 0;
    user-select: text;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
    z-index: 3;
  }

  .TableNode__contentEditable .CrystallizeRTEditorTheme__paragraph {
    @apply my-2;
  }

  .CrystallizeRTEditorTheme__blockCursor {
    display: block;
    pointer-events: none;
    position: absolute;
  }

  .CrystallizeRTEditorTheme__blockCursor:after {
    content: '';
    display: block;
    position: absolute;
    top: -2px;
    width: 20px;
    border-top: 1px solid black;
    animation: CursorBlink 1.1s steps(2, start) infinite;
  }

  @keyframes CursorBlink {
    to {
      visibility: hidden;
    }
  }
}

.c-rte-table-action-dropdown {
  display: absolute;
  right: 2px;
  top: 2px;
}
