/* Date/Time Menu */

$calendar-column-spacing: 8px;
$calendar-column-margin: 0 8px;

%calendar-item {
  margin: 0;
  border: 0;
  border-radius: $corner-radius;

  &,
  &:focus,
  &:hover,
  &:active {
    border-color: transparent;
    box-shadow: none;
    background-color: transparent;
    color: inherit;
    text-shadow: none;
    icon-shadow: none;
    transition-duration: $duration;
  }

  &:focus {
    background-color: $overlay-focus;
  }

  &:hover {
    background-color: $overlay-hover;
  }

  &:active {
    background-color: $overlay-active;
    transition-duration: $duration-ripple;
  }
}

.clock-display-box {
  spacing: 0;

  .clock {
    padding-left: $panel-button-hpadding;
    padding-right: $panel-button-hpadding;
  }
}

// overall menu
#calendarArea {
  padding: 8px 16px;
}

// Calendar menu side column
.datemenu-calendar-column {
  spacing: $calendar-column-spacing;
  padding: 0;
  border: 0 solid $divider;

  &:ltr {
    margin-right: 0;
    border-left-width: 0;
  }

  &:rtl {
    margin-left: 0;
    border-right-width: 0;
  }

  .datemenu-displays-section {
    padding-bottom: 0;
  }

  .datemenu-displays-box {
    spacing: $calendar-column-spacing;
    margin: $calendar-column-margin;
  }
}

.events-section-title {
  @extend %calendar-item;
  min-height: $menuitem-size - 4px * 2;
  padding: 4px 8px;
  color: $text2 !important;
  font-weight: bold;
}

/* today button (the date) */
.datemenu-today-button {
  @extend %calendar-item;
  margin: $calendar-column-margin;
  min-height: $menuitem-size * 2 - 4px * 2;
  padding: 4px 8px;

  // weekday label
  .day-label {
    font-weight: normal;
    font-size: 1em;
  }

  // date label
  .date-label {
    @include type(headline5);
  }
}

/* Calendar */
.calendar {
  @extend %calendar-item;
  margin: $calendar-column-margin;
  margin-bottom: 0;
  padding: 0;

  // month
  .calendar-month-label {
    transition-duration: $duration;
    height: $menuitem-size - 6px * 2;
    margin: 2px;
    padding: 6px 8px;
    border-radius: $corner-radius;
    color: inherit;
    font-weight: bold;
    text-align: center;

    &:focus {
      background-color: $overlay-focus;
    }
  }

  // prev/next month icons
  @if $version >= 3.32 {
    .calendar-change-month-back StIcon,
    .calendar-change-month-forward StIcon {
      icon-size: 16px;
    }
  } @else {
    .calendar-change-month-back {
      background-image: url("assets/calendar-arrow-left.svg");

      &:rtl {
        background-image: url("assets/calendar-arrow-right.svg");
      }
    }

    .calendar-change-month-forward {
      background-image: url("assets/calendar-arrow-right.svg");

      &:rtl {
        background-image: url("assets/calendar-arrow-left.svg");
      }
    }
  }

  .pager-button {
    transition-duration: $duration;
    width: $menuitem-size;
    height: $menuitem-size;
    margin: 2px;
    border-radius: $menuitem-size / 2;
    background-color: transparent;
    color: $text2;

    &:focus {
      background-color: $overlay-focus;
    }

    &:hover {
      background-color: $overlay-hover;
    }

    &:active {
      background-color: $overlay-active;
      transition-duration: $duration-ripple;
    }
  }

  .calendar-day-base {
    transition-duration: $duration;
    width: $menuitem-size;
    height: $menuitem-size;
    margin: 2px;
    padding: 0;
    border: 0;
    border-radius: $menuitem-size / 2;
    @include type(caption);
    font-feature-settings: "tnum";
    text-align: center;

    &:focus {
      background-color: $overlay-focus;
    }

    &:hover {
      background-color: $overlay-hover;
    }

    &:active {
      transition-duration: $duration-ripple;
      border-color: transparent;
      background-color: $overlay-active;
      color: inherit;
    }

    &:selected {
      border-color: transparent;
      background-color: $overlay-selected;
      color: inherit;
    }

    // day of week heading
    &.calendar-day-heading {
      width: $menuitem-size;
      height: $menuitem-size - 7px;
      margin-top: 2px;
      padding: 7px 0 0;
      border-radius: $menuitem-size / 2;
      background-color: transparent;
      color: $text-disabled;
      @include type(caption);
      font-weight: bold;
      text-align: center;

      &:focus {
        background-color: $overlay-focus;
      }
    }
  }

   //border collapse hack - see calendar.js
  .calendar-day {
    border-width: 0;
  }

  .calendar-day-top {
    border-top-width: 0;
  }

  .calendar-day-left {
    border-left-width: 0;
  }

  .calendar-work-day {
  }

  .calendar-nonwork-day {
    color: inherit;
  }

  // Today
  .calendar-today {
    border: 0;
    background-color: transparent;
    color: inherit;
    font-weight: bold !important;

    &:focus {
      background-color: $overlay-focus;
      color: inherit;
    }

    &:hover {
      background-color: $overlay-hover;
      color: inherit;
    }

    &:active {
      &,
      &:hover,
      &:focus {
        background-color: $overlay-active;
        color: inherit;
      }
    }

    &:selected {
      &,
      &:hover,
      &:focus {
        background-color: $overlay-selected;
        color: inherit;
      }
    }
  }

  .calendar-day-with-events {
    background-image: none;
    color: $primary !important;
    font-weight: normal;
    text-decoration: underline;
  }

  .calendar-other-month-day {
    color: $text2-disabled !important;
  }

  .calendar-week-number {
    width: $menuitem-size;
    height: $menuitem-size - 7px;
    margin: 2px;
    padding: 7px 0 0;
    border-radius: $menuitem-size / 2;
    background-color: transparent;
    color: $text-disabled;
    font-weight: bold;
    font-size: 1em;
    text-align: center;
  }
}

/* World clocks */
.world-clocks-button {
  @extend %calendar-item;
  min-height: $menuitem-size - 4px * 2;
  padding: 4px 8px;

  .world-clocks-grid {
    spacing-rows: .4em;
    spacing-columns: .8em;
  }

  // title
  .world-clocks-header {
    color: $text2;
    font-weight: bold;
  }

  // city label
  .world-clocks-city {
    color: inherit;
    font-weight: normal;
    font-size: 1em;
  }

  // timezone time
  .world-clocks-time {
    color: $text2;
    font-weight: normal;
    font-size: 1em;
    font-feature-settings: "tnum";
    text-align: right;
  }

  // timezone offset label
  .world-clocks-timezone {
    color: $text-disabled;
    font-size: 1em;
    font-feature-settings: "tnum";
  }
}

/* Weather */
.weather-button {
  @extend %calendar-item;
  min-height: $menuitem-size - 4px * 2;
  padding: 4px 8px;

  .weather-box {
    spacing: 0.4em;
  }

  .weather-header-box {
    spacing: 8px;
  }

  .weather-header {
    color: $text2;
    font-weight: bold;

    &.location {
      font-weight: normal;
      font-size: 1em;
    }
  }

  .weather-grid {
    spacing-rows: .4em;
    spacing-columns: .8em;
  }

  .weather-forecast-time {
    padding-top: 0;
    padding-bottom: 0;
    color: $text2;
    @include type(caption);
    font-feature-settings: "tnum";
  }

  .weather-forecast-icon {
    icon-size: 32px;
  }

  .weather-forecast-temp {
    font-weight: bold;
  }
}
