.ui-dialog:not(.ui-dialog-off-canvas) {
  max-width: $breakpointWide;
  margin: var(--gin-spacing-m);
  border: 0 none !important;
  border-radius: var(--gin-border-m);
  background: var(--gin-bg-layer);

  // Dialog without title
  .ui-dialog-content:first-of-type {
    border-top-left-radius: var(--gin-border-m);
    border-top-right-radius: var(--gin-border-m);
  }

  // Node actions placement
  .layout-region-node-actions {
    position: absolute;
    bottom: 0;
    left: var(--gin-spacing-m);
    top: auto;
    right: auto;
  }

  // Show meta full width
  .layout-region-node-secondary {
    width: 100%;
  }

  // Views exposed form override for dialog
  .views-exposed-form.views-exposed-form,
  .views-displays {
    border: 1px solid var(--gin-border-color-layer);
  }
}

.ui-dialog {
  font-family: var(--gin-font);
  outline: none;

  &,
  &:focus,
  &:focus:active,
  &:focus:hover {
    box-shadow: var(--gin-shadow-l1);
  }

  .ui-dialog-titlebar {
    line-height: 1.2;
    padding: var(--gin-spacing-m) var(--gin-spacing-l);
    background: $colorDarkAppBackground;
    border: 0 none;
    border-radius: var(--gin-border-m) var(--gin-border-m) 0 0;
  }

  .ui-dialog-title {
    font-size: var(--gin-font-size-l);
    font-weight: var(--gin-font-weight-normal);
    color: #fff;
  }

  .ui-dialog-content {
    color: var(--gin-color-text);
  }

  .ui-widget-content.ui-dialog-buttonpane {
    padding: var(--gin-spacing-s) var(--gin-spacing-l);
    border-top: 1px solid var(--gin-border-color-layer);
    border-bottom-left-radius: var(--gin-border-m);
    border-bottom-right-radius: var(--gin-border-m);
    background: var(--gin-bg-app);

    .button {
      font-weight: var(--gin-font-weight-heavy);
      margin-top: 0;
      margin-bottom: 0;

      &:last-of-type {
        margin-right: 0;
      }
    }
  }

  .ui-widget-content.ui-dialog-buttonpane,
  [data-drupal-selector*="-remove-form"] {
    .button.button--danger {
      border-color: var(--gin-color-danger) !important;
    }
  }

  .ui-dialog-buttonset {
    margin-top: 0;
  }

  .ui-dialog-titlebar-close {
    position: absolute;
    top: 18px;
    right: 24px;
    opacity: .8;
    margin: 0;
    transform: none;
    background: none;
    border: none;

    .ui-icon-closethick {
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      margin: 0;
      transform: none;
      background: #fff;
      mask-image: icon('close');
      mask-size: 24px 24px;
      mask-repeat: no-repeat;
      mask-position: center center;
    }

    &:hover {
      opacity: 1;
    }
  }

  .ui-widget-content.ui-dialog-content {
    padding-left: var(--gin-spacing-l);
    padding-right: var(--gin-spacing-l);
    background: var(--gin-bg-layer);
  }
}

.erl-overlay,
.layout-paragraphs-dialog {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  width: calc(100% - var(--gin-spacing-xl)) !important;
  transform: translate(-50%, -50%);

  @include mq(large) {
    width: calc(100% - var(--gin-spacing-xxxl)) !important;
  }
}

.ui-widget-overlay {
  opacity: .9;
  background: var(--gin-bg-layer2);
}

.views-ui-dialog {
  .views-offset-bottom {
    border-top: 1px solid var(--gin-border-color);
  }
}

.ui-widget-content a {
  color: var(--gin-color-primary);
}

// Off canvas dialog.
.ui-widget.ui-dialog.ui-dialog-off-canvas {
  --gin-offcanvas-active: var(--gin-color-primary);
  background: #444;
  border: 0 none;
  box-shadow: 0 0 48px rgba(0, 0, 0, .075);

  .ui-dialog-titlebar {
    background: $colorDarkAppBackground;
    border-radius: 0;
  }

  .ui-resizable-w {
    border: 0 none;
    background-color: transparent;
  }

  .fieldset {
    color: var(--gin-color-text);
  }

  #drupal-off-canvas {
    .button--primary[type=submit] {
      background: var(--gin-offcanvas-active);
    }
  }
}

// Scroll
.ui-dialog .ui-widget-content.ui-dialog-content {
  overflow: auto;
}

// Webform Off canvas
.ui-dialog.webform-off-canvas .ui-widget-content.ui-dialog-content {
  background: var(--gin-bg-layer);
}

// Token
table.treetable {
  tr.branch {
    background-color: transparent;
  }
}
