<template>
  <div class="loading-container">
    <div class="loading-innter-container">
      <div class="co-name">
        <div class="lds-ring">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
        <h2 v-html="loadingTitle"></h2>
      </div>
      <div class="description">
        <p class="m-0 text-right">لطفا منتظر بمانید...</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    loadingTitle: {
      default: "در حال بارگزاری",
    },
  },
};
</script>
<style lang="scss" scoped>
.loading-container {
  position: fixed;
  left: 0;
  top: 10.1em;
  right: 14.5em;
  bottom: 0;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999999;

  &.absolute-positioning {
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
  }
  &.table-loading {
    position: static;
  }

  .co-name {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--primary);
    padding-bottom: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 2em;

    h2 {
      font-size: 1rem;
      margin: 0;
      margin-right: 0.5em;
    }
  }

  .description {
    font-size: 0.8rem;
    margin: 0;
  }

  .lds-ring {
    display: inline-block;
    position: relative;
    width: 1.5em;
    height: 1.5em;
  }

  .lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 1.2em;
    height: 1.2em;
    margin: 0.1em;
    border: 0.1em solid var(--primary);
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--primary) transparent transparent transparent;
  }

  .lds-ring div:nth-child(1) {
    animation-delay: -0.45s;
  }

  .lds-ring div:nth-child(2) {
    animation-delay: -0.3s;
  }

  .lds-ring div:nth-child(3) {
    animation-delay: -0.15s;
  }

  @keyframes lds-ring {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
}
</style>