/**
 * This file's only purpose is to make the flatpickr themeable. DO NOT add ANY custom style here!
 * Also, DO NOT re-arrange the CSS blocks to make them more LESS like. They're based off of the
 * pre-compiled flatpickr.css file and so can easily identified when updating to a new version.
 *
 * Latest state from version: v4.6.9
 */

@fp-calendarBackground: #ffffff;
@fp-calendarBorderColor: #e6e6e6;

@fp-monthForeground: fadeout(black, 10%);
@fp-arrow_hover_color: #f64747;

@fp-monthBackground: transparent;

@fp-weekdaysBackground: transparent;
@fp-weekdaysForeground: fadeout(black, 46%);

@fp-dayForeground: #393939;
@fp-dayHoverBackground: #e6e6e6;

@fp-todayColor: #959ea9;
@fp-selectedDayBackground: #569FF7;

@fp-invertedBg: spin(#fff - @fp-calendarBackground, 180);

.icinga-datetime-picker {
  &.flatpickr-calendar {
    background: @fp-calendarBackground;
    box-shadow: 1px 0 0 @fp-calendarBorderColor,
      -1px 0 0 @fp-calendarBorderColor,
      0 1px 0 @fp-calendarBorderColor,
      0 -1px 0 @fp-calendarBorderColor,
      0 3px 13px fadeout(black, 92%);
  }

  &.flatpickr-calendar.arrowTop:before {
    border-bottom-color: @fp-calendarBorderColor;
  }
  &.flatpickr-calendar.arrowTop:after {
    border-bottom-color: @fp-calendarBackground;
  }
  &.flatpickr-calendar.arrowBottom:before {
    border-top-color: @fp-calendarBorderColor;
  }
  &.flatpickr-calendar.arrowBottom:after {
    border-top-color: @fp-calendarBackground;
  }

  &.flatpickr-calendar.hasTime .flatpickr-time {
    border-top-color: @fp-calendarBorderColor;
  }

  .dayContainer + .dayContainer {
    -webkit-box-shadow: -1px 0 0 @fp-calendarBorderColor;
    box-shadow: -1px 0 0 @fp-calendarBorderColor;
  }

  .flatpickr-day {
    color: @fp-dayForeground;
  }
  .flatpickr-day.today {
    border-color: @fp-todayColor;
  }
  .flatpickr-day.today:hover,
  .flatpickr-day.today:focus {
    border-color: @fp-todayColor;
    background: @fp-todayColor;
    color: @fp-calendarBackground;
  }
  .flatpickr-day.selected,
  .flatpickr-day.startRange,
  .flatpickr-day.endRange,
  .flatpickr-day.selected.inRange,
  .flatpickr-day.startRange.inRange,
  .flatpickr-day.endRange.inRange,
  .flatpickr-day.selected:focus,
  .flatpickr-day.startRange:focus,
  .flatpickr-day.endRange:focus,
  .flatpickr-day.selected:hover,
  .flatpickr-day.startRange:hover,
  .flatpickr-day.endRange:hover,
  .flatpickr-day.selected.prevMonthDay,
  .flatpickr-day.startRange.prevMonthDay,
  .flatpickr-day.endRange.prevMonthDay,
  .flatpickr-day.selected.nextMonthDay,
  .flatpickr-day.startRange.nextMonthDay,
  .flatpickr-day.endRange.nextMonthDay {
    color: @fp-calendarBackground;
  }
  .flatpickr-day.inRange,
  .flatpickr-day.prevMonthDay.inRange,
  .flatpickr-day.nextMonthDay.inRange,
  .flatpickr-day.today.inRange,
  .flatpickr-day.prevMonthDay.today.inRange,
  .flatpickr-day.nextMonthDay.today.inRange,
  .flatpickr-day:hover,
  .flatpickr-day.prevMonthDay:hover,
  .flatpickr-day.nextMonthDay:hover,
  .flatpickr-day:focus,
  .flatpickr-day.nextMonthDay:focus {
    background: @fp-dayHoverBackground;
    border-color: @fp-dayHoverBackground;
  }
  .flatpickr-day.inRange {
    -webkit-box-shadow: -5px 0 0 @fp-dayHoverBackground, 5px 0 0 @fp-dayHoverBackground;
    box-shadow: -5px 0 0 @fp-dayHoverBackground, 5px 0 0 @fp-dayHoverBackground;
  }
  .flatpickr-day.prevMonthDay,
  .flatpickr-day.nextMonthDay,
  .flatpickr-day.notAllowed,
  .flatpickr-day.notAllowed.prevMonthDay,
  .flatpickr-day.notAllowed.nextMonthDay {
    color: fadeout(@fp-dayForeground, 70%);
  }
  .flatpickr-day.flatpickr-disabled,
  .flatpickr-day.flatpickr-disabled:hover {
    color: fadeout(@fp-dayForeground, 90%);
  }
  .flatpickr-day.selected,
  .flatpickr-day.startRange,
  .flatpickr-day.endRange,
  .flatpickr-day.selected.inRange,
  .flatpickr-day.startRange.inRange,
  .flatpickr-day.endRange.inRange,
  .flatpickr-day.selected:focus,
  .flatpickr-day.startRange:focus,
  .flatpickr-day.endRange:focus,
  .flatpickr-day.selected:hover,
  .flatpickr-day.startRange:hover,
  .flatpickr-day.endRange:hover,
  .flatpickr-day.selected.prevMonthDay,
  .flatpickr-day.startRange.prevMonthDay,
  .flatpickr-day.endRange.prevMonthDay,
  .flatpickr-day.selected.nextMonthDay,
  .flatpickr-day.startRange.nextMonthDay,
  .flatpickr-day.endRange.nextMonthDay {
    background: @fp-selectedDayBackground;
    border-color: @fp-selectedDayBackground;
  }
  .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
  .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),
  .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {
    -webkit-box-shadow: -10px 0 0 @fp-selectedDayBackground;
    box-shadow: -10px 0 0 @fp-selectedDayBackground;
  }
  .flatpickr-day.week.selected {
    -webkit-box-shadow: -5px 0 0 @fp-selectedDayBackground, 5px 0 0 @fp-selectedDayBackground;
    box-shadow: -5px 0 0 @fp-selectedDayBackground, 5px 0 0 @fp-selectedDayBackground;
  }

  .flatpickr-weekwrapper .flatpickr-weeks {
    -webkit-box-shadow: 1px 0 0 @fp-calendarBorderColor;
    box-shadow: 1px 0 0 @fp-calendarBorderColor;
  }
  .flatpickr-weekwrapper span.flatpickr-day,
  .flatpickr-weekwrapper span.flatpickr-day:hover {
    color: fadeout(@fp-dayForeground, 70%);
  }
  .flatpickr-weekdays {
    background: @fp-weekdaysBackground;
  }
  span.flatpickr-weekday {
    background: @fp-monthBackground;
    color: @fp-weekdaysForeground;
  }

  .flatpickr-months .flatpickr-month {
    background: @fp-monthBackground;
    color: @fp-monthForeground;
    fill: @fp-monthForeground;
  }
  .flatpickr-months .flatpickr-prev-month,
  .flatpickr-months .flatpickr-next-month {
    color: @fp-monthForeground;
    fill: @fp-monthForeground;
  }
  .flatpickr-months .flatpickr-prev-month:hover,
  .flatpickr-months .flatpickr-next-month:hover {
    color: @fp-todayColor;
  }
  .flatpickr-months .flatpickr-prev-month:hover svg,
  .flatpickr-months .flatpickr-next-month:hover svg {
    fill: @fp-arrow_hover_color;
  }
  .flatpickr-current-month .flatpickr-monthDropdown-months {
    background: @fp-monthBackground;
  }
  .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background-color: @fp-monthBackground;
  }
  .flatpickr-current-month .numInputWrapper span.arrowUp:after {
    border-bottom-color: @fp-monthForeground;
  }
  .flatpickr-current-month .numInputWrapper span.arrowDown:after {
    border-top-color: @fp-monthForeground;
  }

  .numInputWrapper span {
    border-color: fadeout(@fp-dayForeground, 85%);
  }
  .numInputWrapper span:hover {
    background: fadeout(@fp-invertedBg, 90%);
  }
  .numInputWrapper span:active {
    background: fadeout(@fp-invertedBg, 80%);
  }
  .numInputWrapper span svg path {
    fill: fadeout(@fp-monthForeground, 50%);
  }
  .numInputWrapper span.arrowUp:after {
    border-bottom-color: fadeout(@fp-dayForeground, 40%);
  }
  .numInputWrapper span.arrowDown:after {
    border-top-color: fadeout(@fp-dayForeground, 40%);
  }
  .numInputWrapper:hover {
    background: fadeout(@fp-invertedBg, 95%);
  }
  .flatpickr-current-month span.cur-month:hover {
    background: fadeout(@fp-invertedBg, 95%);
  }
  .flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: fadeout(@fp-invertedBg, 95%);
  }

  .flatpickr-time input:hover,
  .flatpickr-time .flatpickr-am-pm:hover,
  .flatpickr-time input:focus,
  .flatpickr-time .flatpickr-am-pm:focus {
    background: lighten(@fp-dayHoverBackground, 3);
  }
  .flatpickr-time .numInputWrapper span.arrowUp:after {
    border-bottom-color: @fp-dayForeground;
  }
  .flatpickr-time .numInputWrapper span.arrowDown:after {
    border-top-color: @fp-dayForeground;
  }
  .flatpickr-time input {
    color: @fp-dayForeground;
  }
  .flatpickr-time .flatpickr-time-separator,
  .flatpickr-time .flatpickr-am-pm {
    color: @fp-dayForeground;
  }
}
