@import '../../globals/vars';

.#{$iot-prefix}--time-picker__wrapper {
  position: relative;

  &.#{$iot-prefix}--time-picker__wrapper--with-spinner {
    .bx--time-picker__input-field {
      width: 5.875rem;
      padding-right: $spacing-07;
    }
  }

  &.#{$iot-prefix}--time-picker__wrapper--updown {
    .bx--time-picker__input-field {
      caret-color: transparent;
    }
  }

  &.#{$iot-prefix}--time-picker__wrapper--show-underline {
    .bx--time-picker--invalid .bx--time-picker__input:before {
      bottom: 1.6rem;
    }
    .bx--time-picker__input:before {
      content: '__';
      position: absolute;
      bottom: 0.365rem;
      left: 1rem;
    }

    &.#{$iot-prefix}--time-picker__wrapper--show-underline-minutes {
      .bx--time-picker__input:before {
        left: 2.7rem;
      }
    }
  }

  .bx--time-picker--invalid {
    .#{$iot-prefix}--time-picker__controls {
      bottom: calc(#{$spacing-06} - #{$spacing-01});
    }
  }

  .#{$iot-prefix}--time-picker__controls {
    position: absolute;
    left: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    bottom: 2px;

    .#{$iot-prefix}--time-picker__controls--btn {
      border: none;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      padding: 0;
      width: 1.7rem;
      height: rem(18px);

      svg {
        fill: currentColor;
        position: relative;
      }

      &.up-icon svg {
        top: rem(4px);
      }

      &.down-icon svg {
        top: rem(-4px);
      }

      &:focus {
        @include focus-outline;
        outline-width: 2px;
        outline-offset: -2px;
      }

      &:hover {
        cursor: pointer;
        color: $icon-01;
      }

      &:disabled {
        cursor: not-allowed;
        color: $disabled;
      }
    }
  }
}

html[dir='rtl'] {
  .#{$iot-prefix}--time-picker__wrapper {
    &.#{$iot-prefix}--time-picker__wrapper--show-underline {
      .bx--time-picker__input:before {
        left: unset;
        right: 3.7rem;
      }
      &.#{$iot-prefix}--time-picker__wrapper--show-underline-minutes {
        .bx--time-picker__input:before {
          left: unset;
          right: 2rem;
        }
      }
    }

    .#{$iot-prefix}--time-picker__controls {
      left: unset;
      right: 2px;
    }
  }
}
