/**
 * Trumbowyg v2.25.2 - A lightweight WYSIWYG editor
 * Default stylesheet for Trumbowyg editor
 * ------------------------
 * @link http://alex-d.github.io/Trumbowyg
 * @license MIT
 * @author Alexandre Demode (Alex-D)
 *     Twitter : @AlexandreDemode
 *     Website : alex-d.fr
 */

$transition-duration: 150ms;
$slow-transition-duration: 300ms;

/*
 * Light theme
 */

:root {
  --trumbowyg-icon-size: 1rem;
  --trumbowyg-pane-button-padding: 5px;
  --trumbowyg-text-color: #222;

  --trumbowyg-border-radius: 6px;
  --trumbowyg-border-color: #d7e0e2;

  --trumbowyg-pane-background-color: #F4F7FA;
  --trumbowyg-pane-text-color: #222;
  --trumbowyg-pane-button-size: 2.25em;

  --trumbowyg-button-background-color: #ecf0f1;
  --trumbowyg-button-background-color-active: #fff;

  --trumbowyg-editor-background-color: var(--input-background-color);
  --trumbowyg-editor-text-color: #222;

  --trumbowyg-source-background-color: #222;
  --trumbowyg-source-text-color: #fff;

  --trumbowyg-dropdown-background-color: #fff;
  --trumbowyg-dropdown-button-background-color: #fff;
  --trumbowyg-dropdown-button-text-color: #222;

  --trumbowyg-modal-background-color: #fff;
  --trumbowyg-modal-label-width: 150px;
  --trumbowyg-submit-background-color: #2ecc71;
  --trumbowyg-reset-background-color: #eee;
}

/*
 * Dark theme
 */

html.dark-mode .trumbowyg,
.trumbowyg-dark {
  $dark-color: #222;
  --trumbowyg-border-color: #343434;
  --trumbowyg-text-color: #fff;
  --trumbowyg-editor-background-color: #1C2128;
  --trumbowyg-pane-background-color: #2D333B;
  --trumbowyg-button-background-color: #444C56;
  --trumbowyg-dropdown-background-color: #2D333B;
  --trumbowyg-dropdown-button-background-color: #444C56;
  --trumbowyg-dropdown-button-text-color: #fff;
  --trumbowyg-modal-background-color: #1C2128;
}

/*
 * Styles
 */

#trumbowyg-icons {
  overflow: hidden;
  visibility: hidden;
  height: 0;
  width: 0;

  svg {
    height: 0;
    width: 0;
  }
}

.trumbowyg-box,
.trumbowyg-modal {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  svg {
    width: var(--trumbowyg-icon-size);
    height: var(--trumbowyg-icon-size);
    color: var(--trumbowyg-text-color);
    fill: var(--trumbowyg-text-color);
  }
}

.trumbowyg-box,
.trumbowyg-editor {
  display: block;
  position: relative;
  width: 100%;
  min-height: 300px;
  border-radius: 0 0 var(--trumbowyg-border-radius) var(--trumbowyg-border-radius);
}

.trumbowyg-box .trumbowyg-editor {
  margin: 0 auto;
  color: var(--trumbowyg-text-color);
  > *:first-child {
    margin-top: 0;
  }
}

.trumbowyg-editor,
.trumbowyg-textarea {
  position: relative;
  box-sizing: border-box;
  padding: 20px;
  min-height: 300px;
  width: 100%;
  border-style: none;
  resize: none;
  outline: none;
  overflow: auto;
  user-select: text; // Avoid issues on iOS

  border: 1px solid var(--trumbowyg-border-color);
  border-top: none;
  border-radius: 0 0 var(--trumbowyg-border-radius) var(--trumbowyg-border-radius);

  &.trumbowyg-autogrow-on-enter {
    transition: height $slow-transition-duration ease-out;
  }
}
.trumbowyg-editor {
  background: var(--trumbowyg-editor-background-color);
  color: var(--trumbowyg-editor-text-color);
}
.trumbowyg-textarea {
  background: var(--trumbowyg-source-background-color);
  color: var(--trumbowyg-source-text-color);
}

.trumbowyg-box-blur .trumbowyg-editor {
  *,
  &::before {
    color: transparent !important;
    text-shadow: 0 0 7px #333;
    filter: blur(1px);
  }
  img,
  hr {
    opacity: 0.2;
  }
}

.trumbowyg-textarea {
  position: relative;
  display: block;
  overflow: auto;
  font-size: 14px;
  font-family: monospace;
  line-height: 18px;
}

.trumbowyg-box.trumbowyg-editor-visible {
  .trumbowyg-textarea {
    height: 1px !important;
    width: 25%;
    min-height: 0 !important;
    padding: 0 !important;
    background: none;
    opacity: 0 !important;
  }
}

.trumbowyg-box.trumbowyg-editor-hidden {
  .trumbowyg-textarea {
    display: block;
  }
  .trumbowyg-editor {
    display: none;
  }
}

.trumbowyg-box.trumbowyg-disabled {
  .trumbowyg-textarea {
    opacity: 0.8;
    background: none;
  }
}

.trumbowyg-editor[contenteditable=true]:empty:not(:focus)::before {
  content: attr(placeholder);
  color: #999;
  pointer-events: none;
  white-space: break-spaces;
}

.trumbowyg-button-pane {
  position: relative;
  width: 100%;
  background: var(--trumbowyg-pane-background-color);
  border: 1px solid var(--trumbowyg-border-color);
  border-radius: var(--trumbowyg-border-radius) var(--trumbowyg-border-radius) 0 0;
  //list-style-type: none;
  line-height: 1;
  //backface-visibility: hidden;
  z-index: 11;

  .trumbowyg-button-group {
    display: inline-block;

    .trumbowyg-fullscreen-button svg {
      color: transparent;
    }

    &:last-child::after {
      content: none;
    }

    &:first-child button:first-child {
      border-radius: var(--trumbowyg-border-radius) 0 0 0;
    }

    &.trumbowyg-right:last-child button:last-child {
      border-radius: 0 var(--trumbowyg-border-radius) 0 0;
    }

    &.trumbowyg-right {
      border-left: 1px solid var(--trumbowyg-border-color);
    }
    &:not(.trumbowyg-right) {
      border-right: 1px solid var(--trumbowyg-border-color);
    }
  }

  button {
    display: inline-block;
    position: relative;
    width: var(--trumbowyg-pane-button-size);
    height: var(--trumbowyg-pane-button-size);
    padding: var(--trumbowyg-pane-button-padding);
    overflow: hidden;
    border: none;
    cursor: pointer;
    background: none;
    vertical-align: middle;
    transition: background-color $transition-duration, opacity $transition-duration;

    svg {
      vertical-align: middle;
    }

    &:hover {
      svg {
        transform: scale(1.25);
      }
    }

    &.trumbowyg-textual-button {
      width: auto;
      line-height: var(--trumbowyg-pane-button-size);
      user-select: none;
    }
  }

  &.trumbowyg-disable button:not(.trumbowyg-not-disable):not(.trumbowyg-active),
  button.trumbowyg-disable,
  .trumbowyg-disabled & button:not(.trumbowyg-not-disable):not(.trumbowyg-viewHTML-button) {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
  }
  &.trumbowyg-disable,
  .trumbowyg-disabled & {
    .trumbowyg-button-group::before {
      backdrop-filter: brightness(.75);
    }
  }

  button:not(.trumbowyg-disable):hover,
  button:not(.trumbowyg-disable):focus,
  button.trumbowyg-active {
    backdrop-filter: brightness(1.25);
    outline: none;
  }

  .trumbowyg-open-dropdown {
    &::after {
      display: block;
      content: " ";
      position: absolute;
      top: 25px;
      right: 3px;
      height: 0;
      width: 0;
    }

    &.trumbowyg-textual-button {
      padding-left: 10px !important;
      padding-right: 18px !important;

      &::after {
        top: var(--trumbowyg-icon-size);
        right: 7px;
      }
    }
  }

  .trumbowyg-right {
    float: right;
  }
}

.trumbowyg-dropdown {
  max-width: 300px;
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: nowrap;
  border: 1px solid var(--trumbowyg-border-color);
  padding: var(--trumbowyg-pane-button-padding) 0;
  border-top: none;
  background: var(--trumbowyg-dropdown-background-color);
  color: var(--trumbowyg-text-color);
  margin-left: -1px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .1);
  z-index: 12;

  button {
    display: block;
    width: 100%;
    height: var(--trumbowyg-pane-button-size);
    line-height: var(--trumbowyg-pane-button-size);
    text-decoration: none;
    background: var(--trumbowyg-dropdown-button-background-color);
    padding: 0 20px 0 10px;
    color: var(--trumbowyg-dropdown-button-text-color);
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: inherit;
    transition: all $transition-duration;

    &:hover,
    &:focus {
      filter: brightness(.85);
    }

    svg {
      margin-right: 14px;
    }
  }
}

/* Modal box */
.trumbowyg-modal {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 520px;
  width: 100%;
  height: 350px;
  z-index: 12;
  overflow: hidden;
  backface-visibility: hidden;
}

.trumbowyg-modal-box {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 500px;
  width: calc(100% - 20px);
  padding-bottom: 45px;
  z-index: 1;
  background-color: var(--trumbowyg-modal-background-color);
  text-align: center;
  font-size: 14px;
  border-radius: var(--trumbowyg-border-radius);
  box-shadow: rgba(0, 0, 0, .2) 0 2px 3px;
  backface-visibility: hidden;

  .trumbowyg-modal-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 20px;
    padding: 15px 0 13px;
    display: block;
    border-bottom: 1px solid var(--trumbowyg-border-color);
  }

  .trumbowyg-progress {
    width: 100%;
    height: 3px;
    position: absolute;
    top: 58px;

    .trumbowyg-progress-bar {
      background: #2BC06A;
      width: 0;
      height: 100%;
      transition: width $transition-duration linear;
    }
  }

  .trumbowyg-input {
    &-row {
      position: relative;
      margin: 15px 12px;
      border: 1px solid #dedede;
      overflow: hidden;
    }

    &-infos {
      text-align: left;
      transition: all 150ms;
      width: var(--trumbowyg-modal-label-width);
      border-right: 1px solid #dedede;
      padding: 0 7px;
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      backdrop-filter: brightness(1.15);

      label {
        color: var(--trumbowyg-text-color);
        overflow: hidden;
        height: 27px;
        line-height: 27px;
        opacity: .45;

        &, span {
        display: block;
        height: 27px;
        line-height: 27px;
        transition: all $transition-duration;
        }
      }

      .trumbowyg-msg-error {
        color: #e74c3c;
      }
    }

    &-html {
      padding: 1px 1px 1px var(--trumbowyg-modal-label-width) + 2px;

      &, input, textarea, select {
        font-size: 14px;
      }

      input, textarea, select {
        transition: all $transition-duration;
        height: 27px;
        line-height: 27px;
        border:0;
        width: 100%;
        padding: 0 7px;

        &:hover,
        &:focus {
          outline: 1px solid #95a5a6;
        }
        &:focus {
          backdrop-filter: brightness(1.15);
        }
      }

      input[type="checkbox"] {
        width: 16px;
        height: 16px;
        padding: 0;
      }

      &-with-checkbox {
        text-align: left;
        padding: 3px 1px 1px 3px;
      }
    }

    &-error {
      input, select, textarea {
      outline: 1px solid #e74c3c;
      }

      .trumbowyg-input-infos label span:first-child {
      margin-top: -27px;
      }
    }
  }

  .error {
    margin-top: 25px;
    display: block;
    color: red;
  }

  .trumbowyg-modal-button {
    position: absolute;
    bottom: 10px;
    right: 0;
    text-decoration: none;
    color: #fff;
    display: block;
    width: 100px;
    height: var(--trumbowyg-pane-button-size);
    line-height: 33px;
    margin: 0 10px;
    background-color: #333;
    border: none;
    border-radius: var(--trumbowyg-border-radius);
    cursor: pointer;
    font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif;
    font-size: 16px;
    transition: all $transition-duration;

    &.trumbowyg-modal-submit {
      right: 110px;
      backdrop-filter: brightness(.75);

      &:hover,
      &:focus {
        backdrop-filter: brightness(1.25);
        outline: none;
      }
      &:active {
        backdrop-filter: brightness(1.15);
      }
    }

    &.trumbowyg-modal-reset {
      color: #555;
      backdrop-filter: brightness(.75);

      &:hover,
      &:focus {
        backdrop-filter: brightness(1.25);
        outline: none;
      }
      &:active {
        backdrop-filter: brightness(1.15);
      }
    }
  }
}

.trumbowyg-overlay {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.5);
  height: 100%;
  width: 100%;
  left: 0;
  display: none;
  top: 0;
  z-index: 10;
  border-radius: var(--trumbowyg-border-radius);
}

/**
 * Fullscreen
 */
body.trumbowyg-body-fullscreen {
  overflow: hidden;
}

.trumbowyg-fullscreen {
  position: fixed;
  top: 1em;
  left: 1em;
  bottom: 1em;
  right: 1em;
  box-shadow: 0 0 1em 0 rgba(0, 0, 0, 0.3);
  width: auto;
  z-index: 99999;

  &.trumbowyg-box,
  .trumbowyg-editor {
    border: none;
  }
  .trumbowyg-editor,
  .trumbowyg-textarea {
    height: calc(100% - 37px) !important;
    overflow: auto;
  }
  .trumbowyg-overlay {
    height: 100% !important;
  }
}

.trumbowyg-editor {
  object,
  embed,
  video,
  img {
    max-width: 100%;
  }
  video,
  img {
    height: auto;
  }
  img {
    cursor: move;
  }
  canvas:focus {
    outline: none;
  }

  /*
   * lset for resetCss option
   */
  &.trumbowyg-reset-css {
    background: #fefefe !important;
    font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.45em !important;
    color: #333;

    a {
      color: #15c !important;
      text-decoration: underline !important;
    }

    div,
    p,
    ul,
    ol,
    blockquote {
      box-shadow: none !important;
      background: none !important;
      margin: 0 !important;
      margin-bottom: 15px !important;
      line-height: 1.4em !important;
      font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
      font-size: 14px !important;
      border: none;
    }
    iframe,
    object,
    hr {
      margin-bottom: 15px !important;
    }
    blockquote {
      margin-left: 32px !important;
      font-style: italic !important;
      color: #555;
    }
    ul {
      list-style: disc;
    }
    ol {
      list-style: decimal;
    }
    ul,
    ol {
      padding-left: 20px !important;
    }
    ul ul,
    ol ol,
    ul ol,
    ol ul {
      border: none;
      margin: 2px !important;
      padding: 0 !important;
      padding-left: 24px !important;
    }
    hr {
      display: block;
      height: 1px;
      border: none;
      border-top: 1px solid #CCC;
    }

    h1,
    h2,
    h3,
    h4 {
      color: #111;
      background: none;
      margin: 0 !important;
      padding: 0 !important;
      font-weight: bold;
    }

    h1 {
      font-size: 32px !important;
      line-height: 38px !important;
      margin-bottom: 20px !important;
    }
    h2 {
      font-size: 26px !important;
      line-height: 34px !important;
      margin-bottom: 15px !important;
    }
    h3 {
      font-size: 22px !important;
      line-height: 28px !important;
      margin-bottom: 7px !important;
    }
    h4 {
      font-size: 16px !important;
      line-height: 22px !important;
      margin-bottom: 7px !important;
    }
  }
}