// В этом файле должны быть стили для БЭМ-блока dropdown, его элементов,
// модификаторов, псевдоселекторов, псевдоэлементов, @media-условий...
// Очередность: http://nicothin.github.io/idiomatic-pre-CSS/#priority

.dropdown {
  $block-name: &;

  position: relative;

  &:focus,
  &:hover {
    #{$block-name}__block {
      border-bottom-color: transparent;
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }

    #{$block-name}__toggler {
      background-image: url("../img/arr-dwn--orange.svg");
    }

    #{$block-name}__list {
      border: 1px solid #eeeeee;
      border-top: 0;
      opacity: 1;
      transform: translateY(0);
      visibility: visible;
    }
  }

  &__block {
    display: flex;
    align-items: center;
    position: relative;
    border: 1px solid #eeeeee;
    padding: 5px 30px 5px 5px;
    width: 320px;
    border-radius: 20px;
  }

  &__elem {
    text-decoration: none;
    font-size: 12px;

    @media (min-width: $screen-sm) {
      font-size: 14px;
    }

    &:hover {
      // color: $color-main-2;
    }
  }

  &__toggler {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    padding: 0;
    border: 0;
    width: 40px;
    height: 100%;
    background: url("../img/arr-dwn.svg") center/auto 10px no-repeat;
    transition: var(--transition-duration);
  }

  &__list {
    position: absolute;
    right: 0;
    z-index: 5;
    transform: translateY(-4px);
    margin: 0;
    padding: 5px 0;
    min-width: 155px;
    width: 100%;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    list-style: none;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-duration);
    font-size: 12px;

    @media (min-width: $screen-sm) {
      font-size: 14px;
    }

    li {
      & > a,
      & > span {
        display: block;
        padding: 5px 20px;
        transition: var(--transition-duration);
        text-decoration: none;
        color: $color-2;

        &:focus,
        &:hover {
          background-color: #f5f6f8;
          // color: $color-main-2;
        }
      }
    }
  }

  &--width-auto {
    .dropdown__block {
      width: auto;
    }
    .dropdown__list {
      min-width: auto;
    }
  }

  &--no-border {
    .dropdown__block {
      border: inherit;
      padding: 4px 27px 4px 10px;
      border-radius: inherit;
    }

    .dropdown__toggler {
      width: 27px;
      background-position: right 2px center;
      transform-origin: calc(50% + 0.65rem) 50%;
    }

    .dropdown__list {
      li {
        & > a,
        & > span {
          padding-left: 10px;
          padding-right: 10px;
        }
      }
    }
  }

  &--align-right {
    text-align: right;

    .dropdown__elem {
      margin-left: auto;
    }

    .dropdown__list {
      li {
        & > a,
        & > span {
          padding-right: 30px;
        }
      }
    }
  }

  &--align-right.dropdown--no-border {
    .dropdown__list {
      li {
        & > a,
        & > span {
          padding-right: 27px;
        }
      }
    }
  }

  &--width-auto-left {
    .dropdown__block {
      width: auto;
    }
    .dropdown__list {
      min-width: auto;
      width: auto;
      left: 0;
      right: inherit;
    }
  }

  &--arr-left {
    #{$block-name}__block {
      padding-left: 30px;
      padding-right: 5px;
    }

    #{$block-name}__toggler {
      left: 5px;
      right: inherit;
      width: 25px;
    }

    #{$block-name}__list {
      li {
        & > a,
        & > span {
          padding-left: 15px;
          padding-right: 15px;
        }
      }
    }
  }

  &--items-with-ico {
    #{$block-name}__elem {
      display: flex;
      align-items: center;

      img {
        margin-left: 12px;
        width: 25px;
        height: auto;

        @media (min-width: $screen-sm) {
          width: 30px;
        }
      }
    }

    #{$block-name}__list {
      padding: 0;

      li {
        & > a,
        & > span {
          display: flex;
          align-items: center;
          padding-right: 5px;
          transition: color $transition-time;

          &:focus,
          &:hover {
            background-color: transparent;
            color: $color-1;
          }

          img {
            box-sizing: content-box;
            margin-left: auto;
            padding-left: 12px;
            width: 25px;
            height: auto;

            @media (min-width: $screen-sm) {
              width: 30px;
            }
          }
        }
      }
    }
  }
}
