.periodSelector {
  display: inline-block;
  [type=radio]:not(:checked) + span,
  [type=radio]:checked + span {
    padding-left: 30px;
  }

  &.compare-dropdown-open {
    #comparePeriodToDropdown {
      position: relative;
      z-index: 2;

      .dropdown-content {
        z-index: 3 !important;
      }
    }

    label[for=comparePeriodEndDate] {
      visibility: hidden;
    }

    #comparePeriodEndDate .input-field {
      position: static; // needed when dropdown is open, since dropdown content is position: absolute, and this is position: relative, which causes it to show up in the background of the dropdown
    }
  }

  // overrides theme CSS that always hides .loadingPiwik. since we use an ng-if to make
  // sure it's only shown when we're actually loading a new page, it's not necessary to
  // forcefully hide it.
  .loadingPiwik {
    display: inline-block !important;
  }

  .compare-checkbox {
    margin-bottom: 20px;
    label {
        span {
            padding-left:25px;
            font-size: 14px;
            margin-right: 3px;
        }
    }
  }

  // Match spacing to range mode by adding top space only when a single calendar is shown.
  #periodMore.single-calendar .period-date + .compare-checkbox {
    margin-top: 10px;
  }

  .compare-date-range {
    padding-top: 20px;
  }

  #comparePeriodToDropdown {
    height: 30px;
    display: inline-block;
    transform: scale(.9);
    margin-left: -2%;
    margin-right: -5%;

    // dropdown width/height looks off due to scaling
    .dropdown-content {
      width: auto !important;
      height: auto !important;
      overflow-y: visible;
    }

    .form-group {
      margin: 0;
    }

    .input-field {
      margin-top: 0;
      padding: 0 0 0 0.5rem;
    }

    .select-dropdown {
      margin-bottom: 0;
    }
  }

  div#comparePeriodStartDate, div#comparePeriodEndDate {
    display: inline-block;

    .form-group {
      margin: 0;
    }

    .input-field {
      margin-top: 0;
      padding: 0 0 0 0.6rem;
    }

    .select-dropdown {
      margin-bottom: 0;
    }
  }

  #periodMore.single-calendar {
    div#comparePeriodStartDate, div#comparePeriodEndDate {
      width: calc(~"70%");
    }
  }

  #periodMore.dual-calendar {
    div#comparePeriodStartDate, div#comparePeriodEndDate {
      width: calc(~"50% - 20px");
    }
  }

  .compare-dates-separator {
    height: 0.5px;
    margin-left: 11px;
    margin-right: 11px;
    background-color: @color-silver-l14;
    width: 16px;
    display: inline-block;
    vertical-align: top;
    margin-top: 30px;
  }

  label[for=comparePeriodTo] {
    transform: scale(.9);
  }

  .apply-button-container {
    text-align: right;
  }

  .flex {
    display: flex;
  }

  .period-type {
    min-width: 220px;
  }

  .period-selector-options-column {
    #otherPeriods .periodOptions {
      p:first-child {
        margin-top: 5px;
      }
      button {
        padding: 5px 0 5px 0;
        background: transparent;
        border: 0;
        border-radius: 5px;
        color: @color-silver;
        cursor: pointer;
        display: block;
        font: inherit;
        margin: 0;
        outline: none;
        padding-left: 8px;
        text-align: left;
        width: 100%;
        font-size: 13px;

        &:hover {
          background-color: @color-silver-l95;
        }

        &:focus-visible {
          background-color: @color-silver-l95;
          outline: 2px solid @theme-color-focus-ring;
          outline-offset: 0;
        }
      }

      button.selected-period-label {
        color: @theme-color-text;
        font-weight: 600;
      }
    }

    #otherPeriods .presetDateRanges {
      border-top: 1px solid @color-silver-l95;
      margin-top: 12px;
      padding-top: 12px;

      label,
      label span {
        color: @color-silver;
      }

      label.selected-period-label,
      label.selected-period-label span {
        color: @theme-color-text;
      }
    }

    .preset-date-range-group-separator {
      border-top: 1px solid @color-silver-l95;
      margin: 12px 0;
    }
  }

  .period-selector-calendar-column {
    border-left: 1px solid @color-silver-l95;
    display: flex;
    flex-direction: column;
    margin-left: 16px;
    padding-left: 16px;

    .apply-button-container {
      margin-top: auto;
    }

    .calendar-disabled {
      opacity: 0.75;
      pointer-events: none;
    }
  }

}

.periodSelector-withPrevNext {
  button.title {
    width: calc(~'100% - 40px');
    text-align: center;

    @media (max-width: 600px) {
      width: calc(~'100% - 60px');
    }
  }

  .move-period {
    background-color: transparent;
    border: none;
    width: 20px;
    height: 33px; // req'd for tap target

    @media (max-width: 600px) {
      width: 30px;
    }

    &:hover {
      color: @color-green-matomo;
      cursor: pointer;
    }

    &:disabled {
      color: @color-silver;
      cursor: auto;
    }
  }

  .move-period-prev {
    padding-right: 0;
  }

  .move-period-next {
    padding-left: 0;
  }
}
