@import "../mixins";

.rc-datepicker {
  $input-border-width: 1px;

  position: relative;
  background-color: $input-bg;
  border-radius: $input-border-radius;

  >.rc-icon {
    position: absolute;
    top: $padding-base-vertical + $input-border-width;
    right: $padding-base-horizontal + $input-border-width;
    color: $primaryColor;
  }

  &.rc-datepicker-disabled {
    background-color: $input-bg-disabled;
    cursor: $cursor-disabled;
  }


  @import "~react-datetime/css/react-datetime";

  .rdt {

    .form-control {
      padding-right: 30px;
      &, &[readonly], &[disabled] {
        background: transparent;
      }
    }

    .rdtPicker {
      top: 40px;
      z-index: 10000;
      width: $component-offset-horizontal * 2;
      padding: 10px;
      background: $whiteColor;
      border: 1px solid $mediumGrayColor;
      border-radius: $input-border-radius;

      // window arrow
      &:before {
        content: "";
        transform: rotate(45deg);
        position: absolute;
        top: -5px;
        left: 16px;
        border: 1px solid $mediumGrayColor;
        background-color: $whiteColor;
        width: 10px;
        height: 10px;
        z-index: -1;
      }
      &:after {
        content: "";
        position: absolute;
        background-color: $whiteColor;
        top: 0;
        left: 11px;
        height: 9px;
        width: 20px;
        z-index: -1;
      }

      th.rdtSwitch {
        width: auto;
      }

      // left, right buttons
      th.rdtNext, th.rdtPrev {
        width: 37px;
        &:hover {
          background-color: $whiteColor;
        }
        span {
          font-family: 'rc-font' !important;
          font-style: normal;
          font-weight: normal;
          font-variant: normal;
          font-size: $font-size-base;
          line-height: 33px;
          color: $whiteColor;
          background-color: $whiteColor;
          position: relative;
          &:before {
            position: absolute;
            left: 0; top: 0;
            text-align: center;
            width: 37px;
            color: $darkGrayColor;
          }
          &:hover {
            color: $secondaryColor;
            background-color: $secondaryColor;
            &:before {
              color: $primaryColor;
            }
          }
        }
      }
      th.rdtNext span:before {
        content: getIcoMoonContent($rc-icon-chevron-right-small);
      }
      th.rdtPrev span:before {
        content: getIcoMoonContent($rc-icon-chevron-left-small);
      }

      // time counters
      .rdtCounters {
        .rdtCounterSeparator {
          display: none;
        }
        .rdtCount {
          height: 40%;
          line-height: 40px;
        }
        .rdtCounter {
          margin-left: 40px;
          position: relative;
          width: 40px;
          &:first-child {
            margin-left: 0;
            &:after {
              content: ":";
              position: absolute;
              left: 60px;
              top: 40%;
            }
          }
          height: auto;
          span.rdtBtn {
            display: block;
            position: relative;
            left: 0; top: 0;
            font-family: 'rc-font' !important;
            font-style: normal;
            font-weight: normal;
            font-variant: normal;
            font-size: $font-size-base;
            color: $whiteColor;
            background-color: $whiteColor;
            &:before {
              position: absolute;
              left: 0; top: 0;
              height: 40%;
              width: 40px;
              text-align: center;
              color: $darkGrayColor;
            }
            &:hover {
              &:before {
                color: $primaryColor;
              }
              color: $secondaryColor;
              background: $secondaryColor;
            }
          }
          span.rdtBtn:first-child:before {
            content: getIcoMoonContent($rc-icon-chevron-up-big);
          }
          span.rdtBtn:last-child:before {
            content: getIcoMoonContent($rc-icon-chevron-down-big);
          }
        }
      }

      td.rdtDay:hover,
      td.rdtHour:hover,
      td.rdtMinute:hover,
      td.rdtSecond:hover,
      .rdtTimeToggle:hover,
      thead tr:first-child th:hover,
      td.rdtMonth:hover,
      td.rdtYear:hover,
      .rdtBtn:hover {
        color: $primaryColor;
        background: $secondaryColor;
      }
      td.rdtOld,
      td.rdtNew {
        color: inherit;
        &.rdtDay {
          color: $mediumGrayColor;
        }
      }
      td.rdtToday {
        &.rdtActive:before,
        &:before {
          border-bottom: 7px solid $primaryColor;
        }
      }
      td.rdtActive,
      td.rdtActive:hover {
        color: $primaryColor;
        background-color: $secondaryColor !important;
        text-shadow: none;
      }
      th, td {
        &.rdtDisabled,
        &.rdtDisabled:hover {
          color: $darkGrayColor;
          background-color: $lightGrayColor;
        }
      }

      th, td {
        height: 33px;
        vertical-align: middle;
      }

      th {
        border-bottom: 1px solid $whiteColor;
        text-align: center;
      }
      tfoot {
        border-top: 1px solid $whiteColor;
      }
      button:hover {
        background-color: $lightestGrayColor;
      }
    }
  }
}

.input-group-lg .rc-datepicker {
  border-radius: $input-border-radius-large;
  .rdt .rdtPicker {
    border-radius: $input-border-radius-large;
  }
}

.input-group-sm .rc-datepicker {
  border-radius: $input-border-radius-small;
  .rdt .rdtPicker {
    border-radius: $input-border-radius-small;
  }
}
