/*-- copyright
 * OpenProject is a project management system.
 * Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 3.
 *
 * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
 * Copyright (C) 2006-2013 Jean-Philippe Lang
 * Copyright (C) 2010-2013 the ChiliProject Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * See doc/COPYRIGHT.rdoc for more details.  ++
 */

@import global/all

@mixin context_menu_defaults
  display:block
  margin: 0
  padding: 0
  border: 0

#context-menu
  position: absolute
  font-size: 0.9em
  left: -7px
  top: -7px
  padding: 6px
  z-index: 21
  ul
    @include context_menu_defaults
    width: 140px
    list-style: none
    position: absolute
    left: -7px
    z-index: 20
    background: #f4f4f4
    border: 1px solid #afafaf
  li
    @include context_menu_defaults
    position: relative
    padding: 1px
    padding: 6px
    z-index: 39
    border: 1px solid white
    background-position: 6px center
    background-repeat: no-repeat
    cursor: pointer
    border-top: 1px solid #fff
    border-bottom: 1px solid #ddd
    > a
      width:auto
    &:hover
      border: 1px solid gray
      background-color: #eee

    &.folder
      &:hover
        z-index: 40
      div.submenu
        background: url(image-path('arrow-right.png')) no-repeat right
        position: absolute
        height: 9px
        width: 7px
        top: 11px
        right: 6px
      ul
        display: none
        position: absolute
        max-height: 400px
        overflow-x: hidden
        overflow-y: auto
        left: 140px
        top: -1px
        width: auto
        z-index: 19

  a
    @include context_menu_defaults
    border: none
    background-repeat: no-repeat
    background-position: 1px 50%
    padding: 1px 10px 1px 15px
    width: 100%

    &.icon, &.icon-context
      color: $content_icon_link_hover_color
      font-weight: bold
      padding-left: 0

    &.disabled, &.disabled:hover
      color: #ccc

    &:hover
      color: #2A5685
      border: none
      text-decoration: none

  &.reverse-y li.folder>ul
    top: auto
    bottom: 0
  &.reverse-x li.folder
    ul
      left: auto
      right: 168px
    >ul
      right: 148px

#context-menu ul ul, #context-menu  li:hover ul ul
  display: none

#context-menu li:hover ul, #context-menu li:hover li:hover ul
  display: block

#context-menu li li
  padding: 6px 12px
  width: auto
  display: block
  white-space: nowrap

#context-menu li:hover ul
  display: block

.hascontextmenu
  cursor: context-menu
