// Here should be placed all blocks that receive (faked) focus
.block:focus {
  outline: none;
}

.block .block:not(.inner)::before {
  position: absolute;
  z-index: -1;
  top: -9px;
  left: -9px;
  width: ~'calc(100% + 18px)';
  height: ~'calc(100% + 18px)';
  border: 1px solid rgba(120, 192, 215, 0);
  border-radius: 3px;
  content: '';
}

.block .block-add-button {
  display: none;
}

.block.selected .block-add-button {
  display: inline-block;
}

.view-editview {
  .block .block.selected::before,
  .block .block.selected:hover::before {
    border-width: 1px;
    border-color: rgba(120, 192, 215, 0.75);
  }
}

.view-editview {
  .block .block:hover::before {
    border-color: rgba(120, 192, 215, 0.375);
  }
}

.ui.drag.block:not(:last-child) {
  margin-bottom: 2rem;
}

.ui.drag.block.video,
.ui.drag.block.image {
  z-index: 2;
  // This fixes the floating images in Volto Editor! Muahahaha
  display: block;
}

.block .ui.image {
  width: 100%;
}

.block .ui.message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  span {
    margin-top: 20px;
  }
}

.block.maps {
  iframe {
    width: 100%;
    height: 45vh;
  }
}

.block.align.left {
  z-index: 2;

  &.video .video-inner,
  &.maps iframe,
  img {
    margin-right: 1em !important;
    margin-bottom: 1em;
    float: left;
  }

  &.video .video-inner {
    width: 50%;
  }

  &.maps iframe {
    width: 50%;
    height: 45vh;
  }

  .ui.image,
  img {
    max-width: 50%;
  }
}

.block.align.right {
  z-index: 2;

  &.maps iframe,
  &.video .video-inner,
  img {
    margin-bottom: 1em;
    margin-left: 1em !important;
    float: right;
  }

  &.video .video-inner {
    width: 50%;
  }

  &.maps iframe {
    width: 50%;
    height: 45vh;
  }

  .ui.image,
  img {
    max-width: 50%;
  }
}

.block.align.center {
  iframe,
  img {
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
  }

  iframe {
    width: 100%;
  }
}

// Hacks for the full width image
body .ui.wrapper > .block.align.full,
body.has-toolbar.has-sidebar .ui.wrapper > .ui.inner .block.align.full,
body.has-toolbar-collapsed.has-sidebar
  .ui.wrapper
  > .ui.inner
  .block.align.full,
body.has-toolbar-collapsed.has-sidebar-collapsed
  .ui.wrapper
  > .ui.inner
  .block.align.full,
body.has-toolbar.has-sidebar-collapsed
  .ui.wrapper
  > .ui.inner
  .block.align.full {
  width: 100% !important;

  iframe {
    width: 100%;
  }

  img {
    width: 100%;
  }
}

body.has-toolbar.has-sidebar .ui.wrapper > .ui.inner.block.full,
body.has-toolbar-collapsed.has-sidebar .ui.wrapper > .ui.inner.block.full,
body.has-toolbar-collapsed.has-sidebar-collapsed
  .ui.wrapper
  > .ui.inner.block.full,
body.has-toolbar.has-sidebar-collapsed .ui.wrapper > .ui.inner.block.full {
  width: 100% !important;

  iframe {
    width: 100%;
  }

  img {
    width: 100%;
  }
}

.block.align:not(.right):not(.left) {
  clear: both;
}

.title.block .public-DraftEditorPlaceholder-inner {
  font-size: @h1;
  font-weight: @headerFontWeight;
  line-height: @headerLineHeight;
}

.ui.block.table {
  border: 0;
}

.block {
  position: relative;
  margin-bottom: 1em;

  h1:last-child,
  h2:last-child,
  h3:last-child,
  h4:last-child,
  h5:last-child {
    margin: @headerMargin;
  }

  p {
    margin: @paragraphMargin;
  }

  .toolbar {
    position: absolute;
    z-index: 10;
    top: -32px;
    left: 50%;
    display: flex;
    padding: 4px;
    background-color: rgba(255, 255, 255, 0.975);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translate(-50%, 0);

    form {
      display: flex;
    }

    & > svg {
      display: inline-block !important;
      box-sizing: content-box;
      padding: 4px;
      margin-right: 4px;
      color: @brown !important;
    }

    .ui.input > input {
      padding: 0;
      border: none;
    }

    .ui.icon.button {
      padding: 4px;
      margin-left: 4px;
      border-radius: 1px;
      color: @brown !important;

      &:hover {
        background-color: #edf1f2 !important;
      }
    }

    .ui.buttons:first-child {
      & .ui.icon.button {
        margin-left: 0;
      }
    }
  }

  .toolbar-inner {
    display: flex;
    min-width: 430px;
    height: 40px;
    padding: 4px;
    background-color: rgba(255, 255, 255, 0.975);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);

    form {
      display: flex;
    }

    & > svg {
      display: inline-block !important;
      box-sizing: content-box;
      padding: 4px;
      margin-right: 4px;
      color: @brown !important;
    }

    .ui.input {
      width: 100%;
      margin-left: 8px;
    }

    .ui.input > input {
      padding: 0;
      border: none;
    }

    .ui.icon.button {
      padding: 4px;
      margin-left: 4px;
      border-radius: 1px;
      color: @brown !important;

      &:hover {
        background-color: #edf1f2 !important;
      }
    }

    .ui.buttons:first-child {
      & .ui.icon.button {
        margin-left: 0;
      }
    }
  }

  .ui.active.basic.icon.button {
    border: 1px solid #2996da;
    background: transparent !important;
  }
}

// Hero block
.block.hero {
  clear: both;

  .toolbar {
    left: 25%;
  }

  .hero-body {
    max-height: 400px;
    flex: 1 1;
    padding: 30px;
    background-color: @tealBackground;
    overflow-y: hidden;

    h1 {
      margin-top: 0;
    }

    p {
      max-height: 287px;
      margin: 0;
      overflow-y: hidden;
      word-break: break-word;
    }
  }

  .hero-image {
    display: block;
    width: auto;
    max-width: 50%;
    height: auto;
    max-height: 400px;
  }

  .image-add {
    min-width: 50%;
  }

  .image-message {
    min-height: 400px !important;
  }

  .block-inner-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
  }

  .title-editor,
  .description-editor {
    max-height: 287px;
    overflow-y: hidden;
    word-break: break-word;
  }
}

.ui.basic.button.block-add-button {
  // .ui.basic.button.block-delete-button {
  position: absolute;
  // margin-top: -21px;
  top: -2px;
  padding: 0;
  border: none;
  margin-bottom: 0;
  -webkit-box-shadow: none;
  box-shadow: none;
  color: #b8c6c8 !important;
  transform: translateX(-40px);

  &:hover,
  &:focus {
    -webkit-box-shadow: none;
    box-shadow: none;
    color: @brown !important;
  }
}

.block .ui.basic.button.delete-button {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0;
  border: none;
  -webkit-box-shadow: none;
  box-shadow: none;

  &:hover,
  &:focus {
    -webkit-box-shadow: none;
    box-shadow: none;
    color: #e40166 !important;
  }
}

// .ui.basic.button.block-delete-button {
//   top: 22px;
//   right: 0;
//   color: #b8c6b8 !important;
//   transform: translateX(40px);

//   &:hover,
//   &:focus {
//     -webkit-box-shadow: none;
//     box-shadow: none;
//     color: #e40166 !important;
//   }
// }

.drag.block.wrapper {
  position: relative;
}

.drag.handle.wrapper {
  position: absolute;
  z-index: 1;
  // top: 1px;
  left: 0;
  color: #b8c6c8;

  .icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
  }

  &:hover {
    color: @brown;
  }
}

.drag.block.title .drag.handle.wrapper {
  top: 5px;
}

.drag.handle.wrapper.hidden {
  display: none !important;
}

.description.block .public-DraftEditorPlaceholder-inner {
  font-size: 1.125rem;
  line-height: @lineHeight;
}

.callout {
  padding: 1em;
  border: 1px solid rgba(34, 36, 38, 0.15);
  margin: 1rem 0;
  border-radius: 0.28571429rem;
  box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15);
}

.ui.blocker {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.separator {
  display: inline-block;
  height: 24px;
  border-right: 1px solid #ddd;
  margin: 0 0 4px 4px;
  vertical-align: bottom;
}

// HTML block
.html-editor {
  z-index: 1;
  background-color: #f3f6f7;
  border-radius: 4px;
  font-family: monospace;
  font-size: @16px;

  &:focus-within textarea {
    caret-color: #e40166;
    outline: 0;
  }
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #90a4ae;
}

.token.punctuation {
  color: #9e9e9e;
}

.namespace {
  opacity: 0.7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #e91e63;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #4caf50;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #795548;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #3f51b5;
}

.token.function {
  color: #f44336;
}

.token.regex,
.token.important,
.token.variable {
  color: #ff9800;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

.link-form-container {
  button {
    padding: 0;
    border: 0;
    background: transparent;
    color: @linkColor;
    cursor: pointer;
    text-align: initial;
    text-decoration: underline;

    &:focus {
      outline: none;
    }
  }
}

.accordion-tools {
  display: flex;
  align-items: center;

  .ui.basic.button {
    margin-right: 10px;

    &:hover {
      background-color: transparent !important;
    }
  }
}
