html {
  box-sizing: border-box;
  overflow-y: scroll;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Variables */
$modalian-border-radius: 10px;
$modalian-z-index: 9000;
$modalian-header-height: 52px;
$modalian-footer-height: 66px;
$modalian-black: #222222;
$modalian-white: #fefefe;
$modalian-grey-light: #fafafa;
$modalian-grey: #c1c1c1;
$modalian-grey-dark: #666666;
$modalian-blue: #50a8f6;

.modalian {
  $root: &;
  &--show { animation: fadeIn .2s ease-in forwards; }
  &--hide { animation: fadeOut .2s ease-out forwards; }
  &--none { display: none; }

  &-mask {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(black, .35);
    z-index: $modalian-z-index;
    &--show { animation: fadeIn .1s ease-in forwards; }
    &--hide { animation: fadeOut .2s ease-out forwards; }
    &--none { display: none; }
  }

  &-wrapper {
    position: fixed;
    display: flex;
    justify-content: center;
    top: 75px;
    left: 0;
    width: 100%;
    z-index: $modalian-z-index + 1;
    color: $modalian-black;
    &--show { 
      animation: fadeIn .2s ease-in forwards; 
      #{$root}__content {
        transform: scale(1); 
      } 
    }
    &--hide { animation: fadeOut .1s ease-out forwards; }
    &--none { display: none; }
  }

  &__content {
    display: block;
    position: relative;
    width: 500px;
    height: auto;
    font-family: sans-serif;
    background: $modalian-white;
    border-radius: $modalian-border-radius;
    overflow: hidden;
    box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.3);
    transition: all .1s ease-in;
    transform: scale(.75);
    transform-origin: center;
    &--confirm {
      @extend #{$root}__content;
      width: 350px;
    }
    .rtl & {
      direction: rtl;
    }
  }


	&__header {
    display: flex;
    padding: 0 12px;
    height: $modalian-header-height;
    align-items: center;
    background: $modalian-grey-light;
    border-bottom: 1px solid $modalian-grey;
    &--hidden {
      @extend #{$root}__header;
      height: 0;
      border-bottom: none;
      > #{$root}__close-btn {
        top: 10px;
      }
      + #{$root}__body {
        top: 0;
        height: 100%;
      }
    }
    > h2 { font-size: 18px; }
  }

  &__body {
    display: block;
    top: 0px;
    padding: 16px;
    height: 100%;
    width: 100%;
    background: $modalian-white;
    font-size: 15px;
    .rtl & {
      direction: rtl;
    }

    &--confirm {
      @extend #{$root}__body;
      height: auto !important;
      border-radius: $modalian-border-radius;
      h2 {
        margin: 16px;
        font-size: 18px;
      }
      span {
        display: block;
        margin: -8px 18px 16px;
        font-size: 13px;
        color: lighten($modalian-grey-dark, 10%);
      }
    }
  }

  &__footer {
    display: flex;
    align-items: center;
    direction: rtl;
    padding: 16px;
    width: 100%;
    height: $modalian-footer-height;
    background: $modalian-grey-light;
    border-top: 1px solid $modalian-grey;
    .rtl & {
      direction: ltr;
    }
    &--confirm {
      @extend #{$root}__footer;
      height: auto;
      padding: 0 24px 24px; 
      border: none;
      background: transparent;

    }
  }


  &__close-btn {
    position: absolute;
    top: 15px;
    right: 10px;
    padding: 5px;
    z-index: $modalian-z-index + 1;
    cursor: pointer;
    .rtl & { 
      left: 10px;
      right: auto;
    }
  }

  &__btn {
    display: flex;
    padding: 10px 16px;
    align-items: center;
    border-radius: $modalian-border-radius / 2;
    outline: none;
    height: 35px;
    font-size: 12px;
    &--confirm {
      @extend #{$root}__btn;
      background: $modalian-blue;
      color: $modalian-white;
      transition: all .2s ease-in-out;
      &:hover { background: darken($modalian-blue, 5%); }
    }
    &--cancel {
      @extend #{$root}__btn;
      margin-right: 12px;
      border: 1px solid $modalian_grey;
      color: $modalian-grey-dark;
      transition: all .2s ease-in-out;
      .rtl & {
        margin-right: 0;
        margin-left: 12px;
      }
      &:hover {
        border: 1px solid $modalian-blue;
        color: darken($modalian-blue, 5%);
      }
    }
  }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  90% { opacity: 1; }
  100% { opacity: 1 }
}

@keyframes fadeOut {
  0% { opacity: 1; }
  90% { opacity: 0; }
  100% { opacity: 0; }
}
