@import '../base/variables';

.AknDropdown {
  @animationDuration: 0.2s;
  @transitionTimingFunction: ease-in;

  position: relative;
  cursor: pointer;

  &-menu {
    padding: 10px 20px;
    position: absolute;
    top: 0;
    left: 0;
    background-color: white;
    box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 801;
    min-width: 100%;
    opacity: 0;
    transform: scale(0);
    transition: opacity @animationDuration @transitionTimingFunction;
    animation-name: fadeOut;
    transition-timing-function: @transitionTimingFunction;
    animation-duration: @animationDuration;
    max-height: 70vh;
    overflow: auto;
    font-style: normal;

    &--offset {
      left: @AknIconSize;
    }

    &--offset&--right {
      right: @AknIconSize;
    }

    &--heightLimited {
      max-height: 300px;
      overflow: auto;
    }

    &--right {
      right: 0;
      left: auto;
    }

    &--top {
      bottom: 0px;
      top: auto;
    }

    &--spaceless {
      padding: 0;
    }

    &-expanded {
      min-width: 400px;
    }

    &--open {
      display: block;
      transform: scale(1);
      opacity: 1;
      animation-name: fadeIn;
      animation-duration: 0.2s;
      transition-timing-function: ease-in;
      cursor: default;
      z-index: 804;
    }
  }

  &-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 803;
  }

  &-menuTitle {
    color: @AknLightPurple;
    border-bottom: 1px solid @AknLightPurple;
    margin-bottom: 12px;
    padding-bottom: 5px;
    padding-right: 40px;
    text-transform: uppercase;

    &--soft {
      color: @AknDefaultFontColor;
      font-style: italic;
      text-transform: none;
    }
  }

  &-menuTitle,
  &-menuLink {
    white-space: nowrap;
    font-weight: normal;
    background: none;
    display: block;
    text-align: left;
    font-size: @AknDefaultFontSize;
    width: 100%;
    line-height: 26px;
    transition: line-height @animationDuration @transitionTimingFunction;
  }

  &-menuLink {
    color: @AknSlateGrey;
    border: none;
    cursor: pointer;
    padding: 0;
    text-transform: none;

    &--inactive {
      cursor: default;
    }

    &:hover {
      background: @AknDefaultHoverBackground;
    }

    &--active {
      color: darken(@AknSlateGrey, 30%);
    }

    &--withImage {
      display: flex;
      align-items: center;
    }

    &--hidden {
      display: none;
    }
  }

  &-menuLinkImage {
    width: 25px;
    height: 25px;
    margin: 0 10px 10px 0;
  }

  &-validationError {
    display: flex;
    align-items: baseline;
    margin-top: 3px;
    color: @AknRed;
    font-style: italic;

    &--arrow {
      background: url("/bundles/pimui/images/red_arrow.svg") no-repeat 0 40%;
      padding-left: 15px;
    }
  }

  &--right {
    margin-right: 10px;
  }

  &-menuSection:not(:empty) {
    border-bottom: 1px solid @AknMediumGrey;
    margin: 0 0 12px 0;
    padding-bottom: 12px;
  }

  &--left {
    margin-left: 10px;
  }

  &--read-only {
    cursor: default;
  }
}

@keyframes fadeIn {
  0% {
    transform: scale(0);
  }

  1% {
    transform: scale(1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes fadeOut {
  0% {
    transform: scale(1);
  }

  99% {
    transform: scale(1);
  }

  100% {
    transform: scale(0);
  }
}
