@import '_functions';

/* smart-toast */
smart-toast {
  font-family: var(--smart-font-family-icon);
  display: none;

  .smart-toast-container {
    font-family: var(--smart-font-family-icon);
    display: none;
  }
}

.smart-toast-container {

  &.smart-toast-container-top-left,
  &.smart-toast-container-top-right,
  &.smart-toast-container-bottom-left,
  &.smart-toast-container-bottom-right,
  &.smart-toast-container-custom {
    width: var(--smart-toast-container-default-width);
    padding: 5px;
    position: fixed;
    overflow-y: hidden;
    box-sizing: border-box;
    z-index: var(--smart-editor-drop-down-z-index);
  }

  &.smart-toast-container-top-left {
    top: 0px;
    left: 0px;
  }

  &.smart-toast-container-top-right {
    top: 0px;
    right: 0px;
  }

  &.smart-toast-container-bottom-left {
    bottom: 0px;
    left: 0px;
  }

  &.smart-toast-container-bottom-right {
    bottom: 0px;
    right: 0px;
  }

  &.smart-toast-container-custom {}

  &.smart-toast-container-modal {
    width: 100%;
    height: 100%;

    &:not(:empty) {
      background-color: rgba(0, 0, 0, 0.5);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: fixed;
      left: 0px;
      top: 0px;
      z-index: var(--smart-editor-drop-down-z-index);
    }

    .smart-toast-item {
      width: 200px;
    }
  }
}

.smart-toast-item {
  display: block;
  width: 100%;
  margin-bottom: 2px;
  opacity: 0.8;
  user-select: none;
  background-color: var(--smart-surface);
  border-color: var(--smart-border);
  color: var(--smart-surface-color);

  &:hover {
    opacity: 1;
  }

  .smart-toast-item-header {
    display: flex;
    justify-content: flex-end;
    height: var(--smart-toast-header-height);

    .smart-toast-item-close-button {
      font-family: var(--smart-font-family-icon);
      user-select: none;
      position: relative;
      cursor: pointer;
      color: black;
      margin: 5px;
      opacity: 1;
      display: none;
      width: var(--smart-font-size);
      height: var(--smart-font-size);
      color: inherit;
    }
  }

  .smart-toast-item-container {
    padding: 0px 0px 10px 0px;
    display: flex;
    align-items: center;
    position: relative;
    top: -4px;

    .smart-toast-item-icon {
      width: 25px;
      height: 25px;
      margin: 0px 15px 0px 15px;
      display: inline-block;
      background-repeat: no-repeat;

      &:after {
        content: var(--smart-toast-item-icon);
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: var(--smart-font-family-icon);
        font-size: 1.75em;
      }
    }

    .smart-toast-item-content {
      text-align: center;
      opacity: 1;
      font-family: inherit;
      font-size: inherit;
      font-weight: inherit;
      color: inherit;
      text-overflow: ellipsis;
      overflow: hidden;
      display: inline-block;
      width: calc(100% - 110px);
      margin: 0px 15px 0px 15px;
    }
  }

  //Properties
  &[show-close-button] {
    .smart-toast-item-header {
      .smart-toast-item-close-button {
        display: block;

        &:after {
          font-family: var(--smart-font-family-icon);
          content: var(--smart-icon-close);
          font-size: inherit;
          user-select: none;
          cursor: pointer;
          color: inherit;
          position: absolute;
          left: 0px;
          top: 0px;
          display: block;
        }
      }
    }
  }

  &[opened] {
    opacity: 0.8;

    &:hover {
      opacity: 1;
    }
  }

  &.blink {
    animation: blink normal 1s infinite ease-in;
  }

  //Colors
  @each $value in $main-colors-list {
    &.#{$value} {
      background-color: var(--smart-#{$value});
      border-color: var(--smart-#{$value});
      color: var(--smart-#{$value}-color);

      .smart-toast-item-header {
        .smart-toast-item-close-button {
          color: var(--smart-primary-color);
        }
      }
    }
  }

  &.mail {
    background-color: #337ab7;
    border-color: #337ab7;
    color: white;

    .smart-toast-item-header {
      .smart-toast-item-close-button {
        color: white;
      }
    }
  }

  &.time {
    background-color: #363636;
    border-color: #363636;
    color: white;

    .smart-toast-item-header {
      .smart-toast-item-close-button {
        color: white;
      }
    }
  }

  //Icons
  &.info {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-help-circled);
      }
    }
  }

  &.warning {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-attention);
      }
    }
  }

  &.success {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-check);
      }
    }
  }

  &.error {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-block);
      }
    }
  }

  &.mail {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-mail);
      }
    }
  }

  &.time {
    .smart-toast-item-icon {
      &:after {
        --smart-toast-item-icon: var(--smart-icon-clock);
      }
    }
  }
}

@import 'rtl/_toast';
@keyframes blink {
  50% {
    opacity: 0.5;
  }
}
