@import '../../style/mixins';
@import '../../style/themes/default';
@prefixClass: am-calendar;

// Animation
.@{prefixClass} {
  .animate {
    animation-duration: .3s;
    animation-fill-mode: both;
  }
  @keyframes fadeIn {
    0% {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }
  @keyframes fadeOut {
    0% {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }

  .fade-enter {
    animation-name: fadeIn;
  }

  .fade-leave {
    animation-name: fadeOut;
  }
  @keyframes slideInUp {
    0% {
      transform: translate3d(0, 100%, 0);
      visibility: visible;
    }

    to {
      transform: translateZ(0);
    }
  }
  @keyframes slideInDown {
    0% {
      transform: translateZ(0);
      visibility: visible;
    }

    to {
      transform: translate3d(0, 100%, 0);
    }
  }
  @keyframes slideInLeft {
    0% {
      transform: translate3d(100%, 0, 0);
      visibility: visible;
    }

    to {
      transform: translateZ(0);
    }
  }
  @keyframes slideInRight {
    0% {
      transform: translateZ(0);
      visibility: visible;
    }

    to {
      transform: translate3d(100%, 0, 0);
    }
  }

  .slideV-enter {
    animation-name: slideInUp;
  }

  .slideV-leave {
    animation-name: slideInDown;
  }

  .slideH-enter {
    animation-name: slideInLeft;
  }

  .slideH-leave {
    animation-name: slideInRight;
  }
}

// Calendar
.@{prefixClass} {
  .mask {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: @modal-zindex;
    background: rgba(0, 0, 0, .5);
  }

  .content {
    position: fixed;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: @modal-zindex;
    background: #fff;
  }

  .header {
    margin: 5 * @hd;
    display: flex;
    flex-shrink: 0;
    align-items: center;

    .title {
      text-align: center;
      width: 100%;
      font-size: @font-size-caption;
      font-weight: bold;
    }

    .left {
      position: absolute;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 0 8 * @hd;
      height: 24 * @hd;
      left: 5 * @hd;
      top: 5 * @hd;
      color: #068EEF;
    }

    .right {
      position: absolute;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 0 8 * @hd;
      height: 24 * @hd;
      right: 5 * @hd;
      top: 5 * @hd;
      color: #068EEF;
      font-size: 14 * @hd;
    }
  }

  .timePicker {
    border-top: 1PX #ccc solid;
  }
}

// WeekPanel
.@{prefixClass} .week-panel {
  background: #fff;
  display: flex;
  flex-shrink: 0;
  padding: 0 2 * @hd;
  border-bottom: @border-width-sm @border-color-base solid;

  .cell {
    height: 24 * @hd;
    display: flex;
    width: 100/7%;
    justify-content: center;
    align-items: center;
    color: @color-text-base;
    font-size: @font-size-base;
  }

  .cell-grey {
    color: @color-text-placeholder;
  }
}

// DatePicker
.@{prefixClass} .date-picker {
  display: flex;
  flex-direction: column;
  background: #eee;
  padding-bottom: env(safe-area-inset-bottom);
  flex: 1;
  min-height: 0;

  .wrapper {
    height: auto;
    position: relative;
    flex: 1;
    min-height: 0;
  }

  .months {
    background: #fff;
  }

  .load-tip {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    left: 0;
    right: 0;
    padding: 10 * @hd 0;
    top: -40 * @hd;
    color: #bbb;
  }
}

// ConfirmPanel
.@{prefixClass} .confirm-panel {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  background: @fill-grey;
  padding: @h-spacing-md @h-spacing-lg;
  border-top: @border-color-base @border-width-sm solid;

  .info {
    font-size: @font-size-caption-sm;

    p {
      margin: 0;
    }

    p + p {
      margin-top: @h-spacing-md;
    }

    .grey {
      color: @color-text-placeholder;
    }
  }

  .button {
    text-align: center;
    width: 80 * @hd;
    margin: 0 0 0 auto;
    padding: @h-spacing-md 0;
    border-radius: @radius-md;
    color: @color-text-base-inverse;
    font-size: @button-font-size;
    background: @brand-primary;
    background: @primary-button-fill;
  }

  .button-disable {
    color: @color-text-disabled;
    background: @fill-disabled;
  }

  .button-full {
    width: 100%;
    text-align: center;
  }
}

// TimePicker
.@{prefixClass} .time-picker {
  flex-shrink: 0;
  text-align: center;
  background: #fff;

  .title {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 44 * @hd;
    font-size: @font-size-caption;
    border-top: @border-width-sm @border-color-base solid;
    border-bottom: @border-width-sm @border-color-base solid;
  }
}

// SingleMonth
.@{prefixClass} .single-month {
  padding: 0;

  .month-title {
    margin: 0;
    padding: @v-spacing-xl 0 @v-spacing-sm @h-spacing-lg;
  }

  .row {
    display: flex;
    align-items: baseline;
    @cell-size: 35 * @hd;

    .cell {
      display: flex;
      flex-direction: column;
      width: 100/7%;
      justify-content: center;
      align-items: center;

      .date-wrapper {
        display: flex;
        height: @cell-size;
        width: 100%;
        justify-content: center;
        align-items: center;
        margin-bottom: 2 * @hd;

        .date {
          display: flex;
          justify-content: center;
          align-items: center;
          width: @cell-size;
          height: @cell-size;
          flex-shrink: 0;
          color: @color-text-base;
          font-size: @font-size-heading;
          font-weight: bold;
        }

        .disable {
          color: @color-text-disabled;
          background: #eee;
          border: none;
          border-radius: 100%;
        }

        .grey {
          color: @color-text-placeholder;
        }

        .important {
          border: @border-width-sm @border-color-base solid;
          border-radius: 100%;
        }

        .left,
        .right {
          border: none;
          width: 100%;
          height: @cell-size;
        }

        .date-selected {
          border: none;
          background: @brand-primary;
          color: @color-text-base-inverse;
          font-size: @font-size-heading;
        }

        .selected-start {
          border-radius: 100% 0 0 100%;
        }

        .selected-single {
          border-radius: 100%;
        }

        .selected-middle {
          border-radius: 0;
        }

        .selected-end {
          border-radius: 0 100% 100% 0;
        }
      }

      .info {
        height: @font-size-icontext + 5;
        width: 100%;
        padding: 0 5 * @hd;
        font-size: @font-size-icontext;
        color: @color-text-caption;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        text-align: center;
      }

      .date-selected {
        color: @brand-primary;
      }
    }
  }

  .row + .row {
    margin-top: @v-spacing-sm;
  }

  .row-xl + .row-xl {
    margin-top: @v-spacing-xl;
  }
}

// ShortcutPanel
.@{prefixClass} .shortcut-panel {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  padding: 0 30 * @hd;
  border-top: @border-color-base @border-width-sm solid;
  height: @option-height;

  .item {
    display: inline-block;
    color: @brand-primary;
    font-size: @font-size-caption;
  }
}
