@import '../../../styles/core.scss';

.Menu {
  min-width: 200px;
  max-width: 275px;
  padding-bottom: 5px;
  padding-top: 5px;

  // scoped overrides
  .Dropdown-toggle:focus {
    outline: 0;

    .Menu-Item_link:not(.Menu-Item_link_disabled) {
      background: get(color 'lightGray');
    }
  }

  .Dropdown-content {
    border: 0;
    left: auto;
    right: auto;
    top: -6px;
    transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .Dropdown-content_closed {
    transform: scale(.95);
    visibility: hidden;
  }

  .Dropdown-content_opened {
    transform: none;
  }

  .Dropdown_justify\=right .Dropdown-content {
    left: 100%;
    transform-origin: 0% 15px;
  }

  .Dropdown_justify\=left .Dropdown-content {
    right: 100%;
    transform-origin: 100% 15px;
  }

  &-Header {
    color: get(color 'shale');
    font-size: 12px;
    margin-bottom: 5px;
    margin-top: 10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  &-Divider {
    background: get(color 'ivory');
    height: 1px;
    margin: ms(-8) 0;
  }

  &-Item {
    align-items: center;
    display: flex;
    padding: 5px 10px;
    position: relative;

    > * {
      flex: 1 1 auto;
      width: 100%;
    }

    &_link {
      background: none;
      border: 0;
      color: get(color 'slate');
      cursor: pointer;
      font-size: inherit;
      font-weight: 600;
      padding-left: 10px;
      padding-right: 10px;
      text-align: left;

      &:not(.Menu-Item_link_disabled):hover,
      &:not(.Menu-Item_link_disabled):focus {
        background: get(color 'lightGray');
      }

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active {
        background: get(color 'ivory');
      }

      &:focus {
        outline: 0;
      }

      &_disabled {
        cursor: not-allowed;
        opacity: 0.4;
      }

      > .fa,
      > .icon {
        flex: 0 0;
        font-size: 14px;
        opacity: 0.9;
        margin-right: 10px;
        width: 14px;
      }
    }

    &_arrow {
      padding-right: 30px;

      &::after {
        content: '▶';
        display: block;
        font-size: 12px;
        opacity: 0.25;
        position: absolute;
        right: 8px;
        top: 8px;
      }

      &:focus > .Menu-Item-SubMenu,
      &:hover > .Menu-Item-SubMenu {
        opacity: 1;
        pointer-events: auto;
        transform: none;
      }
    }

    &_blue {
      color: get(color 'blue');

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active,
      &:not(.Menu-Item_link_disabled):focus {
        background: rgba(get(color 'blue'), .1);
      }
    }

    &_green {
      color: get(color 'green');

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active,
      &:not(.Menu-Item_link_disabled):focus {
        background: rgba(get(color 'green'), .1);
      }
    }

    &_purple {
      color: get(color 'purple');

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active,
      &:not(.Menu-Item_link_disabled):focus {
        background: rgba(get(color 'purple'), .1);
      }
    }

    &_red {
      color: get(color 'red');

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active,
      &:not(.Menu-Item_link_disabled):focus {
        background: rgba(get(color 'red'), .1);
      }
    }

    &_yellow {
      color: get(color 'yellow');

      &:not(.Menu-Item_link_disabled):not(.Menu-Item_arrow):active,
      &:not(.Menu-Item_link_disabled):focus {
        background: rgba(get(color 'yellow'), .1);
      }
    }

    // sub menus
    &-SubMenu {
      padding: 0;
    }
  }
}
