.contextual {
  z-index: 2;
}

.layout-builder {
  --lb-plus-main-color: #4b9ae4;

  .hide-section {
    opacity: 0.5;
  }
}

/* Layout builder sections. */
.layout-builder__section {
  position: relative;
  transition: all 0.2s ease;

  /* Layout section builder buttons. */
  > .layout-builder__link {
    display: inline-block;
    height: 49px !important;
    width: 49px !important;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    background-color: var(--lb-plus-main-color) !important;
    background-repeat: no-repeat;
    background-position: center !important;
    background-size: 30px !important;
    color: white;
    border-radius: 0 !important;
    border: none;
    text-indent: -9999px;
    transition: all 0.2s ease;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 2;

    &:hover {
      background-size: 35px !important;
      background-color: var(--lb-plus-main-color);
    }
  }

  > .layout-builder__link--remove {
    background-image: url("/modules/custom/starterkit_layoutbuilder/images/remove.svg");

    &:hover {
      background-image: url("/modules/custom/starterkit_layoutbuilder/images/remove.svg");
    }
  }

  > .layout-builder__link--configure {
    background-image: url("/modules/custom/starterkit_layoutbuilder/images/cog.svg");
    left: 49px;
  }

  > .layout-builder__link--add-section-to-library {
    background-image: url("/modules/custom/starterkit_layoutbuilder/images/archive.svg") !important;
    left: 98px;
  }

  /* Alter look n feel of contextual links. */
  .contextual-region .contextual {
    /* Hide the contextual trigger button. */
    .trigger {
      display: none;
    }

    /* Always display the contextual links and style them as buttons. */
    .contextual-links {
      padding: 0;
      background-color: var(--lb-plus-main-color);
      background-position: center center;
      background-size: 25px;
      background-repeat: no-repeat;
      color: white;
      box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.25);
      border-radius: 0;
      border: none;
      transition: all 0.2s ease;
      display: flex !important;

      li,
      a {
        margin: 0;
      }

      li {
        padding: 0;
      }

      a {
        padding: 1em;
        line-height: 1em;
        min-width: 45px;
        min-height: 40px;
        background-color: var(--lb-plus-main-color) !important;
        background-position: center !important;
        background-size: 25px;
        background-repeat: no-repeat !important;
        text-indent: -9999px;
        overflow: hidden;
        transition: all 0.2s ease;

        &:hover {
          background-size: 30px !important;
        }

        /* Edit button. */
        &[href*="/update/block"] {
          background-image: url(/modules/custom/starterkit_layoutbuilder/images/cog.svg);

          &:hover {
            background-image: url(/modules/custom/starterkit_layoutbuilder/images/cog.svg);
          }
        }

        /* Move button. */
        &[href*="/move/block"] {
          background-image: url(/modules/custom/starterkit_layoutbuilder/images/move.svg);

          &:hover {
            background-image: url(/modules/custom/starterkit_layoutbuilder/images/move.svg);
          }
        }

        /* Delete button. */
        &[href*="/remove/block"] {
          background-image: url(/modules/custom/starterkit_layoutbuilder/images/remove.svg);

          &:hover {
            background-image: url(/modules/custom/starterkit_layoutbuilder/images/remove.svg);
          }
        }

        /* Duplicate button. */
        &[href*="/duplicate/block"] {
          background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22white%22%20class%3D%22bi%20bi-copy%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M4%202a2%202%200%200%201%202-2h8a2%202%200%200%201%202%202v8a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2zm2-1a1%201%200%200%200-1%201v8a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1V2a1%201%200%200%200-1-1zM2%205a1%201%200%200%200-1%201v8a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1v-1h1v1a2%202%200%200%201-2%202H2a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2h1v1z%22%2F%3E%3C%2Fsvg%3E);

          &:hover {
            background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22white%22%20class%3D%22bi%20bi-copy%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M4%202a2%202%200%200%201%202-2h8a2%202%200%200%201%202%202v8a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2zm2-1a1%201%200%200%200-1%201v8a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1V2a1%201%200%200%200-1-1zM2%205a1%201%200%200%200-1%201v8a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1v-1h1v1a2%202%200%200%201-2%202H2a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2h1v1z%22%2F%3E%3C%2Fsvg%3E);
          }
        }
      }
    }
  }

  &:hover {
    box-shadow: 0 0 0 10px var(--lb-plus-main-color);
    z-index: 2;

    > .layout-builder__link {
      opacity: 1;
    }
  }
}

/* Layoutbuilder regions */
.layout-builder__region {
  &.js-layout-builder-region {
    outline: 1px dashed var(--lb-plus-main-color);
  }

  .layout-builder__add-block {
    transition: all 0.2s ease;
    overflow: hidden;
    max-height: 20px;
    padding: 0;
    opacity: 0;
  }

  .layout-builder-block {
    padding: 0;
    background: none;
  }

  &:hover {
    outline: 2px dashed var(--lb-plus-main-color);

    .layout-builder__add-block {
      opacity: 1;
      max-height: 100px;
      padding: 1.5em 0;
    }
  }
}

.layout-builder__add-section[data-layout-builder-highlight-id] {
  transition: all 0.2s ease;
  opacity: 0;
  max-height: 10px;
  padding: 0;
  margin-bottom: 0;

  &:hover {
    opacity: 1;
    max-height: 100px;
    padding: 1.5em 0;
    margin-bottom: 1.5em;
  }
}

#layout-builder [data-aos] {
  opacity: 0.9;
}

article.node--type-page-layoutbuilder .hide-section {
  display: none;
}

.container {
  &.container-small {
    max-width: 875px;
  }

  &:has(> .gx-9) {
    overflow: hidden;
  }
}

.overflow-x-hidden {
  overflow-x: hidden;
}

[dir="ltr"] .media-library-edit__link,
[dir="ltr"] .media-library-item .media-library-item__edit {
  right: unset;
  top: unset;
  position: relative;
}

.form-wrapper[data-drupal-selector="edit-preview-toggle"] {
  display: flex;
  justify-content: center;
}

.node-layout-builder-form [data-drupal-selector="edit-actions"] {
  z-index: 10;
  backdrop-filter: blur(10px);
  background-color: rgba(0, 50, 255, 0.5);
}

.bg-blue {
  background-color: #4b9ae4;
}
