.time-picker {
  display: flex;
  flex-flow: column nowrap;

  .time-picker-buttons {
    display: flex;
  }
}

.time-picker-utc {
  color: $orange;
  font-size: 75%;
  padding: 3px;
  font-weight: $font-weight-semi-bold;
  margin-left: 4px;
  position: relative;
}

.time-picker-popover {
  display: flex;
  justify-content: space-around;
  border: 1px solid $popover-border-color;
  border-radius: $border-radius;
  background: $popover-bg;
  color: $popover-color;
  box-shadow: $popover-shadow;
  position: absolute;
  z-index: $zindex-dropdown;
  flex-direction: column;
  max-width: 600px;
  top: 41px;
  right: 0px;
}

.time-picker-popover-body {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-around;
  padding: $space-md;
  padding-bottom: 0;
}

.time-picker-popover-title {
  font-size: $font-size-md;
  font-weight: $font-weight-semi-bold;
}

.time-picker-popover-body-custom-ranges:first-child {
  margin-right: $space-md;
}

.time-picker-popover-body-custom-ranges-input {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  margin-bottom: $space-sm;

  .time-picker-input-error {
    box-shadow: inset 0 0px 5px $red;
  }
}

.time-picker-popover-footer {
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  padding: $space-md;
}

.time-picker-popover-header {
  background: $popover-header-bg;
  padding: $space-sm;
}

.time-picker-input {
  max-width: 170px;
}

.react-calendar__navigation__label {
  line-height: 31px;
  padding-bottom: 0;
}

.react-calendar__navigation__arrow {
  font-size: $font-size-lg;
}

$arrowPaddingToBorder: 7px;
$arrowPadding: $arrowPaddingToBorder * 3;

.react-calendar__navigation__next-button {
  padding-left: $arrowPadding;
  padding-right: $arrowPaddingToBorder;
}

.react-calendar__navigation__prev-button {
  padding-left: $arrowPaddingToBorder;
  padding-right: $arrowPadding;
}

.react-calendar__month-view__days__day--neighboringMonth abbr {
  opacity: 0.35;
}

.react-calendar__month-view__days {
  padding: 4px;
}

.time-picker-calendar {
  border: 1px solid $input-border-color;
  color: $black;
  width: 260px;

  .react-calendar__navigation__label,
  .react-calendar__navigation__arrow,
  .react-calendar__navigation {
    color: $input-color;
    background-color: $input-label-bg;
    border: 0;
  }

  .react-calendar__month-view__weekdays {
    background-color: $input-bg;
    text-align: center;

    abbr {
      border: 0;
      text-decoration: none;
      cursor: default;
      color: $orange;
      font-weight: $font-weight-semi-bold;
      display: block;
      padding: 4px 0 0 0;
    }
  }

  .time-picker-calendar-tile {
    color: $text-color;
    background-color: inherit;
    line-height: 26px;
    font-size: $font-size-md;
    border: 1px solid transparent;
    border-radius: $border-radius;

    &:hover {
      box-shadow: $panel-editor-viz-item-shadow-hover;
      background: $panel-editor-viz-item-bg-hover;
      border: $panel-editor-viz-item-border-hover;
      color: $text-color-strong;
      position: relative;
    }
  }

  .react-calendar__month-view__days {
    background-color: $calendar-bg-days;
  }

  .react-calendar__tile--now {
    background-color: $calendar-bg-now;
  }

  .react-calendar__navigation__label,
  .react-calendar__navigation > button:focus,
  .time-picker-calendar-tile:focus {
    outline: 0;
  }

  .react-calendar__tile--now {
    border-radius: $border-radius;
  }

  .react-calendar__tile--active,
  .react-calendar__tile--active:hover {
    color: $white;
    font-weight: $font-weight-semi-bold;
    background: linear-gradient(0deg, $blue-base, $blue-shade);
    box-shadow: none;
    border: 1px solid transparent;
  }
}

.time-picker-popover-custom-range-label {
  padding-right: $space-xs;
}

@include media-breakpoint-down(md) {
  .time-picker-popover {
    .time-picker-popover-title {
      font-size: $font-size-md;
    }

    .time-picker-popover-body {
      padding: $space-sm;
      display: flex;
      flex-flow: column nowrap;
    }

    .time-picker-popover-body-custom-ranges:first-child {
      margin-right: 0;
      margin-bottom: $space-sm;
    }

    .time-picker-popover-footer {
      display: flex;
      flex-flow: row nowrap;
      justify-content: flex-end;
      margin-top: $spacer;
    }
  }

  .time-picker-calendar {
    width: 320px;
  }
}

.time-picker-button-select {
  .select-button-value {
    display: none;

    @include media-breakpoint-up(sm) {
      display: inline-block;
      max-width: 100px;
      overflow: hidden;
    }

    @include media-breakpoint-up(md) {
      display: inline-block;
      max-width: 150px;
      overflow: hidden;
    }

    @include media-breakpoint-up(lg) {
      max-width: 300px;
    }
  }
}

// special rules for when within explore toolbar in split
.explore-toolbar.splitted {
  .time-picker-button-select {
    .select-button-value {
      display: none;

      @include media-breakpoint-up(xl) {
        display: inline-block;
        max-width: 100px;
      }

      @media only screen and (max-width: 1545px) {
        max-width: 300px;
      }
    }
  }
}

.dashboard-timepicker-wrapper {
  position: relative;
  display: flex;
  // this is to align popover position with explore  ( .explore-toolbar-content-item class)
  padding: 2px 2px;

  .gf-form-select-box__menu {
    right: 0;
    left: unset;
  }
}
