.alert {
  --c8y-btn-default-background-default: @alert-background;
  margin-bottom: @margin-base;
  padding: @alert-padding;
  max-width: @alert-max-width;
  border-radius: @component-border-radius-base;
  word-wrap: break-word;

  overflow-wrap: break-word;
  .boxShadowHelper(sm);

  > span {
    white-space: pre-line;
  }
  
  &:before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: inline-flex;
    justify-content: center;
    width: 44px;
    border-left: @alert-border-width @alert-border-style transparent;
    text-align: center;
    font-size: @alert-status-symbol-size;
    font-family: @alert-icon-font-family;
    line-height: 2.2;
    transform: translate(0, 0);

    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  // Headings for larger alerts
  h4 {
    margin-top: 0;
    color: inherit;
  }
  > p,
  > ul {
    margin-bottom: 0;
  }
  > p + p {
    margin-top: @margin-base;
  }
  > .close {
    margin-left: @margin-8;
  }

  &.c8y-prompt {
    margin-bottom: 0;
    padding: calc(@margin-base * 5);
    &:before {
      content: '' !important;
    }
    h3 {
      font-weight: 500;
      font-size: 20px;
      > [class^='dlt-c8y-icon-'],
      > [class*=' dlt-c8y-icon-'] {
        margin-right: 4px;
        font-size: 24px;
      }
    }
    .alert-footer {
      padding: calc(@margin-base * 5) 0 0;
      text-align: right;
      button {
        margin-bottom: 0 !important;
      }
    }
    &.alert-success {
      h3 > i,
      h3 > [class^='dlt-c8y-icon-'],
      h3 > [class*=' dlt-c8y-icon-'] {
        color: @alert-success-border;
      }
    }
    &.alert-warning {
      &:before {
        z-index: 10;
      }

      h3 > i,
      h3 > [class^='dlt-c8y-icon-'],
      h3 > [class*=' dlt-c8y-icon-'] {
        color: @alert-warning-border;
      }
    }
    &.alert-danger {
      h3 > i,
      h3 > [class^='dlt-c8y-icon-'],
      h3 > [class*=' dlt-c8y-icon-'] {
        color: @alert-danger-border;
      }
    }
    &.alert-info {
      h3 > i,
      h3 > [class^='dlt-c8y-icon-'],
      h3 > [class*=' dlt-c8y-icon-'] {
        color: @alert-info-border;
      }
    }
  }
}

// Dismissible alerts
// Expand the right padding and account for the close button's positioning.
.alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0.
.alert-dismissible {
  padding-right: calc(@component-padding + 20); // Adjust close link position
  .close {
    position: relative;
    top: -2px;
    right: -21px; //color: inherit;
  }
}

// Alternate styles
// Generate contextual modifier classes for colorizing the alert.
.alert-success {
  .alert-variant(
    @alert-success-bg; @alert-success-border; @alert-success-text; @alert-success-icon
  );
}

.alert-info {
  .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text; @alert-info-icon);
}

.alert-system {
  .alert-variant(@alert-system-bg; @alert-system-border; @alert-system-text; @alert-system-icon);
}

.alert-warning {
  .alert-variant(
    @alert-warning-bg; @alert-warning-border; @alert-warning-text; @alert-warning-icon
  );
}

.alert-danger {
  .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text; @alert-danger-icon);
}

// Alerts
.alerts {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  z-index: @zindex-alerts;
  display: flex;
  flex-flow: column;
  max-width: 100vw;
  pointer-events: none;
  .static & {
    position: static;
    padding: 0;
  }

  > c8y-alert-outlet:not(:empty) {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    margin-top: @headerHeight;
    padding: 0 16px 16px 48px;
    max-height: calc(100vh - @headerHeight);
    pointer-events: auto;

    .c8y-scrollbar();
  }

  .alert {
    margin: @margin-base @margin-24 @margin-16 auto;
    width: 280px;
    transition: width 0.35s ease-in-out;
    pointer-events: auto;
    .boxShadowHelper(md);
    &.expanded {
      width: 480px;
      @media (max-width: @screen-xs-max) {
        width: 280px;
      }
    }
  }
}

.navigator.open ~ .alerts {
  left: @navigatorWidth;
}

.overlay-center-vertically {
  position: absolute;
  top: 0;
  left: 0;
  z-index: @zindex-dropdown - 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: color-mix(in srgb, var(--c8y-root-component-background-default), var(--c8y-root-component-color-default) 10%);
}

// prevent double scroll bars on widgets when the alerts overlay is displayed
.alerts-overlay{
  .card-inner-scroll{
    overflow: hidden!important;
  }
}


// container to hold alerts on widgets
.inner-alert {
  position: absolute;
  right: 15px;
  left: 15px;
  z-index: 1035;
  .alert {
    margin: 0 auto 10px;
  } // on data-explorer
  .measurement-icon-bar & {
    top: 130px;
    @media (min-width: @screen-sm-min) {
      top: 90px;
    }
    @media (min-width: @screen-md-min) {
      top: 60px;
    }
  }
}
