// @import "./variables.scss";

.#{$namespace}dropdown {
  display: inline-block;
  cursor: pointer;
  a {
    text-decoration: none !important;
  }
  .#{$namespace}dropdown-trigger-item {
    display: inline-block;
    z-index: 2;
    user-select: none;
  }
  .#{$namespace}dropdown-group-box {
    position: relative;
    visibility: hidden;
    opacity: 0;
    transform: translate(0%, 0%) scale(0);
    transition: all .1s;
    z-index: 3;
    .#{$namespace}dropdown-item-group-box {
      padding: $dropdown-item-group-box-padding;
      .#{$namespace}dropdown-item-group {
        display: block;
        min-width: 100px;
        box-shadow: $dropdown-item-group-shadow;
        border-radius: $dropdown-item-group-border-radius;
        margin: 0px;
        padding: $dropdown-item-group-padding;
        background: $dropdown-item-group-background;
        white-space: nowrap;
        font-size: $dropdown-item-group-font-size;
        cursor: default;
        .#{$namespace}dropdown-item {
          min-height: 20px;
          padding: 0 10px;
          list-style: none;
          text-decoration: none;
          text-align: center;
          color: $dropdown-item-color;
          transition: all .1s;
          user-select: none;
          background: $dropdown-item-background;
          cursor: pointer;
          &:hover {
            background: $dropdown-item-hover-background;
            color: $dropdown-item-hover-color;
            a {
              color: $dropdown-item-hover-color !important;
            }
          }
        }
        .#{$namespace}dropdown-item-disabled {
          color: $dropdown-item-disabled-color;
          cursor: not-allowed !important;
          &:hover {
            background: $dropdown-item-disabled-hover-background;
            color: $dropdown-item-disabled-color;
            a {
              color: $dropdown-item-disabled-color !important;
            }
          }
        }
        .#{$namespace}dropdown-sub-menu-box {
          position: relative;
        }
        .#{$namespace}dropdown-sub-menu {
          min-height: 20px;
          padding: 0 26px 0 26px;
          list-style: none;
          text-align: center;
          text-decoration: none;
          transition: all .1s;
          cursor: pointer;
          user-select: none;
          color: $dropdown-submenu-color;
          background: $dropdown-submenu-background;
          &:hover {
            background: $dropdown-submenu-hover-background;
            color: $dropdown-submenu-hover-color;
            a {
              color: $dropdown-submenu-hover-color !important;
            }
          }
          &.#{$namespace}dropdown-sub-menu-disabled {
            cursor: not-allowed;
            color: $dropdown-submenu-disabled-color;
            &:hover + .#{$namespace}dropdown-item-box {
              visibility: hidden;
              opacity: 0;
            }
            &:hover {
              background: $dropdown-submenu-disabled-background;
              color: $dropdown-submenu-disabled-color;
              a {
                color: $dropdown-submenu-disabled-color !important;
              }
            }
          }
        }
        .#{$namespace}dropdown-sub-menu:hover + .#{$namespace}dropdown-item-box,
        .#{$namespace}dropdown-item-box:hover {
          visibility: visible;
          transform: translate(0%, 0%) scale(1);
          opacity: 1;
        }
        .#{$namespace}dropdown-item-box {
          position: absolute;
          top: 0;
          left: 100%;
          visibility: hidden;
          opacity: 0;
          margin-left: 2px;
          transform: translate(-50%, -50%) scale(0);
          min-width: 100px;
          box-shadow: $dropdown-item-group-shadow;
          border-radius: $dropdown-item-box-border-radius;
          margin: 0;
          padding: 5px 0;
          white-space: nowrap;
          background: $dropdown-item-box-background;
          font-size: $dropdown-item-box-font-size;
          transition: all .1s ease;
          transition-delay: .2s;
          cursor: default;
        }
      }
    }
  }
  .#{$namespace}dropdown-group-box-visible {
    position: relative;
    visibility: visible;
    transform: translate(0%, 0%) scale(1);
    opacity: 1;
  }
}

.#{$namespace}dropdown-divided {
  overflow: hidden;
  height: $dropdown-divider-height;
  margin: $dropdown-divider-margin;
  list-style: none;
  background-color: $dropdown-divider-background-color;
  cursor: default;
}

// 添加到body时样式需要公用
.#{$namespace}dropdown-item-group-box {
  padding: $dropdown-item-group-box-padding;
  .#{$namespace}dropdown-item-group {
    display: block;
    min-width: 100px;
    box-shadow: $dropdown-item-group-shadow;
    border-radius: $dropdown-item-group-border-radius;
    margin: 0px;
    padding: $dropdown-item-group-padding;
    background: $dropdown-item-group-background;
    white-space: nowrap;
    font-size: $dropdown-item-group-font-size;
    cursor: default;
    .#{$namespace}dropdown-item {
      min-height: 20px;
      padding: 0 10px;
      list-style: none;
      text-decoration: none;
      text-align: center;
      color: $dropdown-item-color;
      transition: all .1s;
      user-select: none;
      cursor: pointer;
      background: $dropdown-item-background;
      &:hover {
        background: $dropdown-item-hover-background;
        color: $dropdown-item-hover-color;
        a {
          color: $dropdown-item-hover-color !important;
        }
      }
    }
    .#{$namespace}dropdown-item-disabled {
      color: $dropdown-item-disabled-color;
      cursor: not-allowed !important;
      &:hover {
        background: $dropdown-item-disabled-hover-background;
        color: $dropdown-item-disabled-color;
        a {
          color: $dropdown-item-disabled-color !important;
        }
      }
    }
    .#{$namespace}dropdown-sub-menu-box {
      position: relative;
    }
    .#{$namespace}dropdown-sub-menu {
      min-height: 20px;
      padding: 0 26px 0 26px;
      list-style: none;
      text-align: center;
      text-decoration: none;
      transition: all .1s;
      cursor: pointer;
      user-select: none;
      color: $dropdown-submenu-color;
      background: $dropdown-submenu-background;
      &:hover {
        background: $dropdown-submenu-hover-background;
        color: $dropdown-submenu-hover-color;
        a {
          color: $dropdown-submenu-hover-color !important;
        }
      }
      &.#{$namespace}dropdown-sub-menu-disabled {
        cursor: not-allowed;
        color: $dropdown-submenu-disabled-color;
        &:hover + .#{$namespace}dropdown-item-box {
          visibility: hidden;
          opacity: 0;
        }
        &:hover {
          background: $dropdown-submenu-disabled-background;
          color: $dropdown-submenu-disabled-color;
          a {
            color: $dropdown-submenu-disabled-color !important;
          }
        }
      }
    }
    .#{$namespace}dropdown-sub-menu:hover + .#{$namespace}dropdown-item-box,
    .#{$namespace}dropdown-item-box:hover {
      visibility: visible;
      transform: translate(0%, 0%) scale(1);
      opacity: 1;
    }
    .#{$namespace}dropdown-item-box {
      position: absolute;
      top: 0;
      left: 100%;
      visibility: hidden;
      opacity: 0;
      margin-left: 2px;
      transform: translate(-50%, -50%) scale(0);
      min-width: 100px;
      box-shadow: $dropdown-item-group-shadow;
      border-radius: $dropdown-item-box-border-radius;
      margin: 0;
      padding: 5px 0;
      white-space: nowrap;
      background: $dropdown-item-box-background;
      font-size: $dropdown-item-box-font-size;
      transition: all .1s ease;
      transition-delay: .2s;
      cursor: default;
    }
  }
}

.#{$namespace}dropdown-group-box-visible {
  position: relative;
  visibility: visible;
  transform: translate(0%, 0%) scale(1);
  opacity: 1;
}