@use '../../scss/_bootstrap-extended/include' as light;
@use '../../scss/_bootstrap-extended/include-dark' as dark;
@import '../../scss/_custom-variables/libs';
@import 'toastr/toastr.scss';

#toast-container {
  > div {
    padding: 15px 25px 15px 50px !important;
    opacity: 1;
    margin-bottom: light.$toast-spacing;
    @include app-rtl {
      direction: rtl;
      background-position: center right 0.9375rem;
      padding: 15px 50px 15px 25px !important;
    }
  }
  &.toast-top-left {
    @include app-rtl {
      right: 12px;
      left: auto;
    }
  }
  &.toast-top-right {
    @include app-rtl {
      left: 12px;
      right: auto;
    }
  }
  &.toast-bottom-left {
    @include app-rtl {
      right: 12px;
      left: auto;
    }
  }
  &.toast-bottom-right {
    @include app-rtl {
      left: 12px;
      right: auto;
    }
  }
  &.toast-top-full-width,
  &.toast-bottom-full-width {
    &#toast-container > div {
      @include app-rtl {
        left: 0;
        right: 0;
      }
    }
  }
  > .toast {
    max-width: 100%;
    background-size: 28px;
    background-repeat: no-repeat;
    overflow: visible;
  }
  &.toast-bottom-full-width > div,
  &.toast-top-full-width > div {
    padding: 15px 50px 15px 50px !important;
    width: 100%;
    margin-bottom: 0;
    border-radius: 0 !important;
    .toast-close-button {
      top: 12px !important;
      @include app-ltr {
        right: 12px !important;
      }
      @include app-rtl {
        left: 12px !important;
      }
    }
  }

  > .toast-info {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='#{light.str-replace(#{light.$info},'#','%23')}' d='M256 90c44.3 0 86 17.3 117.4 48.6C404.7 170 422 211.7 422 256s-17.3 86-48.6 117.4C342 404.7 300.3 422 256 422s-86-17.3-117.4-48.6C107.3 342 90 300.3 90 256s17.3-86 48.6-117.4C170 107.3 211.7 90 256 90m0-42C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48z'/%3E%3Cpath fill='#{light.str-replace(#{light.$info},'#','%23')}' d='M277 360h-42V235h42v125zm0-166h-42v-42h42v42z'/%3E%3C/svg%3E") !important;
    .toast-close-button {
      background-color: light.$info !important;
      box-shadow: 0 0.125rem 0.25rem rgba(light.$info, 0.4) !important;
    }
  }
  > .toast-error {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='#{light.str-replace(#{light.$danger},'#','%23')}' d='M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z'/%3E%3C/svg%3E") !important;
    .toast-close-button {
      background-color: light.$danger !important;
      box-shadow: 0 0.125rem 0.25rem rgba(light.$danger, 0.4) !important;
    }
  }
  > .toast-success {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='#{light.str-replace(#{light.$success},'#','%23')}' d='M186.301 339.893L96 249.461l-32 30.507L186.301 402 448 140.506 416 110z'/%3E%3C/svg%3E") !important;
    .toast-close-button {
      background-color: light.$success !important;
      box-shadow: 0 0.125rem 0.25rem rgba(light.$success, 0.4) !important;
    }
  }
  @include app-rtl(false) {
    > .toast-success {
      background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='#{light.str-replace(#{light.$success},'#','%23')}' d='M96 110l-32 30.5L325.7 402L448 280l-32-30.5l-90.3 90.4L96 110z'/%3E%3C/svg%3E") !important;
    }
  }
  > .toast-warning {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='#{light.str-replace(#{light.$warning},'#','%23')}' d='M32 464h448L256 48 32 464zm248-64h-48v-48h48v48zm0-80h-48v-96h48v96z'/%3E%3C/svg%3E") !important;
    background-size: 25px;
    .toast-close-button {
      background-color: light.$warning !important;
      box-shadow: 0 0.125rem 0.25rem rgba(light.$warning, 0.4) !important;
    }
  }
}
// for full width toasts
#toast-container:not(.toast-bottom-full-width, .toast-top-full-width) > div {
  width: 20em !important;
}

.toast-progress {
  position: absolute;
  bottom: auto;
  top: 0;
  opacity: 0.15;
  height: 0.1875rem;
  -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=15);
  filter: alpha(opacity=15);

  @include app-rtl {
    left: auto;
    right: 0;
  }
}

.toast-close-button {
  position: absolute;
  top: -8px;
  text-shadow: none;
  border-radius: light.$border-radius;
  padding: 0.3rem 0.45rem !important;
  transition: all 0.23s ease 0.1s;
  opacity: 1 !important;
  line-height: 0.8;

  @include app-ltr {
    right: -7px !important;
  }
  @include app-rtl {
    left: -7px !important;
    right: auto !important;
  }
}

@media (max-width: 419.98px) {
  .toast {
    width: 300px !important;
  }
}

// Light style
@if $enable-light-style {
  .light-style {
    #toast-container {
      z-index: light.$zindex-notification;

      .toast-close-button {
        font-weight: light.$close-font-weight;
        color: light.$btn-close-color !important;
        background-color: light.$card-bg;
        box-shadow: light.$box-shadow-sm;
      }

      > div {
        box-shadow: light.$toast-box-shadow !important;
        border-radius: light.$border-radius;
      }

      > .toast-success,
      > .toast-success .toast-message a,
      > .toast-success .toast-message label {
        background-color: light.color-contrast(map-get(light.$theme-colors, success));
        color: map-get(light.$theme-colors, success);
      }

      > .toast-error,
      > .toast-error .toast-message a,
      > .toast-error .toast-message label {
        background-color: light.color-contrast(map-get(light.$theme-colors, danger));
        color: map-get(light.$theme-colors, danger);
      }

      > .toast-info,
      > .toast-info .toast-message a,
      > .toast-info .toast-message label {
        background-color: light.color-contrast(map-get(light.$theme-colors, info));
        color: map-get(light.$theme-colors, info);
      }

      > .toast-warning,
      > .toast-warning .toast-message a,
      > .toast-warning .toast-message label {
        background-color: light.color-contrast(map-get(light.$theme-colors, warning));
        color: map-get(light.$theme-colors, warning);
      }
      > .toast-success,
      > .toast-error,
      > .toast-info,
      > .toast-warning {
        .toast-close-button {
          color: light.$white !important;
        }
      }
    }
  }
}

// Dark style
@if $enable-dark-style {
  .dark-style {
    #toast-container {
      z-index: dark.$zindex-notification;

      .toast-close-button {
        font-weight: dark.$close-font-weight;
        color: dark.$btn-close-color !important;
        background-color: dark.$card-bg;
        box-shadow: dark.$box-shadow-sm;
      }

      > div {
        box-shadow: dark.$toast-box-shadow !important;
        border-radius: dark.$border-radius;
      }

      > .toast-success,
      > .toast-success .toast-message a,
      > .toast-success .toast-message label {
        background-color: dark.$card-bg;
        color: map-get(dark.$theme-colors, success);
      }

      > .toast-error,
      > .toast-error .toast-message a,
      > .toast-error .toast-message label {
        background-color: dark.$card-bg;
        color: map-get(dark.$theme-colors, danger);
      }

      > .toast-info,
      > .toast-info .toast-message a,
      > .toast-info .toast-message label {
        background-color: dark.$card-bg;
        color: map-get(dark.$theme-colors, info);
      }

      > .toast-warning,
      > .toast-warning .toast-message a,
      > .toast-warning .toast-message label {
        background-color: dark.$card-bg;
        color: map-get(dark.$theme-colors, warning);
      }
    }
  }
}
