////
/// @group notification
////
.#{$boldr-ns}notification__transition-enter {
  opacity: 0.01;
  transition: opacity 0.5s ease-in;
}

.#{$boldr-ns}notification__transition-enter-active {
  opacity: 1;
}

.#{$boldr-ns}notification__transition-leave {
  opacity: 1;
  transition: opacity 0.5s ease-in;
}

.#{$boldr-ns}notification__transition-leave-active {
  opacity: 0.01;
}

.#{$boldr-ns}notification {
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  max-height: 400px;
  padding: 0.5rem;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 1px 1px rgba(10, 10, 11, 0.125);
  margin-bottom: 2px;
  font: 1rem 400 Helvetica, sans-serif;
}

.#{$boldr-ns}notification__success {
  background-color: #64ce83;
}

.#{$boldr-ns}notification__info {
  background-color: #3ea2ff;
}

.#{$boldr-ns}notification__warning {
  background-color: #ff7f48;
}

.#{$boldr-ns}notification__danger {
  background-color: #e74c3c;
}

.#{$boldr-ns}notification__container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

// include all needed keyframes
@include notification-keyframes('top');

@include notification-keyframes('bottom');

@include notification-keyframes('left');

@include notification-keyframes('right');

@include notification-keyframes('top', 0);

// rotating animation for loading status
@keyframes rotating {
  from {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    transform: rotate(0deg);
  }

  to {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

// NotificationSystem component
.notifications-system {
  font-size: 14px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 1.428571429;
}

// NotificationContainer component
.notifications-container {
  position: fixed;
  z-index: 99999;
}

// for small to large screens, container position and notification animation is
// different depending on container position
.notifications-container {
  // change style of buttons depending of the notification position
  &--tc,
  &--tr,
  &--tl,
  &--bc,
  &--br,
  &--bl {
    width: $notification-max-width;

    .notification {
      &--buttons-1 .notification-button {
        height: 100%;
      }

      &--buttons-2 .notification-button {
        height: 50%;
      }

      &-buttons {
        width: $notification-button-width;

        .notification-button {
          display: block;
          width: $notification-button-width;

          &:nth-child(2) {
            border-top: 1px solid rgba(0, 0, 0, 0.09);
          }
        }
      }
    }
  }

  &--b,
  &--t {
    .notification {
      &--buttons-1 {
        .notification-buttons {
          width: $notification-button-width;
        }
      }

      &--buttons-2 {
        .notification-meta {
          width: calc(100% - #{$notification-button-width} * 2);
        }

        .notification-buttons {
          width: calc(#{$notification-button-width} * 2);
        }
      }

      &-buttons {
        .notification-button {
          float: left;
          width: $notification-button-width;
          height: 100%;
        }
      }
    }
  }

  // animations depending of the notification position
  &--t {
    @include notification-animation('top');
    top: 20px;
    left: 20px;
    width: calc(100% - 40px);
  }

  &--tc {
    @include notification-animation('top');
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
  }

  &--tr {
    @include notification-animation('right');
    top: 20px;
    right: 20px;
  }

  &--tl {
    @include notification-animation('left');
    top: 20px;
    left: 20px;
  }

  &--b {
    @include notification-animation('bottom');
    bottom: 0;
    left: 20px;
    width: calc(100% - 40px);
  }

  &--bc {
    @include notification-animation('bottom');
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
  }

  &--br {
    @include notification-animation('right');
    right: 20px;
    bottom: 0;
  }

  &--bl {
    @include notification-animation('left');
    bottom: 0;
    left: 20px;
  }
}

// put all notifications at the top of the screen
@media (max-width: #{$screen-xs-max}) {
  .notifications-container {
    &--t {
      @include notification-animation('top', 0);
      top: 0;
      left: 0;
      width: 100%;

      .notification-wrapper {
        margin: 0;
      }
    }
  }
}

// Notification component
.notification {
  @include md-shadow(2);
  position: relative;
  z-index: 999;
  display: table;
  width: 100%;
  height: 100%;
  min-height: 40px;
  border: none;

  &-wrapper {
    display: block;
    width: 100%;
    height: 100%;
    margin-bottom: $window-padding;
  }

  &-image-container {
    box-sizing: border-box;
    display: table-cell;
    padding: 10px 0 10px 15px;
  }

  &-image {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-size: cover;
    border-radius: 40px;
    vertical-align: top;
  }

  &-icon {
    box-sizing: border-box;
    display: inline-block;
    margin: 10px 0 10px 15px;
    // override font-size of `fa` class
    font-size: 20px !important;
  }

  &-meta {
    box-sizing: border-box;
    display: table-cell;
    width: 100%;
    padding: 10px 20px;
    vertical-align: top;
  }

  &-close-button-container {
    box-sizing: border-box;
    display: table-cell;
    padding: 10px 15px;
  }

  &-close-button {
    color: #524c4c;
    // override font-size of `fa` class
    font-size: 14px !important;
    cursor: pointer;

    &:before {
      content: $notification-close-button;
    }

    &:hover {
      color: lighten(#524c4c, 10%);
    }
  }
  // global style for buttons
  &-buttons {
    box-sizing: border-box;
    display: table-cell;
    height: 100%;
    vertical-align: top;

    .notification-button {
      box-sizing: border-box;
      min-height: 40px;
      padding: 0;
      color: #524c4c;
      background: none;
      border: none;
      border-left: 1px solid rgba(0, 0, 0, 0.09);
      outline: none;
      text-align: center;
      cursor: pointer;

      &-text {
        display: block;
        overflow: hidden;
        // width of a button with 10px of padding
        width: 70px;
        height: 25px;
        margin: 0 auto;
        font-size: 14px;
        line-height: 25px;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      &:hover {
        color: #349ef3;
      }

      &:active {
        color: darken(#349ef3, 10%);
      }
    }
  }

  &-title {
    margin: 0 0 10px;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.428571429;
  }

  &-message {
    margin: 0;
  }

  &--dismissible {
    cursor: pointer;
  }
  // color variants
  &--default {
    @include notification-variant($notification-default-bg, $notification-default-border, '');
  }

  &--success {
    @include notification-variant($notification-success-bg, $notification-success-border, $notification-success-icon);
  }

  &--info {
    @include notification-variant($notification-info-bg, $notification-info-border, $notification-info-icon);
  }

  &--warning {
    @include notification-variant($notification-warning-bg, $notification-warning-border, $notification-warning-icon);
  }

  &--error {
    @include notification-variant($notification-error-bg, $notification-error-border, $notification-error-icon);
  }

  &--loading {
    @include notification-variant($notification-loading-bg, $notification-loading-border, $notification-loading-icon);
    // infinite rotating animation
    .notification-icon {
      -webkit-animation: rotating 2s infinite linear;
      animation: rotating 2s infinite linear;
    }
  }
}
