@import '../colors';
@import '../mixins';

.tix-calendar.v4 {
  @include font-size-b2;
  background-color: $color-N0;
  min-height: 100vh;
  width: 100%;

  h3 {
    margin: 0;
  }

  .sticky-month-section {
    @include elevation-1;
    position: sticky;
    top: 44px;
    padding: 4px 16px;
    display: flex;
    background: $color-N0;
    transition: opacity 0ms linear, box-shadow 200ms linear;
    z-index: 998;
  }

  .day-names {
    &--container {
      height: 43px;
      display: flex;
      align-items: center;
    }

    &--item {
      width: 40px;
      flex: auto;
    }
  }

  .week {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .day-container {
    flex-grow: 1;

    &--withinInterval {
      background-color: $color-B100;
      border-radius: 0;
    }

    &--lastPick {
      background-color: transparent;
    }

    // e.g. dates: 30 31 1 2 3 4 5
    // we replace 1 2 3 4 5 with empty placeholders
    &--placeholder-not-in-month {
      flex-grow: 1;
      flex-basis: 40px;
    }
  }

  .weeknames-sticky {
    position: sticky;
    top: 0;
    z-index: 9999;
    background-color: $color-N0;
  }

  .month {
    padding: 0 10px;

    h3 {
      padding: 20px 8px;
    }
  }

  .day {
    -webkit-appearance: none;
    border: none;
    background: none;
    cursor: pointer;

    &:disabled {
      cursor: not-allowed;
    }

    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    width: 40px;
    height: 40px;

    &--number-container {
      position: relative;
    }

    &--holiday {
      color: $color-R400;
    }

    &--selected {
      background-color: $color-B400;
      flex-grow: initial;

      .price-text {
        color: $color-N100;
      }
      border-radius: 4px;

      .price-general-decoration {
        background-color: $font-color-invert;
      }
    }
  }

  .day-today-label {
    // "Today" label must be absolutely positioned 12px above the number (not against box, but against number)
    position: absolute;
    top: -26px; /* 14px line-height + 12px spacing */
    // horizontally centered
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap; /* prevent "Hari Ini" split to 2 lines */
  }

  // Decoration, absolutely positioned below day number
  .price-general-decoration {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 2px;

    &__benefit {
      background-color: $font-color-benefit;
    }
  }

  .holiday-list {
    margin: 0;
    margin-top: 32px;
    padding-left: 16px;
    box-sizing: border-box;
    display: flex;
    overflow-x: auto;
    width: 100%;
    white-space: nowrap;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */

    &::-webkit-scrollbar {
      display: none;
    }

    .holiday-item {
      display: flex;
      align-items: center;

      // bullet decorator between holiday-items
      &:not(:last-child)::after {
        content: '';
        position: relative;
        width: 2px;
        height: 2px;
        border-radius: 100%;
        background-color: $color-N400;
        margin-left: 9px;
        margin-right: 8px;
      }

      &:last-child {
        padding-right: 16px; /* white-space */
      }
    }
  }

  .placeholder-no-holiday-in-month {
    height: 48px;
  }

  // container for legend(s) and confirmation
  .sticky-bottom-container {
    @include elevation-1;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .legends-section {
    background-color: $color-N100;
    padding: 4px 20px;
  }

  .legend {
    display: flex;
    align-items: center;
  }

  .legend-decoration {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 8px;

    &__benefit {
      background-color: $font-color-benefit;
    }
  }

  .confirmation-section {
    background-color: $color-N0;
    padding: 12px 20px 16px;
  }

  .confirmation-panes-container {
    display: flex;
    justify-content: space-between;
  }

  .confirmation-button-container {
    margin-top: 12px;
  }
}
