@import '../../base/bds-lite.scss';
@import '../../inputs/input/bds.scss';
@import '../../popups/popup/bds.scss';
@import '../../buttons/button/bds.scss';
@import '../../calendars/calendar/bds.scss';
@import '../../buttons/check-box/bds.scss';
@import '../../calendars/datepicker/bds.scss';
@import '../../lists/list-view/bds.scss';
@import '../../lists/sortable/bds.scss';
// size variables
$datetime-default-text-indent: 12px !default;
$datetime-list-bigger-line-height: 36px !default;
$datetime-list-normal-line-height: 30px !default;
$datetime-list-normal-font-size: $text-sm !default;
$datetime-list-bigger-font-size: $text-base !default;
$datetime-list-normal-text-indent: $datetime-default-text-indent !default;
$datetime-list-bigger-text-indent: 16px !default;
$datetime-popup-border-radius: 6px !default;
$datetime-list-font-weight: $font-weight-normal !default;
$datetime-list-normal-padding: 8px !default;
$datetime-list-bigger-padding: 8px !default;
$datetime-time-font-icon: '\e20c' !default;
$datetime-icon-normal-font-size: $text-base !default;
$datetime-icon-bigger-font-size: $text-lg !default;
$datetime-date-icon-margin: 0 !default;
$datetime-time-icon-margin: 0 !default;
$datetime-time-bigger-icon-margin: 0 !default;
$datetime-time-rtl-icon-margin: 0 !default;
$datetime-time-rtl-bigger-icon-margin: 0 !default;
$datetime-normal-min-height: 24px !default;
$datetime-normal-min-width: 24px !default;
$datetime-bigger-min-height: 26px !default;
$datetime-bigger-min-width: 26px !default;
$datetime-time-icon-border: 0 !default;
$datetime-time-icon-border-style: none !default;
$datetime-list-default-border-style: none !default;

//mouse small
$datetime-list-small-line-height: 24px !default;
$datetime-list-small-text-indent: 12px !default;
$datetime-list-small-font-size: $text-xs !default;

// mouse small icon
$datetime-icon-small-font-size: $font-icon-14 !default;
$datetime-small-min-width: 16px !default;

//touch small
$datetime-list-bigger-small-line-height: 36px !default;
$datetime-list-bigger-small-text-indent: 12px !default;
$datetime-list-bigger-small-font-size: $text-sm !default;

// touch small icon
$datetime-icon-bigger-small-font-size: $text-base !default;

// color variables
$datetime-popup-shadow: $shadow-lg !default;
$datetime-list-default-font-color: $content-text-color !default;
$datetime-list-border-color: 1px solid $border-light !default;
$datetime-list-bg-color: $content-bg-color !default;
$datetime-list-active-bg-color: $content-bg-color-pressed !default;
$datetime-list-active-font-color: $content-text-color-pressed !default;
$datetime-list-active-icon-color: $content-text-color-pressed !default;
$datetime-list-hover-bg-color: $content-bg-color-hover !default;
$datetime-list-hover-font-color: $content-text-color-hover !default;
$datetime-list-popup-icon-active-color: $icon-color-pressed !default;
$datetime-list-active-hover-bg-color: $content-bg-color-hover !default;
$datetime-list-active-hover-font-color: $content-text-color-hover !default;
$datetime-list-hover-border-color: none !default;
$datetime-default-overlay: $content-bg-color-alt2 !default;

// modal full-screen popup
$modal-datetime-position: fixed !default;
$modal-datetime-wrapper-position: relative !default;
$modal-datetime-wrapper-width: 100% !default;

@include export-module('datetimepicker-layout') {
  // datetimepicker layout
  .e-input-group.e-control-wrapper.e-datetime-wrapper.e-non-edit.e-input-focus .e-input:focus ~ .e-clear-icon,
  .e-float-input.e-control-wrapper.e-input-group.e-datetime-wrapper.e-non-edit.e-input-focus input:focus ~ .e-clear-icon {
    display: flex;
  }

  .e-datetime-wrapper {
    /* stylelint-disable property-no-vendor-prefix */
    -webkit-tap-highlight-color: transparent;

    #{if(&, '&', '*')} .e-time-icon.e-icons::before {
      font-size: $datetime-icon-normal-font-size;
    }

    #{if(&, '&', '*')}.e-control-wrapper {
      box-sizing: border-box;
    }

    #{if(&, '&', '*')} .e-time-icon.e-icons.e-disabled,
    #{if(&, '&', '*')} .e-date-icon.e-icons.e-disabled {
      pointer-events: none;
    }

    #{if(&, '&', '*')} .e-clear-icon {
      box-sizing: content-box;
      @if $skin-name == 'fluent2' or $skin-name == 'fluent2-dark' {
        box-sizing: border-box;
      }
    }

    #{if(&, '&', '*')} span {
      cursor: pointer;
    }

    #{if(&, '&', '*')} .e-input-group-icon.e-date-icon,
    #{if(&, '&', '*')} .e-input-group-icon.e-time-icon {
      font-size: $datetime-icon-normal-font-size;
      margin: $datetime-date-icon-margin;
      @if $skin-name == 'material' or $skin-name == 'material-dark' or $skin-name == 'Material3' {
        min-height: $datetime-normal-min-height;
        min-width: $datetime-normal-min-width;
        @if $skin-name == 'Material3' {
          border-radius: $datetime-normal-border-radius;
        }
      }
      outline: none;
    }

    #{if(&, '&', '*')} .e-input-group-icon.e-time-icon {
      border: $datetime-time-icon-border;
      border-style: $datetime-time-icon-border-style;
      margin: $datetime-time-icon-margin;
    }
  }

  .e-datetime-wrapper:not(.e-outline) {
    #{if(&, '&', '*')}.e-rtl .e-input-group-icon.e-time-icon {
      margin: $datetime-time-rtl-icon-margin;
    }
  }

  .e-control.e-datetimepicker.e-popup-wrapper.e-popup-container.e-popup-expand.e-popup.e-popup-open .e-datetime-mob-popup-wrap {
    align-items: normal;
  }

  .e-datetime-mob-popup-wrap {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    left: 0;
    max-height: 100%;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1002;
  
    .e-datetimepicker.e-popup.e-lib.e-control.e-popup-open {
      left: 0 !important; /* stylelint-disable-line declaration-no-important */
      position: relative;
      top: 0 !important; /* stylelint-disable-line declaration-no-important */
    }
  }

  #{&}.e-datetimepicker.e-time-modal {
    @if $skin-name != 'Material3' {
      background-color: $datetime-default-overlay;
    }
    @if $skin-name == 'Material3' {
      background: $datetime-default-overlay;
    }
    height: 100%;
    left: 0;
    opacity: .5;
    pointer-events: auto;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 999;
  }

  #{&}.e-datetimepicker.e-popup {
    border-style: solid;
    border-width: 1px;
    overflow: auto;

    #{if(&, '&', '*')} .e-content {
      position: relative;
    }

    #{if(&, '&', '*')} .e-list-parent.e-ul {
      margin: 0;
      @if $skin-name != 'Material3' {
        padding: $datetime-list-normal-padding 0;
      }
      @else {
        padding: 0;
      }

      #{if(&, '&', '*')} .e-list-item {
        color: $datetime-list-default-font-color;
        cursor: default;
        font-size: $datetime-list-normal-font-size;
        overflow: hidden;
        position: relative;
        text-overflow: ellipsis;
        vertical-align: middle;
        white-space: nowrap;
        width: 100%;
      }

      #{if(&, '&', '*')} .e-list-item.e-hover {
        cursor: pointer;
      }
    }
  }

  #{&}.e-datetimepicker.e-popup {
    #{if(&, '&', '*')} .e-list-parent.e-ul .e-list-item {
      line-height: $datetime-list-normal-line-height;
      text-indent: $datetime-list-normal-text-indent;
    }
  }

  .e-small #{&}.e-datetimepicker.e-popup,
  #{if(&, '&', '*')}.e-small#{&}.e-datetimepicker.e-popup {
    #{if(&, '&', '*')} .e-list-parent.e-ul .e-list-item {
      font-size: $datetime-list-small-font-size;
      line-height: $datetime-list-small-line-height;
      text-indent: $datetime-list-small-text-indent;
    }
  }

  .e-small.e-datetime-wrapper,
  #{if(&, '&', '*')}.e-small .e-datetime-wrapper {

    #{if(&, '&', '*')} .e-time-icon.e-icons::before {
      font-size: $datetime-icon-small-font-size;
    }

    #{if(&, '&', '*')} .e-input-group-icon.e-time-icon {
      @if $skin-name == 'Material3' {
        min-height: $datetime-small-min-height;
        min-width: $datetime-small-min-width;
        border-radius: $datetime-small-icon-border-radius;
        margin: $datetime-time-small-icon-margin;
      }
    }
  }

  .e-content-placeholder.e-datetimepicker.e-placeholder-datetimepicker {
    background-size: 250px 33px;
    min-height: 33px;
  }

  .e-datetimepicker.e-popup-expand.e-popup {
    position: $modal-datetime-position;

    #{if(&, '&', '*')} .e-datetime-mob-popup-wrap {
      position: $modal-datetime-wrapper-position;
      width: $modal-datetime-wrapper-width;
    }
  }
}


@include export-module('datetimepicker-theme') {

  /*! datetimepicker theme */
  .e-datetime-wrapper {
    #{if(&, '&', '*')} .e-input-group-icon.e-icons.e-active {
      @if $skin-name == 'bootstrap4' {
        background: $datetime-icon-active-bg-color;
        border-color: $datetime-active-border-color;
      }
      color: $datetime-list-active-icon-color;
    }

    #{if(&, '&', '*')}.e-input-group:not(.e-disabled) .e-input-group-icon.e-active:active {
      color: $datetime-list-popup-icon-active-color;
    }
  }

  .e-datetimepicker.e-popup {
    border: $datetime-list-border-color;
    border-radius: $datetime-popup-border-radius;
    box-shadow: $datetime-popup-shadow;

    #{if(&, '&', '*')} .e-list-parent.e-ul {
      @if $skin-name != 'Material3' {
        background-color: $datetime-list-bg-color;
      }
      @if $skin-name == 'Material3' {
        background: $datetime-list-bg-color;
      }

      #{if(&, '&', '*')} li.e-list-item {
        border: $datetime-list-default-border-style;
        color: $datetime-list-default-font-color;
      }

      #{if(&, '&', '*')} .e-list-item.e-hover {
        @if $skin-name == 'tailwind3' {
          background: $datetime-list-hover-bg-color;
          color: $datetime-list-hover-font-color;
        }
      }

      #{if(&, '&', '*')} .e-list-item.e-navigation {
        @if $skin-name == 'tailwind3' {
          background: $datetime-list-navigation-bg-color;
          color: $datetime-list-navigation-font-color;
          box-shadow: $datetime-list-navigation-box-shadow;
        }
      }

      #{if(&, '&', '*')} .e-list-item:focus {
        @if $skin-name == 'tailwind3' {
          background: $datetime-list-focus-bg-color;
          color: $datetime-list-focus-font-color;
        }
      }

      #{if(&, '&', '*')} .e-list-item.e-hover,
      #{if(&, '&', '*')} .e-list-item.e-navigation,
      #{if(&, '&', '*')} .e-list-item:focus {
        @if $skin-name != 'Material3' and $skin-name != 'fluent2' {
          background-color: $datetime-list-hover-bg-color;
        }
        @if $skin-name == 'Material3' or $skin-name == 'fluent2' {
          background: $datetime-list-hover-bg-color;
        }
        border: $datetime-list-hover-border-color;
        color: $datetime-list-hover-font-color;
      }

      #{if(&, '&', '*')} .e-list-item.e-active {
        @if $skin-name != 'Material3' and $skin-name != 'tailwind3' {
          background-color: $datetime-list-active-bg-color;
        }
        @if $skin-name == 'Material3' or $skin-name == 'tailwind3' {
          background: $datetime-list-active-bg-color;
        }
        color: $datetime-list-active-font-color;
        @if $skin-name == 'tailwind3' {
          font-weight: 500;
        }
      }

      #{if(&, '&', '*')} .e-list-item.e-active.e-hover {
        @if $skin-name != 'Material3' {
          background-color: $datetime-list-active-hover-bg-color;
        }
        @if $skin-name == 'Material3' {
          background: $datetime-list-active-hover-bg-color;
        }
        color: $datetime-list-active-hover-font-color;
      }
    }
  }
}


@include export-module('datetimepicker-bds-icons') {

  /*! component icons */
  .e-datetime-wrapper {

    #{if(&, '&', '*')} .e-time-icon.e-icons::before {
      content: '\e705';
      font-family: 'e-icons';
    }
  }
}

