/* Common Class */
.ikmd-display-flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -moz-flex;
  display: -ms-flexbox;
  display: flex;
}

.ikmd-animation-settings {
  -webkit-animation-duration: 0.3s;
  -moz-animation-duration: 0.3s;
  animation-duration: 0.3s;
  -webkit-animation-delay: 0s;
  -moz-animation-delay: 0s;
  animation-delay: 0s;
}

@each $split in 1, 2, 3, 4 {
  .ikmd-box-flex-#{$split} {
    -webkit-box-flex: #{$split};
    -webkit-flex: #{$split};
    -moz-box-flex: #{$split};
    -moz-flex: #{$split};
    -ms-flex: #{$split};
    flex: #{$split};
  }
}

/* Input Group and Text Group */
.ikmd-input-group-container, .ikmd-text-group-container {
  padding-top: $ikmd-white-space-8;
  background-color: $ikmd-color-t5;

  .ikmd-input-group-header, .ikmd-text-group-header {
    padding: 0 $ikmd-wing-blank $ikmd-white-space-8;
    font-size: $ikmd-font-size-t3;
  }

  .ikmd-input-group-header + .ikmd-input-group, .ikmd-text-group-header + .ikmd-text-group {
    margin-top: 0 !important;
  }

  .ikmd-input-group, .ikmd-text-group {
    margin-top: $ikmd-white-space-8;
    padding: 0 0 0 $ikmd-wing-blank;
    background-color: white;
    border: 1px solid $ikmd-color-t5;
    border-left: none;
    border-right: none;

    .ikmd-input, .ikmd-select, .ikmd-text {
      background-color: white;

      &:last-child::after {
        display: none;
      }
    }

    .ikmd-btn {
      width: 100%;
      height: $ikmd-btn-height;
      margin: 0 auto;

      &.ikmd-btn-primary {
        width: 100%;
        margin: 0;
        text-align: center;
      }
    }
  }
}

/* Input and Text */
.ikmd-input, .ikmd-text {
  position: relative;
  padding: 22px 0 8px;

  &::after {
    content: "";
    height: 1px;
    width: 100%;
    left: 0;
    bottom: 0;
    position: absolute;
    background-color: $ikmd-color-t5;
  }

  &.ikmd-input-text {
    min-height: 60px;

    span {
      display: block;
      margin-top: 5px;
      color: $ikmd-color-t3 !important;
      font-size: $ikmd-font-size-t2;
    }
  }

  svg {
    fill: $ikmd-theme-color;
  }

  label {
    position: absolute;
    top: 18px;
    left: 0;
    color: $ikmd-theme-color;
    font-size: $ikmd-font-size-t2;

    &.shrunken {
      -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
      transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
      -webkit-transform: scale(0.75) translate(-18%, -50%);
      transform: scale(0.75) translate(-18%, -50%);
    }
  }

  input,
  textarea,
  span {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: $ikmd-font-size-t2;
    border: none;
    color: $ikmd-color-t2;
  }

  textarea {
    min-height: 120px;
    height: auto;
  }

  p {
    position: absolute;
    top: 20px;
    right: 17px;
    color: $ikmd-color-t4;
    font-size: $ikmd-font-size-t3;
    max-width: 50%;
    text-align: right;
    word-break: break-all;
    word-wrap: break-word;
    background: white;
    pointer-events: none;

    &.ikmd-input-errors {
      color: $ikmd-color-t7;
    }
  }

  svg {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
  }
}

.ikmd-text span {
  min-height: 24px;
}

/* Select */
.ikmd-select {
  position: relative;
  padding: 22px 0 8px;

  &::after {
    content: "";
    height: 1px;
    width: 100%;
    left: 0;
    bottom: 0;
    position: absolute;
    background-color: #eee;
  }

  .ikmd-select-title {
    position: absolute;
    top: 18px;
    left: 0;
    color: #459df5;
    font-size: $ikmd-font-size-t2;

    &.shrunken {
      -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
      transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
      -webkit-transform: scale(0.75) translate(-18%, -50%);
      transform: scale(0.75) translate(-18%, -50%);
    }
  }

  .ikmd-select-subtitle {
    display: block;
    width: 100%;
    height: 30px;
    padding: 5px 0;
    font-size: 16px;
    border: none;
    color: $ikmd-color-t2;
  }

  .ikmd-select-tips {
    position: absolute;
    top: 20px;
    right: #{25 + $ikmd-space-base}px;
    color: $ikmd-color-t4;
    font-size: $ikmd-font-size-t3;
    max-width: 50%;
    text-align: right;
    word-break: break-all;
    word-wrap: break-word;
    background: white;

    &.ikmd-input-tips {
      color: #323232;
    }

    &.ikmd-input-errors {
      color: $ikmd-color-t7;
    }
  }

  .ikmd-select-arrow {
    position: absolute;
    top: 20px;
    right: 17px;
    color: $ikmd-color-t4;
    font-size: $ikmd-font-size-t3;
  }
}

/* Button Group */
.ikmd-btn-group-wrapper {
  .ikmd-btn-group-container {
    width: 100%;
    padding-top: $ikmd-white-space-8;
    background-color: $ikmd-color-t5;

    .ikmd-btn-group-header {
      padding: 0 $ikmd-wing-blank $ikmd-white-space-8;
      font-size: $ikmd-font-size-t3;

      & + .ikmd-btn-group {
        margin-top: 0 !important;
      }
    }

    .ikmd-btn-group {
      margin-top: $ikmd-white-space-8;
    }

    &.ikmd-btn-group-bottom {
      //position: absolute
      //left: 0
      position: fixed;
      bottom: 0;
      left: 0;
      height: 48px;

      .ikmd-btn-group {
        position: fixed;
        left: 0;
        bottom: 0;
      }

      .ikmd-btn-group-bottom-placeholder {
        height: 48px;
      }
    }

    .ikmd-btn-group {
      @extend .ikmd-display-flex;

      width: 100%;

      > button {
        @extend .ikmd-box-flex-1;

        border-right: 1px solid $ikmd-color-t5;

        &:last-child {
          border-right: none;
        }

        &.ikmd-btn-primary {
          border-color: white;
        }
      }
    }
  }

  .ikmd-btn-group-bottom-placeholder {
    height: 48px;
  }
}

/* Button */
.ikmd-btn {
  display: block;
  height: $ikmd-btn-height;
  font-size: $ikmd-font-size-t2;
  color: $ikmd-theme-color;
  background-color: white;
  text-align: center;
  border: none;

  &.ikmd-btn-primary {
    color: white;
    background-color: $ikmd-theme-color;
  }

  .ikmd-btn-icon-wrapper {
    display: inline-block;
    vertical-align: middle;

    > * {
      display: inline;
      vertical-align: middle;
    }

    svg {
      width: 20px;
      height: 20px;
      fill: $ikmd-theme-color;
    }

    p {
      margin-left: 10px;
    }
  }
}

/* Date Picker */
.ikmd-date-picker-cover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: $ikmd-date-picker-cover-zIndex;
  width: 100%;
  height: 100%;
  background-color: #000;
  opacity: 0.3;
}

.ikmd-date-picker {
  @extend .ikmd-animation-settings;

  position: fixed;
  left: 0;
  bottom: 0;
  z-index: $ikmd-date-picker-zIndex;
  width: 100%;
  height: 300px;
  background-color: white;

  .ikmd-date-picker-header {
    @extend .ikmd-display-flex;

    height: 48px;
    padding: 0 $ikmd-wing-blank;
    overflow: hidden;
    border-bottom: 1px solid $ikmd-color-t5;

    > div {
      height: 100%;
      font-size: $ikmd-font-size-t2;
      line-height: 48px;

      &.ikmd-date-picker-header-left, &.ikmd-date-picker-header-right {
        @extend .ikmd-box-flex-1;

        color: $ikmd-theme-color;
      }

      &.ikmd-date-picker-header-right {
        text-align: right;
      }

      &.ikmd-date-picker-header-title {
        @extend .ikmd-box-flex-4;

        color: $ikmd-color-t2;
        text-align: center;
      }
    }
  }

  .ikmd-date-picker-body {
    @extend .ikmd-display-flex;

    width: 100%;
    height: 252px;

    .ikmd-date-picker-item {
      position: relative;

      @extend .ikmd-box-flex-1;

      .ikmd-date-picker-item-mask {
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1201;
        width: 100%;
        height: 100%;
        background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6)), linear-gradient(0deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6));
        background-size: 100% 108px;
        background-position: top, bottom;
        background-repeat: no-repeat;
        pointer-events: none;
      }

      .ikmd-date-picker-item-indicator {
        position: absolute;
        left: 0;
        top: 108px;
        width: 100%;
        height: 36px;
        border: 1px solid $ikmd-color-t5;
        border-left: none;
        border-right: none;
      }

      .ikmd-date-picker-item-content {
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1200;
        width: 100%;
        height: 100%;
        display: none;
        text-align: center;
        font-size: $ikmd-font-size-t2;
        color: $ikmd-color-t2;

        .ikmd-date-picker-item-content-item {
          width: 100%;
          height: 36px !important;
          line-height: 36px !important;
        }
      }
    }
  }
}

/* Filter Bar */
.ikmd-filter-bar {
  .ikmd-filter-bar-filter-container {
    @extend .ikmd-animation-settings;

    //position: relative
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1007;
    width: 100%;
    background-color: white;

    //height: 100%

    .ikmd-filter-bar-categories {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 1008;
      height: 100%;
      overflow: hidden;
      background-color: white;
      border-bottom: 1px solid $ikmd-color-t5;

      > div {
        float: left;
      }

      .ikmd-filter-bar-category {
        height: 100%;
        text-align: center;

        p {
          color: $ikmd-color-t3;
          border-right: 1px solid $ikmd-color-t5;
          font-size: $ikmd-font-size-t3;

          &.active {
            color: $ikmd-theme-color;
          }

          i {
            font-size: 10px;
          }
        }
      }
    }

    .ikmd-filter-bar-search {
      position: absolute;
      top: 0;
      right: 0;
      z-index: 1008;
      padding-top: 15px;
      text-align: center;
      font-size: $ikmd-font-size-t3;
      border-bottom: 1px solid $ikmd-color-t5;
    }

    .ikmd-filter-bar-category-cover, .ikmd-filter-bar-category-buttons, .ikmd-filter-bar-toolbar {
      position: fixed;
      left: 0;
      z-index: 1006;
      width: 100%;
    }

    .ikmd-filter-bar-category-cover {
      background-color: black;
      opacity: 0.6;
    }

    .ikmd-filter-bar-category-buttons {
      @extend .ikmd-animation-settings;

      z-index: 1007;
      display: none;
      background-color: white;
      border-bottom: 1px solid $ikmd-color-t5;

      .ikmd-filter-bar-category-buttons-left, .ikmd-filter-bar-category-buttons-right {
        float: left;
        height: 200px;
        overflow-y: auto;
      }

      .ikmd-filter-bar-category-buttons-left {
        background-color: $ikmd-color-o2;

        a {
          display: block;
          width: 100%;
          height: 40px;
          color: $ikmd-color-t4;
          font-size: $ikmd-font-size-t3;
          text-align: center;
          line-height: 40px;

          &.active {
            background-color: white;
          }
        }
      }

      .ikmd-filter-bar-category-buttons-right {
        background-color: white;
      }

      .ikmd-filter-bar-category-button {
        word-break: break-all;
        word-wrap: break-word;
        position: relative;
        height: 40px;
        padding-left: #{$ikmd-space-base}px;
        line-height: 40px;

        &.active {
          p, i {
            color: $ikmd-theme-color;
          }
        }

        p {
          color: $ikmd-color-t4;
          font-size: $ikmd-font-size-t3;
          border-bottom: 1px solid $ikmd-color-t5;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }

        i {
          position: absolute;
          top: 15px;
          right: #{$ikmd-space-base}px;
          font-size: $ikmd-font-size-t3;
        }
      }
    }

    .ikmd-filter-bar-toolbar {
      z-index: 1007;
      display: none;
      height: 40px;
      background-color: white;

      .ikmd-filter-bar-toolbar-button {
        display: block;
        float: left;
        height: 100%;
        text-align: center;
        font-size: $ikmd-font-size-t3;
        line-height: 40px;
        border-right: 1px solid $ikmd-color-t5;

        &:last-child {
          border-right: none;
        }
      }
    }
  }

  .ikmd-filter-bar-search-container {
    @extend .ikmd-animation-settings;

    position: absolute;
    top: 0;
    left: 0;
    z-index: 1009;
    display: none;
    padding-left: #{$ikmd-space-base}px;
    overflow: hidden;
    background-color: $ikmd-color-o1;

    form {
      position: relative;

      > * {
        display: block;
        float: left;
      }

      input {
        padding: 0 30px;
        border-radius: 75px;
        border: none;
      }

      i {
        position: absolute;
        top: 16px;
        font-size: 18px;

        &.ikmd-filter-bar-search-magnifier {
          left: 10px;
        }

        &.ikmd-filter-bar-search-clear {
          right: 58px;
        }
      }
    }

    .ikmd-filter-bar-search-cancel {
      color: $ikmd-theme-color;
      font-size: $ikmd-font-size-t3;
      text-align: center;
    }

    .ikmd-filter-bar-search-result {
      position: absolute;
      left: 0;
      z-index: 1006;
      width: 100%;
      height: 100%;
      background-color: $ikmd-color-t5;
      pointer-events: none;
    }
  }
}

/* Loading */
.ikmd-loading {
  width: 50px;
  height: 50px;
  margin: 20px auto;

  > div {
    display: inline-block;
    width: 0.5rem;
    height: 100%;
    margin-left: 0.2rem;
    background-color: $ikmd-theme-color;
    -webkit-animation: stretch-delay 1.2s infinite ease-in-out;
    animation: stretch-delay 1.2s infinite ease-in-out;
  }

  .ikmd-loading-rect1 {
    margin-left: 0;
  }

  .ikmd-loading-rect2 {
    -webkit-animation-delay: -1.1s;
    animation-delay: -1.1s;
  }

  .ikmd-loading-rect3 {
    -webkit-animation-delay: -1s;
    animation-delay: -1s;
  }

  .ikmd-loading-rect4 {
    -webkit-animation-delay: -0.9s;
    animation-delay: -0.9s;
  }

  .ikmd-loading-rect5 {
    -webkit-animation-delay: -0.8s;
    animation-delay: -0.8s;
  }

  @-webkit-keyframes stretch-delay {
    0%, 40%, 100% {
      -webkit-transform: scaleY(0.4);
    }

    20% {
      -webkit-transform: scaleY(1);
    }
  }

  @keyframes stretch-delay {
    0%, 40%, 100% {
      transform: scaleY(0.4);
      -webkit-transform: scaleY(0.4);
    }

    20% {
      transform: scaleY(1);
      -webkit-transform: scaleY(1);
    }
  }
}

/* Scroll Up Load */
.ikmd-scroll-up-loader-wrapper {
  width: 100%;
  padding: #{$ikmd-space-base}px;
  text-align: center;

  .ikmd-scroll-up-loader {
    display: inline-block;
    margin: 0 auto;
    overflow: hidden;

    i {
      display: block;
      float: left;
      margin: 2px 0 0 5px;
      font-size: $ikmd-font-size-t3;
    }

    p {
      float: left;
      margin-left: #{$ikmd-space-base}px;
    }
  }
}

/* Check Box */
.ikmd-check-box-container {
  position: relative;

  i.ikmd-check-box {
    position: absolute;
    top: 20px;
    right: 8px;
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: $ikmd-theme-color;
  }
}
